Air mass: Difference between revisions

100 bytes added ,  3 years ago
m
→‎{{header|REXX}}: changed whitespace, added comments.
m (→‎{{header|REXX}}: added a foot separator line (for the output).)
m (→‎{{header|REXX}}: changed whitespace, added comments.)
Line 483:
if oHT=='' | oHT=="," then oHT= 13700 /* " " " " " " */
w= 30; @ama= 'air mass at' /*column width for the two air_masses. */
say 'angle|'center(@ama "sea level", w) center(@ama commacommas(oHT) "'meters"', w) /*title*/
say '"─────┼'"copies(center(""'', w, '"'"), 2)'─' /*display the title sep for the output.*/
y= left('', w-20) /*padY: for alignment of the output cols.*/
 
do j=aLO to aHI by aBY; am0= airM(0, j); amht= airM(oHT, j)
Line 491:
end /*j*/
 
say '"─────┴'"copies(center(""'', w, '"'"), 2)'─' /*display the foot separator for output*/
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
Line 500:
r2r: return arg(1) // (pi() * 2) /*normalize radians ──► a unit circle. */
e: e= 2.718281828459045235360287471352662497757247093699959574966967627724; return e
commacommas: parse arg ?; do jc=length(?)-3 to 1 by -3; ?=insert(',', ?, jc); end; return ?
/*──────────────────────────────────────────────────────────────────────────────────────*/
cos: procedure; parse arg x; x= r2r(x); a= abs(x); numeric fuzz min(6, digits() - 3)
Line 521:
aa= earthRad + a; return sqrt(aa**2 + d**2 - 2*d*aa*cos( d2r(180-z) ) ) - earthRad
/*──────────────────────────────────────────────────────────────────────────────────────*/
colD: procedure; parse arg a,z; sum= 0; d= 0; dd= .001; infinity= 10000000
do while d<infinity; delta= max(dd, dd*d)
sum= sum + rho( elev(a, z, d + 0.5*delta) ) * delta; d= d + delta