[Bug 1406] Serialization of float and double via decimal problematic

http://www.w3.org/Bugs/Public/show_bug.cgi?id=1406





------- Additional Comments From mike@saxonica.com  2005-05-13 18:00 -------
I've never really understood how an implementation can get away with only
supporting 18 digits of precision, since xs:unsignedLong requires 20; but that's
incidental.

For format-number() in XSLT 2.0 we specify that the behaviour is as if the
xs:double is converted to an xs:decimal using an implementation of xs:decimal
that supports infinite precision, and we then describe how this notional
xs:decimal is converted to a string. This does not require that the
implementation actually supports such an xs:decimal type, only that
double->string conversion behaves as if it did. I would suggest that we adopt
the same approach here.

Outputting natural numbers such as 1, 2, and 3 in exponential notation is not an
option. Doubles arise all the time as a result of our implicit rules for
handling untyped data; we can't possibly contemplate the output of 

See Chapter <xsl:value-of select="@chap + 1"/>

being "See Chapter 2e0".

Michael Kay

Received on Friday, 13 May 2005 18:00:30 UTC