On 2012-01-03 23:00:16 +0100, Vincent Lefevre wrote: > On 2012-01-03 20:53:40 +0000, Laurence Rowe wrote: > > On 16 December 2011 17:06, Konrad Korzeniowski <kon...@pandur.net> wrote: [...] > > > <xsl:value-of select="number('8.95')"/> [...] > > Except that this seems to be a bug here:
After looking at the spec, I confirm this is a bug. The XPath spec says for number(): "a string that consists of optional whitespace followed by an optional minus sign followed by a Number followed by whitespace is converted to the IEEE 754 number that is nearest (according to the IEEE 754 round-to-nearest rule) to the mathematical value represented by the string" The nearest value X is the following one (represented exactly in radix 16, thanks to %a): > $ /usr/bin/printf "%a\n" 8.95 > 0x8.f33333333333333p+0 But actually (see below) the internal representation doesn't matter here. Concerning xsl:value-of, the XSLT spec says that for a number, the XPath string() fucntion is used, and the XPath spec says for the above value: "otherwise, the number is represented in decimal form as a Number including [...]; beyond the one required digit after the decimal point there must be as many, but only as many, more digits as are needed to uniquely distinguish the number from all other IEEE 754 numeric values." (FYI, that's the IEEE 754 rule for conversions.) As a consequence, the output value should be "8.95" (like the input) because 8.95 rounds to X and has less than 17 digits. -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <http://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon) _______________________________________________ xslt mailing list, project page http://xmlsoft.org/XSLT/ xslt@gnome.org http://mail.gnome.org/mailman/listinfo/xslt