[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: 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. jcowan@r...
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|