Lists Home |
Date Index |
Dare Obasanjo writes:
> Ah, yes. Because arbitrary precision decimals are wide spread and
interoperable across multiple platforms and programming languages.
Decimal arithmetic is certainly supported in quite a few places already, but
Java/EcmaScript is an unfortunate exception.
We wanted very much to put decimal arithmetic into XForms, since financial
calculations done with decimal arithmetic produce the right answer -- nobody
wants their shopping cart to tell them that the total with tax is
$1.3650000000000002131628207280300557613372802734375 (to take the example
from the FAQ below of double-precision floating point 5% tax on $1.30).
The biggest problems we faced were with XML Schema and XPath:
- They don't agree on types, though XPath 2 aims to fix that (hence this
- XPath 1.0 insists on IEEE floats, which the small device vendors think is
too much and many folks with larger systems think is either not enough or
- There is supposedly a task force to provide new common XML Schema data
types, but it's hard to figure out how to get this effort started (though
there is EXSLT.ORG)
Mike Cowlishaw of IBM has a small decimal arithmetic package which performs
arbitrary precision decimal arithmetic, and I believe he would certainly
like it to be widespread and interoperable across multiple platforms and
programming languages. See
http://www2.hursley.ibm.com/decimal/decifaq1.html for an FAQ.
I've heard that the IBM package is about 4K bytes when compiled to a
bytecoded language, so sufficiently motivated implementors should have no
trouble fitting it into even the smallest of cell phones...
From: Dare Obasanjo [mailto:firstname.lastname@example.org]
Sent: Wednesday, December 04, 2002 12:14 PM
To: Jonathan Robie; Rich Salz
Cc: XML DEV
Subject: RE: [xml-dev] bohemians, gentry
Ah, yes. Because arbitrary precision decimals are wide spread and
interoperable across multiple platforms and programming languages. I
remember reading somewhere that W3C XML Schema just added a third layer of
impedence mismatch to the mix. In the old days we had objects --> database
impedence mismatches which cultivated the rise of object oriented databases.
Now we have XSD ->objects-> database as the new impedence mismatch. Quite
frankly, I'm beginning to be of the opinion that the primacy of xs:integer
and xs:decimal types in most schemas is a mistake given that we have
xs:float, xs:double and xs:int which are guaranteed to interoperate while
the former are not.