C+ C NAME: C SindLookup C PURPOSE: C Calculates sin(x) using lookup table C CATEGORY: C Math C CALLING SEQUENCE: function SindLookup(X) C INPUTS: C X real X-coordinate (degrees) C OUTPUTS: C F real sin(x) from table lookup C CALLS: C FLINT, sind C SEE ALSO: C GaussLookup, CosdLookup C RESTRICTIONS: C The table lookup runs up to 10. For larger X-values, the return value is zero C MODIFICATION HISTORY: C SEP-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- real X parameter (N =9000) parameter (dA=90.0/N) real F(0:N) logical bInit /.TRUE./ save bInit, F if (bInit) then ! Set up lookup table do I=0,N F(I) = sind(dA*I) end do bInit = .FALSE. end if A = mod(mod(X,360.0)+360.0,360.0) ! Scale to [0,360] I = 1 if (A .gt. 180.0) then A = 360.0-A ! sin(-x) = -sin(x) I = -1 end if if (A .gt. 90.0) A = 180.0-A ! sin(180-x) = sin(x) ! X now is in [0,90] SindLookup = I*FLINT(1,N+1,F,1.0+A/dA,0.0) return end