Re: [xml] XPath question w/ libxml2



On Fri, Apr 16, 2004 at 11:50:16AM -0600, Mark_Vakoc peoplesoft com wrote:
First of all, I want a better compiler....
I'm afraid you might be seeing some weird floating point troubles.

You have no idea...

  Actually, the whole NaN and Inf xpath support has been hell to get running
cleanly on a variety of compilers and platform, so I have an idea :-)

C:\>test
  Object is a string : NaN
  Object is a number : NaN
  Object is a number : 1
obj1(1.#QNAN0) is equal to obj2(1.000000) : 1
C:\>

Seems bizarre to me.

  Nice ! Seems the Free Download of the MSC compiler now reflect better the
value of the tool :-)

The attached patch fixes this specific problem
with msvc, but I wonder where else this might bite.

  That should be safe, it's just costly. So to minimize the impact,
I swapped to make the atomic test first, and second used conditional
compilation to avoid the penalty on platforms which should not suffer from
it:

#ifdef WIN32
            return(((res->floatval == ctxt->context->proximityPosition) &&
                   (!xmlXPathIsNaN(res->floatval)) /* MSC pbm Mark Vadoc !*/);
#else
            return(res->floatval == ctxt->context->proximityPosition);
#endif

  That should go in the next release,

    thanks,

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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