Re: [xml] Test comparison fails on value (-2147483648)

On Sun, Aug 26, 2001 at 10:42:01PM -0500, Chris_Poblete Dell com wrote:
The tag <xsl:when test="OutputWatts &lt; 0"> fails to 
evaluate correctly 
when OutputWatts is equal to -2147483648.  

Consider the ff. for the tag <xsl:when test="OutputWatts &lt; 0">
     OutputWatts            Evaluation
      -21474836                pass
      -214748364               pass
      -2147483648             (FAIL)
      -21474836489             pass
      -2147483648999           pass
      -2147483648999999999999  pass
The above values of OutputWatts are all negative numbers and
no matter how many digits there are, it fails at -2147483648
since an int is used temporary buffer.

   I changed it to unsigned long. This is not an improvement.
it just avoids to see the overflow for this specific case.

Is there a reason why the function "atof" or "strtod" is not used instead?
These functions are supported in Linux, Windows, and Netware.

   Because they relies on the locale settings and hence can lead to completely
unpredictable results, I prefer to risk getting an overflow error report I
can debug than misbehaviours that I cannot reproduce. Doesn't work.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

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