Arithmetic/Rational: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: added comment about ignoring the first reciprocal (unity). -- ~~~~)
m (→‎{{header|REXX}}: corrected two misspellings of numerator. -- ~~~~)
Line 2,232: Line 2,232:
parse var x n '/' d; d=p(d 1)
parse var x n '/' d; d=p(d 1)
if d=0 then call err 'division by zero:' x
if d=0 then call err 'division by zero:' x
if \isNum(n) then call err 'a not numeric numinator:' x
if \isNum(n) then call err 'a not numeric numerator:' x
if \isNum(d) then call err 'a not numeric denominator:' x
if \isNum(d) then call err 'a not numeric denominator:' x
return n/d
return n/d
Line 2,251: Line 2,251:
do j=1 for 2 /*verification of both fractions.*/
do j=1 for 2 /*verification of both fractions.*/
if pos('/',z.j)==0 then z.j=z.j"/1"; parse var z.j n.j '/' d.j
if pos('/',z.j)==0 then z.j=z.j"/1"; parse var z.j n.j '/' d.j
if \isNum(n.j) then call err 'a not numeric numinator:' n.j
if \isNum(n.j) then call err 'a not numeric numerator:' n.j
if \isNum(d.j) then call err 'a not numeric denominator:' d.j
if \isNum(d.j) then call err 'a not numeric denominator:' d.j
n.j=n.j/1; d.j=d.j/1
n.j=n.j/1; d.j=d.j/1