diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /sys/vops/lz/arczs.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/vops/lz/arczs.x')
-rw-r--r-- | sys/vops/lz/arczs.x | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sys/vops/lz/arczs.x b/sys/vops/lz/arczs.x new file mode 100644 index 00000000..4216d38d --- /dev/null +++ b/sys/vops/lz/arczs.x @@ -0,0 +1,39 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +# ARCZ -- Vector reciprocal with checking for zero divisors. If the result +# of a divide would be undefined a user supplied function is called to get the +# output pixel value. +# +# NOTE: in the interests of simplicity a somewhat arbitrary tolerance is used +# to check for an undefined divide, i.e., a divide by zero or a divide by a +# number small enough to cause floating point overflow. A better way to do +# this would be to provide a machine dependent version of this operator in +# host$as which catches the hardware exception rather than using a comparison. + +procedure arczs (a, b, c, npix, errfcn) + +short a # numerator +short b[ARB], c[ARB] # divisor, and output arrays +int npix # number of pixels +short errfcn() # user function, called on divide by zero + +int i +short divisor +extern errfcn() +errchk errfcn + +begin + if (a == 0) { + call aclrs (c, npix) + return + } + + + do i = 1, npix { + divisor = b[i] + if (divisor == 0) + c[i] = errfcn (a) + else + c[i] = a / divisor + } +end |