OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

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

[ Lists Home | Date Index | Thread Index ]

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@reutershealth.com




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS