xsl-list
[Top] [All Lists]

RE: [xsl] format-number incorrectly formatting number (using fop 0.91beta)

2006-04-18 04:35:18
It might well be that the error is not introduced by format-number, but by
the string-to-double conversion used when the number is read in the first
place. You're at the limit of the range of precision that double-precision
floating point can handle.

To investigate further however, one needs to know which XSLT processor you
are using! (Probably Xalan, if you're using FOP, unless you specify
otherwise).

For large numbers like this I suggest you switch to XSLT 2.0 and xs:decimal.
Saxon's implementation of xs:decimal handles arbitrary-precision formatting
and arithmetic.

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: Ian & Chris [mailto:bakeric(_at_)optusnet(_dot_)com(_dot_)au]
Sent: 18 April 2006 11:28
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] format-number incorrectly formatting number (using fop
0.91beta)

Hi all,

 I am currently trying to format a large number (19v2) in a report, the
format-number function seems to do incorrect formatting when it deals with
large numbers, and an example follows:

<xsl:value-of select='format-number(-34567890123456787.00,"###,###.00
;###,###.00CR")'/>

In the above example the number should read

34,567,890,123,456,787.00CR

But when it formats it is set to:

34,567,890,123,456,788.00CR


Any ideas, OK it is a large number, and you might say well you would never
use this, but, in insurance companies in Indonesia the numbers for
re-insurance in the local currency (rupiah). It may get to many billions
for
a year.


Thanks, Ian


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>