Horizontal sundial calculations: Difference between revisions
Content deleted Content added
m →{{header|REXX}}: whitespace |
m →{{header|REXX}}: expanded comment about pi. |
||
Line 716: | Line 716: | ||
/*─────────────────────────────────────subroutines──────────────────────*/ |
/*─────────────────────────────────────subroutines──────────────────────*/ |
||
sep: say indent copies('=',w1) copies('=',w2) copies('=',w3); return |
sep: say indent copies('=',w1) copies('=',w2) copies('=',w3); return |
||
pi: return, /*a bit of overkill, but hey !! */ |
pi: return, /*a bit of overkill, but hey !! */ |
||
3.1415926535897932384626433832795028841971693993751058209749445923078164062862 |
3.1415926535897932384626433832795028841971693993751058209749445923078164062862 |
||
/*Note: the real PI subroutine*/ |
|||
/*returns the number of digits */ |
|||
/*that matches the current */ |
|||
/*NUMERIC DIGITS ----- up to */ |
|||
/*1 million+ digits. Past that,*/ |
|||
/*it calculates more digits via */ |
|||
/*John Machin's formula. */ |
|||
2d: return arg(1)//360 /*normalize degrees►1 unit circle*/ |
|||
d2r: return r2r(arg(1)*pi()/180) /*convert degrees ──► radians. */ |
d2r: return r2r(arg(1)*pi()/180) /*convert degrees ──► radians. */ |
||
r2d: return d2d((arg(1)*180/pi())) /*convert radians ──► degrees. */ |
r2d: return d2d((arg(1)*180/pi())) /*convert radians ──► degrees. */ |