Re: [xslt] floating point conversion



Nick Wellnhofer writes:
>> The crux is that number("100.15") is not equal to 100.15.
>That's how floating point numbers work.

No, I'm saying that number("100.15") != 100.15, which isn't
the way floating point works.

   <xsl:if test="number('100.15') != 100.15">
       <xsl:text>not good</xsl:text>
   </xsl:if>

There should be consistency in the conversion.

>That the second number is different seems to be a bug in libxml2. The 
>implementations of xmlXPathStringEvalNumber and xmlXPathCompNumber are 
>slightly different AFAICS.

Cool, and since C gives the float of 100.15 as 100.15000000000000568434,
I'll assume xmlXPathCompNumber is the problem, since
format-number(100.15, '####.################') should not be
100.1499999999999915

Thanks,
 Phil


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]