Anonymous user
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
/*──────────────────────────────────────────────────────────────────────────────────────*/
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=
x= (ox + oy) * .5 /*compute " new " " X. */
y= sqrt(ox * oy) /* " " " " " Y. */
|