Anonymous user
Trigonometric functions: Difference between revisions
m
→{{header|REXX}}: changed the fuzz digits in the COS function.
m (→{{header|REXX}}: changed extra digits and optimized the sqrt function, added a comment.) |
m (→{{header|REXX}}: changed the fuzz digits in the COS function.) |
||
Line 3,512:
numeric digits showdigs+10 /*DIGITS default is 9, but use */
/*extra digs to prevent rounding.*/
say 'Using' showdigs 'decimal digits precision.'; say
Line 3,540 ⟶ 3,541:
return Asin(x/sqrt(1+x*x) )
cos: procedure; parse arg x; x=r2r(x); a=abs(x);
numeric fuzz min(6,digits()-3);
if
if a=pi()*2/3 then return -.5; return .sinCos(1,
sin: procedure; parse arg x; x=r2r(x); numeric fuzz $fuzz(5, 3)
if x=pi*.5 then return 1; if x==pi*1.5 then return -1
if abs(x)=pi | x=0 then return 0; return .sinCos(x,
.sinCos: parse arg z 1 _,i; q=x*x
|