Re: [xml-dev] Best way to represent fractional values?

From
John Cowan <>
To
Date
2003-02-10T19:25:25Z
ID
<>
Thread
Re: [xml-dev] Best way to represent fractional values?
Hugh Wallis scripsit:

> But my point is that I can never make fractionDigits large enough to reach a
> representation of 1/3 since that would require fractionDigits to equal
> infinity. I want to be able to represent exactly 1/3, not some close
> approximation of it.
> 
> Now I know people are going to say "you can't do that in computers because
> of floating point stuff" but that isn't really true - if you represent the
> numerator and denominator separately then you can represent it perfectly
> fine.

Indeed, the Lisp/Scheme family of languages do as a rule implement exact
rational numbers as fractions:  (/ 1 3) evaluates to 1/3.

-- 
Higgledy-piggledy / XML programmers     John Cowan
Try to escape those / I-eighteen-N woes;        http://www.ccil.org/~cowan
Incontrovertibly / What we need more of is      http://www.reutershealth.com
Unicode weenies and / Fran\xe7ois Yergeaus.