Horizontal sundial calculations: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: whitespace)
Line 668: Line 668:


=={{header|REXX}}==
=={{header|REXX}}==
REXX doesn't have the usual trig functions, nor for that matter, a SQRT (square
REXX doesn't have the usual trig functions, nor for that matter, a SQRT (square root) function, so these as well as PI were added to this program.

root)
No attempt was made to explain the inner workings of these functions.
<br> function, so these as well as PI were added to this program.
<lang rexx>/*REXX program shows hour/sun hour angle/dial hour line angle, 6am->6pm.*/
<br><br>No attempt was made to explain the inner workings of these functions.
<lang rexx>
/*REXX program shows hour/sun hour angle/dial hour line angle, 6am->6pm.*/


numeric digits 60 /*better overkill then underkill. */
numeric digits 60 /*better overkill then underkill. */
Line 758: Line 756:


sqrtGuess: if x<0 then call sqrtErr; numeric form scientific; m.=11; p=d+d%4+2;
sqrtGuess: if x<0 then call sqrtErr; numeric form scientific; m.=11; p=d+d%4+2;
parse value format(x,2,1,,0) 'E0' with g 'E' _ .; return g*.5'E'_%2
parse value format(x,2,1,,0) 'E0' with g 'E' _ .; return g*.5'E'_%2</lang>
</lang>
Output:
Output:
<pre>
<pre style="height:50ex;overflow:scroll">
latitude: -4.95
latitude: -4.95
longitude: -150.5
longitude: -150.5