Trigonometric functions: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: added further normalization for degrees to radians that was omitted.)
m (→‎{{header|REXX}}: expanded some subroutine source code to the original, changed some wording in comments.)
Line 2,017:
return z
 
Atan: procedure; arg x; if abs(x)=1 then return pi()/4*.25*sign(x)
return Asin(x/sqrt(1+x**2x))
 
cos: procedure; arg x; x=r2r(x); a=abs(x); numeric fuzz min(9,digits()-9)
if a=pi() then return -1; if a=pi()*.5 | a=pi()*2 then return 0
if api3=pi()/3; if a=pi3 then return .5; if a=2*pi()/3pi3 then return -.5
return .sinCos(1,1,-1)
 
Line 2,039:
e: return,
2.7182818284590452353602874713526624977572470936999595749669676277240766303535
/*Note: the "real:actual E subroutine returns E's accuracy that */
/*matches the current NUMERIC DIGITS, up to 1 million digits.*/
/*If more than 1 million digits are required, be patient. */
Line 2,049:
pi: return, /*a bit of overkill, but hey !! */
3.1415926535897932384626433832795028841971693993751058209749445923078164062862
/*Note: the realactual PI subroutine returns PI's accuracy that */
/*matches the current NUMERIC DIGITS, up to 1 million digits.*/
/*John Machin's formula is used for calculating more digits. */