home *** CD-ROM | disk | FTP | other *** search
- ********************
-
- FUNCTION Cosin
-
- * Written and contributed by ESSOR MASO
- *
- * For the input argument in the first circle, degrees -360 <=arg <=360.
- * The error ABS(e(arg)) <= 2*10^(-9); the value 2 is returned if
- * either the argument or the D or R is missing, or the ABS(arg) > 360.
- *
- * Correct form: COSIN(arg,'D')
- *
- * National Bureau of Standards Handbook of Mathematical Functions
-
- PARAMETERS _coswork, _cosdeg
-
- IF TYPE("_coswork") + TYPE("_cosdeg") != "NC"
- RETURN(2)
- ENDIF
-
- SET DECIMAL TO 10
-
- PRIVATE _cosint, _cossqu
-
- _cossign = IF(_coswork < 0, .T., .F.)
- IF ABS(IF(UPPER(_cosdeg)#'D',_coswork,_coswork*1.5707963268/90))>6.2831853072 .OR. PCOUNT() # 2
- RETURN(2)
- ENDIF
-
- _coswork = ABS(IF(UPPER(_cosdeg)#'D',_coswork,_coswork*1.5707963268/90))
- _cosint = MODULUS(INT(_coswork/1.5707963268),4)
- _coswork = MODULUS(_coswork,1.5707963268)
-
- IF _cosint=1.OR._cosint=3
- _coswork=1.5707963268-_coswork
- ENDIF
- STORE _coswork*_coswork TO _coswork,_cossqu
-
- _coswork = .0000247609-.0000002605*_cossqu
- _coswork = -.0013888397+_coswork*_cossqu
- _coswork = .0416666418+_coswork*_cossqu
- _coswork = -.4999999963+_coswork*_cossqu
- _coswork = ROUNDING(1+_coswork*_cossqu,8)
-
- IF _cosint = 1.OR._cosint=2
- _coswork = -_coswork
- ENDIF
- RETURN(_coswork)
-
- * End of File
-
-