aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/fpndgr.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /sys/gio/fpndgr.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/gio/fpndgr.x')
-rw-r--r--sys/gio/fpndgr.x21
1 files changed, 21 insertions, 0 deletions
diff --git a/sys/gio/fpndgr.x b/sys/gio/fpndgr.x
new file mode 100644
index 00000000..ae471e34
--- /dev/null
+++ b/sys/gio/fpndgr.x
@@ -0,0 +1,21 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# FP_NONDEGENR -- If two floating point numbers are equivalent to within the
+# machine epsilon, adjust their values until a nondegenerate range is obtained.
+# The boolean function returns true if it has to MAKE the range nondegenerate,
+# i.e., if it modifies their values.
+
+bool procedure fp_nondegenr (x1, x2)
+
+real x1, x2 # range to be adjusted
+int n
+bool fp_equalr()
+
+begin
+ for (n=0; fp_equalr(x1,x2); n=n+1) {
+ x1 = x1 - max (abs(x1) * 0.01, 0.01)
+ x2 = x2 + max (abs(x2) * 0.01, 0.01)
+ }
+
+ return (n > 0)
+end