diff --git a/src/xercesc/util/XMLAbstractDoubleFloat.cpp b/src/xercesc/util/XMLAbstractDoubleFloat.cpp index 9f7f5722201dd37c73bba9cd3e45e5672f855646..c7571cf420aa30be7e3fba3c1deb7a42cae04f4a 100644 --- a/src/xercesc/util/XMLAbstractDoubleFloat.cpp +++ b/src/xercesc/util/XMLAbstractDoubleFloat.cpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.10 2003/03/10 20:55:58 peiyongz + * Schema Errata E2-40 double/float + * * Revision 1.9 2003/02/02 23:54:43 peiyongz * getFormattedString() added to return original and converted value. * @@ -148,16 +151,6 @@ void XMLAbstractDoubleFloat::init(const XMLCh* const strValue) fType = NegINF; fSign = -1; } - else if (XMLString::equals(tmpStrValue, XMLUni::fgNegZeroString) ) - { - fType = NegZero; - fSign = -1; - } - else if (XMLString::equals(tmpStrValue, XMLUni::fgPosZeroString) ) - { - fType = PosZero; - fSign = 1; - } else if (XMLString::equals(tmpStrValue, XMLUni::fgPosINFString) ) { fType = PosINF; @@ -228,12 +221,6 @@ void XMLAbstractDoubleFloat::formatString() case NegINF: XMLString::catString(fFormattedString, XMLUni::fgNegINFString); break; - case NegZero: - XMLString::catString(fFormattedString, XMLUni::fgNegZeroString); - break; - case PosZero: - XMLString::catString(fFormattedString, XMLUni::fgPosZeroString); - break; case PosINF: XMLString::catString(fFormattedString, XMLUni::fgPosINFString); break; @@ -265,23 +252,41 @@ int XMLAbstractDoubleFloat::compareValues(const XMLAbstractDoubleFloat* const lV (!rValue->isSpecialValue()) ) { if (lValue->fValue == rValue->fValue) - return 0; + return EQUAL; else - return (lValue->fValue > rValue->fValue) ? 1: -1; + return (lValue->fValue > rValue->fValue) ? GREATER_THAN : LESS_THAN; } // // case#2: lValue special // rValue special // + // Schema Errata E2-40 + // + // Positive Infinity is greater than all other non-NAN value. + // Nan equals itself but is not comparable with (neither greater than nor less than) + // any other value in the value space + // Negative Infinity is less than all other non-NAN values. + // else if ((lValue->isSpecialValue()) && (rValue->isSpecialValue()) ) { if (lValue->fType == rValue->fType) - return 0; + return EQUAL; else - return (lValue->fType > rValue->fType) ? 1 : -1; + { + if ((lValue->fType == NaN) || + (rValue->fType == NaN) ) + { + return INDETERMINATE; + } + else + { + return (lValue->fType > rValue->fType) ? GREATER_THAN : LESS_THAN; + } + } + } // // case#3: lValue special @@ -311,17 +316,12 @@ int XMLAbstractDoubleFloat::compareSpecial(const XMLAbstractDoubleFloat* const s switch (specialValue->fType) { case NegINF: - return -1; - - case NegZero: - case PosZero: - return (normalValue->getSign() > 0 ? -1 : 1); - + return LESS_THAN; case PosINF: - return 1; - + return GREATER_THAN; case NaN: - return 1; + // NaN is not comparable to any other value + return INDETERMINATE; default: XMLString::binToText(specialValue->fType, value1, 16, 10); diff --git a/src/xercesc/util/XMLAbstractDoubleFloat.hpp b/src/xercesc/util/XMLAbstractDoubleFloat.hpp index 152c6d77d2201f399defc09a9328c7cad8d8367e..19c9d3a0b9f9a09a63dd2133e3fbe4604743271b 100644 --- a/src/xercesc/util/XMLAbstractDoubleFloat.hpp +++ b/src/xercesc/util/XMLAbstractDoubleFloat.hpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.9 2003/03/10 20:55:58 peiyongz + * Schema Errata E2-40 double/float + * * Revision 1.8 2003/02/02 23:54:43 peiyongz * getFormattedString() added to return original and converted value. * @@ -140,8 +143,6 @@ public: enum LiteralType { NegINF, - NegZero, - PosZero, PosINF, NaN, SpecialTypeNum, diff --git a/src/xercesc/util/XMLDateTime.hpp b/src/xercesc/util/XMLDateTime.hpp index cdbaf76ec4ca216b03aba95553036ea85024b8f2..8a4a61a078f0867ea87eb98176b94aa6fd0f9e05 100644 --- a/src/xercesc/util/XMLDateTime.hpp +++ b/src/xercesc/util/XMLDateTime.hpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.5 2003/03/10 20:55:58 peiyongz + * Schema Errata E2-40 double/float + * * Revision 1.4 2003/02/02 23:54:43 peiyongz * getFormattedString() added to return original and converted value. * @@ -98,15 +101,6 @@ class XMLUTIL_EXPORT XMLDateTime : public XMLNumber { public: - // to be moved to XMLNumber - enum - { - LESS_THAN = -1, - EQUAL = 0, - GREATER_THAN = 1, - INDETERMINATE = 2 - }; - enum valueIndex { CentYear = 0, diff --git a/src/xercesc/util/XMLDouble.cpp b/src/xercesc/util/XMLDouble.cpp index 3db67106210ad02870e83289fb22f8fe6d973cf9..954f9e756cf455165ac38f9b1d61474fb05d2371 100644 --- a/src/xercesc/util/XMLDouble.cpp +++ b/src/xercesc/util/XMLDouble.cpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.8 2003/03/10 20:55:58 peiyongz + * Schema Errata E2-40 double/float + * * Revision 1.7 2003/02/02 23:54:43 peiyongz * getFormattedString() added to return original and converted value. * @@ -177,7 +180,6 @@ void XMLDouble::checkBoundary(const XMLCh* const strValue) { if (fValue > (-1)*DBL_MIN) { - fType = NegZero; fDataConverted = true; fValue = 0; } @@ -191,7 +193,6 @@ void XMLDouble::checkBoundary(const XMLCh* const strValue) { if (fValue < DBL_MIN ) { - fType = PosZero; fDataConverted = true; fValue = 0; } @@ -203,7 +204,6 @@ void XMLDouble::checkBoundary(const XMLCh* const strValue) } else { - fType = (getSign() == 1) ? PosZero : NegZero; fDataConverted = true; } diff --git a/src/xercesc/util/XMLFloat.cpp b/src/xercesc/util/XMLFloat.cpp index 7046660bd60fd6e3fbee55f4ee2e6e25e6a641f2..6d167db926003598506e576ad6c6ead8ebdc628b 100644 --- a/src/xercesc/util/XMLFloat.cpp +++ b/src/xercesc/util/XMLFloat.cpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.9 2003/03/10 20:55:58 peiyongz + * Schema Errata E2-40 double/float + * * Revision 1.8 2003/02/02 23:54:43 peiyongz * getFormattedString() added to return original and converted value. * @@ -172,7 +175,6 @@ void XMLFloat::checkBoundary(const XMLCh* const strValue) { if (fValue > (-1)*DBL_MIN) { - fType = NegZero; fDataConverted = true; fValue = 0; } @@ -186,7 +188,6 @@ void XMLFloat::checkBoundary(const XMLCh* const strValue) { if (fValue < DBL_MIN ) { - fType = PosZero; fDataConverted = true; fValue = 0; } @@ -198,7 +199,6 @@ void XMLFloat::checkBoundary(const XMLCh* const strValue) } else { - fType = (getSign() == 1) ? PosZero : NegZero; fDataConverted = true; } } @@ -214,13 +214,11 @@ void XMLFloat::checkBoundary(const XMLCh* const strValue) } else if (fValue > (-1)*FLT_MIN && fValue < 0) { - fType = NegZero; fDataConverted = true; fValue = 0; } else if (fValue > 0 && fValue < FLT_MIN ) { - fType = PosZero; fDataConverted = true; fValue = 0; } diff --git a/src/xercesc/util/XMLNumber.hpp b/src/xercesc/util/XMLNumber.hpp index f36dd9e6ae42a1ad303b921bce0e3ada9a811325..0319c70d78860995ca836e42f9e2c247bb89be63 100644 --- a/src/xercesc/util/XMLNumber.hpp +++ b/src/xercesc/util/XMLNumber.hpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.5 2003/03/10 20:55:58 peiyongz + * Schema Errata E2-40 double/float + * * Revision 1.4 2003/02/02 23:54:43 peiyongz * getFormattedString() added to return original and converted value. * @@ -88,6 +91,14 @@ class XMLUTIL_EXPORT XMLNumber { public: + enum + { + LESS_THAN = -1, + EQUAL = 0, + GREATER_THAN = 1, + INDETERMINATE = 2 + }; + virtual ~XMLNumber(); /**