aboutsummaryrefslogtreecommitdiff
path: root/src/slalib/drange.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/drange.f
downloadcalfuse-d54fe7c1f704a63824c5bfa0ece65245572e9b27.tar.gz
Initial commit
Diffstat (limited to 'src/slalib/drange.f')
-rw-r--r--src/slalib/drange.f32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/slalib/drange.f b/src/slalib/drange.f
new file mode 100644
index 0000000..9e678af
--- /dev/null
+++ b/src/slalib/drange.f
@@ -0,0 +1,32 @@
+ DOUBLE PRECISION FUNCTION sla_DRANGE (ANGLE)
+*+
+* - - - - - - -
+* D R A N G E
+* - - - - - - -
+*
+* Normalize angle into range +/- pi (double precision)
+*
+* Given:
+* ANGLE dp the angle in radians
+*
+* The result (double precision) is ANGLE expressed in the range +/- pi.
+*
+* P.T.Wallace Starlink 23 November 1995
+*
+* Copyright (C) 1995 Rutherford Appleton Laboratory
+*-
+
+ IMPLICIT NONE
+
+ DOUBLE PRECISION ANGLE
+
+ DOUBLE PRECISION DPI,D2PI
+ PARAMETER (DPI=3.141592653589793238462643D0)
+ PARAMETER (D2PI=6.283185307179586476925287D0)
+
+
+ sla_DRANGE=MOD(ANGLE,D2PI)
+ IF (ABS(sla_DRANGE).GE.DPI)
+ : sla_DRANGE=sla_DRANGE-SIGN(D2PI,ANGLE)
+
+ END