Re: [xslt] floating point conversion



On 2010-09-10 17:26:44 -0400, Phil Shafer wrote:
> Nick Wellnhofer writes:
> >That the second number is different seems to be a bug in libxml2. The 
> >implementations of xmlXPathStringEvalNumber and xmlXPathCompNumber are 
> >slightly different AFAICS.
> 
> Thanks for the pointer.  The current xmlXPathCompNumber logic does
> multiple divisions, which accumulates rounding errors.  Here's the
> fix:
[...]

I fear that's not sufficient. A few lines above, the multiplications
by 10 and additions introduce rounding errors for 17 digits and more.
An integer just below a rounding boundary will probably not be rounded
correctly.

-- 
Vincent Lefèvre <vincent 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)


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