Re: [xml] Test comparison fails on value (-2147483648)
- From: Ignacio Vazquez-Abrams <ignacio openservices net>
- To: <xml gnome org>
- Subject: Re: [xml] Test comparison fails on value (-2147483648)
- Date: Sun, 26 Aug 2001 16:34:44 -0400 (EDT)
On Sun, 26 Aug 2001 Chris_Poblete Dell com wrote:
VERSIONS: libxml2-2.4.3
libxslt-1.0.3
PROBLEM:
The tag <xsl:when test="OutputWatts < 0"> fails to evaluate correctly
when OutputWatts is equal to -2147483648.
PROPOSED RESOLUTION:
xpath:xmlXPathStringEvalNumber(6567)
------------------------------------------------------------
< ret = (double) tmp;
----------
ret = (double) tmp;
// Variable tmp is declared as signed integer which may evaluate to
a negative
// number. We only need to calculate the absolute value of the
whole number since
// any negative character in the input string has been flagged
separately.
if (tmp < 0)
ret = -ret;
------------------------------------------------------------
_______________________________
Chris Poblete
Dell © Enterprise Servers Group
Wouldn't it be easier just to have "ret = (double) (signed) tmp;"?
--
Ignacio Vazquez-Abrams <ignacio openservices net>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]