Trigonometric functions: Difference between revisions
Content added Content deleted
(→{{header|REXX}}: boxed the technique used here to aid novice programmers in ripping code. -- ~~~~) |
m (→{{header|REXX}}: added a couple of comments about when needing more than 1 million digits of '''pi''' or '''e'''. -- ~~~~) |
||
Line 1,691: | Line 1,691: | ||
/*Note: the real E subroutine returns E's accuracy that */ |
/*Note: the real E subroutine returns E's accuracy that */ |
||
/*matches the current NUMERIC DIGITS, up to 1 million digits.*/ |
/*matches the current NUMERIC DIGITS, up to 1 million digits.*/ |
||
/*If more than 1 million digits are required, be patient. */ |
|||
exp: procedure; arg x; ix=x%1; if abs(x-ix)>.5 then ix=ix+sign(x); x=x-ix |
exp: procedure; arg x; ix=x%1; if abs(x-ix)>.5 then ix=ix+sign(x); x=x-ix |
||
Line 1,700: | Line 1,701: | ||
/*Note: the real PI subroutine returns PI's accuracy that */ |
/*Note: the real PI subroutine returns PI's accuracy that */ |
||
/*matches the current NUMERIC DIGITS, up to 1 million digits.*/ |
/*matches the current NUMERIC DIGITS, up to 1 million digits.*/ |
||
/*If more than 1 million digits are required, be patient. */ |
|||
/*John Machin's formula is used for calculating more digits. */ |
/*John Machin's formula is used for calculating more digits. */ |
||
Acos: procedure; arg x; if x<-1|x>1 then call AcosErr; return .5*pi()-Asin(x) |
Acos: procedure; arg x; if x<-1|x>1 then call AcosErr; return .5*pi()-Asin(x) |
||
AcosD: return r2d(Acos(arg(1))) |
AcosD: return r2d(Acos(arg(1))) |