You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by la...@swedbank.se on 2010/12/21 14:29:53 UTC

Numeric precision

Hi.

I have a need to process a xml-document containing a node that, at most, can contain 18 digits (16 integer and 2 fraction). What I have found however is that the last decimal will be corrupted (set to zero) and I have a suspicion that this is because the internal representation is a double am I right?

Primarily I need to edit it but also use it as input in a sum function which in turn will also result in an edit (of the result).

The question therefore is: Does anybody have an idea of how to process such a large number with Xalan?

I am currently running Xalan 2.7.0.

Regards Lars

Ps. Happy Holidays.....
Ds.

Re: Numeric precision

Posted by David Bertoni <db...@apache.org>.
On 12/21/2010 5:29 AM, lars.bjerges@swedbank.se wrote:
> Hi.
>
> I have a need to process a xml-document containing a node that, at most,
> can contain 18 digits (16 integer and 2 fraction). What I have found
> however is that the last decimal will be corrupted (set to zero) and I
> have a suspicion that this is because the internal representation is a
> double am I right?
Yes. The only numeric type in XPath/XSLT 1.0 is an IEEE 754 double:

http://www.w3.org/TR/1999/REC-xpath-19991116/#numbers

>
> Primarily I need to edit it but also use it as input in a sum function
> which in turn will also result in an edit (of the result).
>
> The question therefore is: Does anybody have an idea of how to process
> such a large number with Xalan?
You would need to write extension functions to process larger numbers 
and create a new type that supports them.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org