Anonymous user
Circles of given radius through two points: Difference between revisions
Circles of given radius through two points (view source)
Revision as of 22:31, 27 September 2019
, 4 years ago→{{header|REXX}}: handled case of lowercase E in a number, added/changed whitespace and comments.
Catskill549 (talk | contribs) |
m (→{{header|REXX}}: handled case of lowercase E in a number, added/changed whitespace and comments.) |
||
Line 2,743:
{{trans|XPL0}}
<br>The REXX language doesn't have a '''sqrt''' function, so one is included below.
<lang rexx>/*REXX
@.=; @.1= 0.1234 0.9876 0.8765 0.2345 2
@.2= 0 2 0 0 1
Line 2,752:
say ' ════════ ════════ ════════ ════════ ══════ ════════ ════════ ════════ ════════'
do j=1 while @.j\==''; parse var @.j p1 p2 p3 p4 r /*points, radii*/
say f(p1) f(p2) f(p3) f(p4) center(r/1, 9) "───► " 2circ(@.j)
end /*j*/
exit /*stick a fork in it, we're all done. */
Line 2,764:
return f(bx-x1) f(by+y1) f(bx+x1) f(by-y1)
/*──────────────────────────────────────────────────────────────────────────────────────*/
f: arg f; f= right( format(
if pos(.,f)>0 & pos('E',f)=0 then f= strip(f,'T',0)
return left( strip(f, 'T', .), length(_)
/*──────────────────────────────────────────────────────────────────────────────────────*/
sqrt: procedure; arg x; if x=0 then return 0; d=digits(); numeric digits; h=d+6; 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;
do k=j+5 to 0 by -1; numeric digits m.k; g=(g+x/g)*.5;
{{out|output}}
<pre>
|