Convert decimal number to rational: Difference between revisions

m
→‎{{header|REXX}}: handled case of zero (numerator) better. -- ~~~~
(→‎{{header|REXX}}: added what types of numbers are permitted and their allowable forms. -- ~~~~)
m (→‎{{header|REXX}}: handled case of zero (numerator) better. -- ~~~~)
Line 876:
if f.2\=='' then do; n.1=n.1||copies(0,L.2); n.2=n.2||f.2; end
 
if n.2==0 then call er "divisor can't be zero." /*whoa, dividing by 0*/
if s.1==s.2 then s.=1 /*case of both #'s have same sign*/
call reduce min(n.1,n.2) /*case of a # dividing the other.*/
Line 901:
/*──────────────────────────────────REDUCE subroutine───────────────────*/
reduce: parse arg ? /*prepare for slicing 'n dicing. */
do while ?\==>1 /*there're no REXX short-circuts.*/
if n.1//?\==0 then leave
if n.2//?\==0 then leave