[Home] [By Thread] [By Date] [Recent Entries]

  • To: xml-dev@l...
  • Subject: Re: Best way to represent fractional values?
  • From: John Cowan <cowan@m...>
  • Date: Mon, 10 Feb 2003 14:25:25 -0500 (EST)

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.        jcowan@r...

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member