1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- ***********************************************************************
- c ORBEL_SCGET.F
- ***********************************************************************
- * PURPOSE: Given an angle, efficiently compute sin and cos.
- *
- * Input:
- * angle ==> angle in radians (real scalar)
- *
- * Output:
- * sx ==> sin(angle) (real scalar)
- * cx ==> cos(angle) (real scalar)
- *
- * ALGORITHM: Obvious from the code
- * REMARKS: The HP 700 series won't return correct answers for sin
- * and cos if the angle is bigger than 3e7. We first reduce it
- * to the range [0,2pi) and use the sqrt rather than cos (it's faster)
- * BE SURE THE ANGLE IS IN RADIANS - NOT DEGREES!
- * AUTHOR: M. Duncan.
- * DATE WRITTEN: May 6, 1992.
- * REVISIONS:
- ***********************************************************************
- subroutine orbel_scget(angle,sx,cx)
- include '../swift.inc'
- c... Inputs Only:
- real*8 angle
- c... Output:
- real*8 sx,cx
- c... Internals:
- integer nper
- real*8 x
- real*8 PI3BY2
- parameter(PI3BY2 = 1.5d0*PI)
- c----
- c... Executable code
- nper = angle/TWOPI
- x = angle - nper*TWOPI
- if(x.lt.0.d0) then
- x = x + TWOPI
- endif
- sx = sin(x)
- cx= sqrt(1.d0 - sx*sx)
- if( (x .gt. PIBY2) .and. (x .lt.PI3BY2)) then
- cx = -cx
- endif
- return
- end ! orbel_scget
- c-------------------------------------------------------------------
|