Arithmetic-geometric mean: Difference between revisions

m
→‎{{header|REXX}}: added/changed whitespace and comments.
m (elided a doubly linked to URL.)
m (→‎{{header|REXX}}: added/changed whitespace and comments.)
Line 2,393:
say '2nd # =' b /* " " B " */
say ' AGM =' agm(a, b) /* " " AGM " */
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
agm: procedure: parse arg x,y; if x=y then return x /*is this an equality case?*/
Line 2,403:
ox= x + 1 /*ensure that the old X ¬= new X. */
do while ox\=x & abs(ox)>tiny /*compute until the old X ≡ new X. */
ox= x; oy= y /*save the old value of X. and Y. */
oy= y /* " " " " " Y. */
x= (ox + oy) * .5 /*compute " new " " X. */
y= sqrt(ox * oy) /* " " " " " Y. */