Return-Path: Delivered-To: apmail-xerces-commits-archive@www.apache.org Received: (qmail 920 invoked from network); 13 Aug 2009 12:17:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Aug 2009 12:17:08 -0000 Received: (qmail 41479 invoked by uid 500); 13 Aug 2009 12:17:15 -0000 Delivered-To: apmail-xerces-commits-archive@xerces.apache.org Received: (qmail 41414 invoked by uid 500); 13 Aug 2009 12:17:15 -0000 Mailing-List: contact commits-help@xerces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@xerces.apache.org Received: (qmail 41403 invoked by uid 99); 13 Aug 2009 12:17:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Aug 2009 12:17:09 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Aug 2009 12:17:05 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D1D932388854; Thu, 13 Aug 2009 12:16:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r803857 - /xerces/c/trunk/src/xercesc/util/XMLFloat.cpp Date: Thu, 13 Aug 2009 12:16:44 -0000 To: commits@xerces.apache.org From: amassari@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090813121644.D1D932388854@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: amassari Date: Thu Aug 13 12:16:44 2009 New Revision: 803857 URL: http://svn.apache.org/viewvc?rev=803857&view=rev Log: Instead of using the FLT_MIN and FLT_MAX macros, use the XMLSchema definition of minimum and maximum value for a xs:float Modified: xerces/c/trunk/src/xercesc/util/XMLFloat.cpp Modified: xerces/c/trunk/src/xercesc/util/XMLFloat.cpp URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLFloat.cpp?rev=803857&r1=803856&r2=803857&view=diff ============================================================================== --- xerces/c/trunk/src/xercesc/util/XMLFloat.cpp (original) +++ xerces/c/trunk/src/xercesc/util/XMLFloat.cpp Thu Aug 13 12:16:44 2009 @@ -23,14 +23,7 @@ // Includes // --------------------------------------------------------------------------- #include -#include -#include -#include - -#include -#include -#include -#include +#include XERCES_CPP_NAMESPACE_BEGIN @@ -57,23 +50,29 @@ /** * float related checking */ - if (fValue < (-1) * FLT_MAX) + + // 3.2.4 The basic value space of float consists of the values m × 2^e, where + // m is an integer whose absolute value is less than 2^24, + // and e is an integer between -149 and 104, inclusive + static const double fltMin = pow(2.0,-149); + static const double fltMax = pow(2.0,24) * pow(2.0,104); + if (fValue < (-1) * fltMax) { fType = NegINF; fDataConverted = true; fDataOverflowed = true; } - else if (fValue > (-1)*FLT_MIN && fValue < 0) + else if (fValue > (-1)*fltMin && fValue < 0) { fDataConverted = true; fValue = 0; } - else if (fValue > 0 && fValue < FLT_MIN ) + else if (fValue > 0 && fValue < fltMin ) { fDataConverted = true; fValue = 0; } - else if (fValue > FLT_MAX) + else if (fValue > fltMax) { fType = PosINF; fDataConverted = true; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org For additional commands, e-mail: commits-help@xerces.apache.org