From commits-return-2994-apmail-stdcxx-commits-archive=stdcxx.apache.org@stdcxx.apache.org Tue May 27 12:32:12 2008 Return-Path: Delivered-To: apmail-stdcxx-commits-archive@www.apache.org Received: (qmail 57950 invoked from network); 27 May 2008 12:32:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 May 2008 12:32:12 -0000 Received: (qmail 70383 invoked by uid 500); 27 May 2008 12:32:14 -0000 Delivered-To: apmail-stdcxx-commits-archive@stdcxx.apache.org Received: (qmail 70352 invoked by uid 500); 27 May 2008 12:32:14 -0000 Mailing-List: contact commits-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list commits@stdcxx.apache.org Received: (qmail 70343 invoked by uid 99); 27 May 2008 12:32:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 May 2008 05:32:14 -0700 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; Tue, 27 May 2008 12:31:28 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 737012388A0B; Tue, 27 May 2008 05:31:49 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r660486 - /stdcxx/branches/4.2.x/etc/config/src/INFINITY.cpp Date: Tue, 27 May 2008 12:31:48 -0000 To: commits@stdcxx.apache.org From: faridz@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080527123149.737012388A0B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: faridz Date: Tue May 27 05:31:45 2008 New Revision: 660486 URL: http://svn.apache.org/viewvc?rev=660486&view=rev Log: 2008-05-27 Farid Zaripov * etc/config/src/INFINITY.cpp (flt_qnan): Clear sign bit to obtain value of positive qnan. (dbl_qnan): Ditto. (ldbl_qnan): Ditto. Modified: stdcxx/branches/4.2.x/etc/config/src/INFINITY.cpp Modified: stdcxx/branches/4.2.x/etc/config/src/INFINITY.cpp URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/etc/config/src/INFINITY.cpp?rev=660486&r1=660485&r2=660486&view=diff ============================================================================== --- stdcxx/branches/4.2.x/etc/config/src/INFINITY.cpp (original) +++ stdcxx/branches/4.2.x/etc/config/src/INFINITY.cpp Tue May 27 05:31:45 2008 @@ -165,6 +165,15 @@ val.val /= flt_zero (); + // val.val can be +qnan or -qnan + // clear sign bit + if (e == big_endian) { + val.bits [0] &= '\x7f'; + } + else { + val.bits [sizeof (val.val) - 1] &= '\x7f'; + } + #else // if !defined (_RWSTD_NO_DBL_TRAPS) // floating point arithmetic traps @@ -172,7 +181,7 @@ // assume IEEE 754 floating point format if (e == big_endian) { - val.bits [0] = '\xff'; + val.bits [0] = '\x7f'; val.bits [1] = '\xc0'; val.bits [2] = '\0'; val.bits [3] = '\0'; @@ -181,7 +190,7 @@ val.bits [0] = '\0'; val.bits [1] = '\0'; val.bits [2] = '\xc0'; - val.bits [3] = '\xff'; + val.bits [3] = '\x7f'; } #endif // _RWSTD_NO_DBL_TRAPS @@ -355,6 +364,15 @@ val.val /= dbl_zero (); + // val.val can be +qnan or -qnan + // clear sign bit + if (e == big_endian) { + val.bits [0] &= '\x7f'; + } + else { + val.bits [sizeof (val.val) - 1] &= '\x7f'; + } + #else // if !defined (_RWSTD_NO_DBL_TRAPS) // floating point arithmetic traps @@ -362,7 +380,7 @@ // assume IEEE 754 floating point format if (e == big_endian) { - val.bits [0] = '\xff'; + val.bits [0] = '\x7f'; val.bits [1] = '\xf8'; val.bits [2] = '\0'; val.bits [3] = '\0'; @@ -379,7 +397,7 @@ val.bits [4] = '\0'; val.bits [5] = '\0'; val.bits [6] = '\xf8'; - val.bits [7] = '\xff'; + val.bits [7] = '\x7f'; } #endif // _RWSTD_NO_DBL_TRAPS @@ -587,6 +605,18 @@ val.val /= ldbl_zero (); + // val.val can be +qnan or -qnan + // clear sign bit + if (e == big_endian) { + val.bits [0] &= '\x7f'; + } + else { + unsigned inx = sizeof (val.val) - 1; + // skip the trailing zero's + while (!val.bits [inx]) --inx; + val.bits [inx] &= '\x7f'; + } + #else // if !defined (_RWSTD_NO_DBL_TRAPS) // floating point arithmetic traps @@ -594,7 +624,7 @@ // assume IEEE 754 floating point format if (e == big_endian) { - val.bits [ 0] = '\xff'; + val.bits [ 0] = '\x7f'; val.bits [ 1] = '\xff'; val.bits [ 2] = '\x80'; val.bits [ 3] = '\0'; @@ -627,7 +657,7 @@ val.bits [12] = '\0'; val.bits [13] = '\x80'; val.bits [14] = '\xff'; - val.bits [15] = '\xff'; + val.bits [15] = '\x7f'; } #endif // _RWSTD_NO_DBL_TRAPS