[llvm] r187313 - [APFloat] Move setting fcNormal in zeroSignificand() to calling code.
Michael Gottesman
mgottesman at apple.com
Sat Jul 27 14:49:22 PDT 2013
Author: mgottesman
Date: Sat Jul 27 16:49:21 2013
New Revision: 187313
URL: http://llvm.org/viewvc/llvm-project?rev=187313&view=rev
Log:
[APFloat] Move setting fcNormal in zeroSignificand() to calling code.
Zeroing the significand of a floating point number does not necessarily cause a
floating point number to become finite non zero. For instance, if one has a NaN,
zeroing the significand will cause it to become +/- infinity.
Modified:
llvm/trunk/lib/Support/APFloat.cpp
Modified: llvm/trunk/lib/Support/APFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=187313&r1=187312&r2=187313&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Sat Jul 27 16:49:21 2013
@@ -778,6 +778,7 @@ APFloat::bitwiseIsEqual(const APFloat &r
APFloat::APFloat(const fltSemantics &ourSemantics, integerPart value) {
initialize(&ourSemantics);
sign = 0;
+ category = fcNormal;
zeroSignificand();
exponent = ourSemantics.precision - 1;
significandParts()[0] = value;
@@ -845,7 +846,6 @@ APFloat::significandParts()
void
APFloat::zeroSignificand()
{
- category = fcNormal;
APInt::tcSet(significandParts(), 0, partCount());
}
@@ -2301,9 +2301,9 @@ APFloat::convertFromHexadecimalString(St
{
lostFraction lost_fraction = lfExactlyZero;
+ category = fcNormal;
zeroSignificand();
exponent = 0;
- category = fcNormal;
integerPart *significand = significandParts();
unsigned partsCount = partCount();
@@ -2512,6 +2512,7 @@ APFloat::convertFromDecimalString(String
(D.normalizedExponent + 1) * 28738 <=
8651 * (semantics->minExponent - (int) semantics->precision)) {
/* Underflow to zero and round. */
+ category = fcNormal;
zeroSignificand();
fs = normalize(rounding_mode, lfLessThanHalf);
@@ -3398,6 +3399,7 @@ APFloat APFloat::getSmallestNormalized(c
// exponent = 0..0
// significand = 10..0
+ Val.category = fcNormal;
Val.zeroSignificand();
Val.sign = Negative;
Val.exponent = Sem.minExponent;
More information about the llvm-commits
mailing list