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

Re: [xml] XPath mod operator problems



On Thu, Jun 27, 2002 at 05:57:21PM +0200, Geert Kloosterman wrote:
> Hi Daniel, all,
> 
> Part of this has allready been posted to the xslt list, but since the
> real problem seems to be within libxml2, I'll continue here.

  yup !

> I can't reach the bugzilla site at the moment, so maybe this
> phenomenon has allready been posted.
> 
> I've used libxml2-2.4.22 on all systems mentioned. 
> 
> Here we go.  On i386 platform I get the correct results:
> 
> 
>     ./testXPath --expr '8 mod 3 = 2'
>     Object is a Boolean : true
> 
> 
> But on HP-UX 10.20 and linux-alpha:
> 
> 
>     ./testXPath --expr '8 mod 3'
>     Object is a number : 2
> 
>     ./testXPath --expr '8 mod 3 = 2'
>     Object is a Boolean : false
> 
> 
> Can anybody reproduce this on other platforms?
> Daniel, should this test be added to the regression tests?
> 

  yes, I take patches :-)

> When I change the following lines of xpath.c (l. 4890, 4891),
> xmlXPathModValues:
> 
>         tmp=arg1/arg2;
>         ctxt->value->floatval = arg2 * (tmp - (double)((int)tmp));
> 
> into
> 
>         ctxt->value->floatval = fmod(arg1, arg2);
> 
> the behaviour looks correct.  But I don't know if fmod conforms
> to the XPath requirements of the `mod' operator.

  And I also don't know the portability of fmod (and being on the
road I don't have my books to check :-/ )

  Maybe someone with access to multiple platforms could check this
Bjorn for example ?

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.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]