aboutsummaryrefslogtreecommitdiff
path: root/src/slalib/range.f
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-03-04 21:21:30 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-03-04 21:21:30 -0500
commitd54fe7c1f704a63824c5bfa0ece65245572e9b27 (patch)
treeafc52015ffc2c74e0266653eecef1c8ef8ba5d91 /src/slalib/range.f
downloadcalfuse-d54fe7c1f704a63824c5bfa0ece65245572e9b27.tar.gz
Initial commit
Diffstat (limited to 'src/slalib/range.f')
-rw-r--r--src/slalib/range.f33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/slalib/range.f b/src/slalib/range.f
new file mode 100644
index 0000000..a3684cb
--- /dev/null
+++ b/src/slalib/range.f
@@ -0,0 +1,33 @@
+ REAL FUNCTION sla_RANGE (ANGLE)
+*+
+* - - - - - -
+* R A N G E
+* - - - - - -
+*
+* Normalize angle into range +/- pi (single precision)
+*
+* Given:
+* ANGLE dp the angle in radians
+*
+* The result is ANGLE expressed in the +/- pi (single
+* precision).
+*
+* P.T.Wallace Starlink 23 November 1995
+*
+* Copyright (C) 1995 Rutherford Appleton Laboratory
+*-
+
+ IMPLICIT NONE
+
+ REAL ANGLE
+
+ REAL API,A2PI
+ PARAMETER (API=3.141592653589793238462643)
+ PARAMETER (A2PI=6.283185307179586476925287)
+
+
+ sla_RANGE=MOD(ANGLE,A2PI)
+ IF (ABS(sla_RANGE).GE.API)
+ : sla_RANGE=sla_RANGE-SIGN(A2PI,ANGLE)
+
+ END