Problem of Apollonius: Difference between revisions

m
→‎{{header|REXX}}: changed whitespace.
m (Updated output to that of version 1.4.)
m (→‎{{header|REXX}}: changed whitespace.)
Line 2,485:
<lang rexx>/*REXX program solves the problem of Apollonius, named after the Greek Apollonius of */
/*────────────────────────────────────── Perga [Pergæus] (circa 262 BCE ──► 190 BCE). */
numeric digits 15; x1= 0; y1= 0; r1= 1
x2= 4; y2= 0; r2= 1
x3= 2; y3= 4; r3= 2
call tell 'external tangent: ', Apollonius( 1, 1, 1)
call tell 'internal tangent: ', Apollonius(-1, -1, -1)
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
Line 2,509:
sqrt: procedure; parse arg x; if x=0 then return 0; d=digits(); h=d+6; numeric digits
m.=9; numeric form; parse value format(x,2,1,,0) 'E0' with g 'E' _ .; g=g*.5'e'_%2
do j=0 while h>9; m.j=h; h= h % 2 + 1; end /*j*/
do k=j+5 to 0 by -1; numeric digits m.k; g=(g+x/g) * .5; end /*k*/; return g
return g
/*──────────────────────────────────────────────────────────────────────────────────────*/
tell: parse arg _,a b c; w=digits()+4; say _ left(a/1,w%2) left(b/1,w) left(c/1,w); return</lang>