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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187313
91177308-0d34-0410-b5e6-
96231b3b80d8
APFloat::APFloat(const fltSemantics &ourSemantics, integerPart value) {
initialize(&ourSemantics);
sign = 0;
APFloat::APFloat(const fltSemantics &ourSemantics, integerPart value) {
initialize(&ourSemantics);
sign = 0;
zeroSignificand();
exponent = ourSemantics.precision - 1;
significandParts()[0] = value;
zeroSignificand();
exponent = ourSemantics.precision - 1;
significandParts()[0] = value;
void
APFloat::zeroSignificand()
{
void
APFloat::zeroSignificand()
{
APInt::tcSet(significandParts(), 0, partCount());
}
APInt::tcSet(significandParts(), 0, partCount());
}
{
lostFraction lost_fraction = lfExactlyZero;
{
lostFraction lost_fraction = lfExactlyZero;
zeroSignificand();
exponent = 0;
zeroSignificand();
exponent = 0;
integerPart *significand = significandParts();
unsigned partsCount = partCount();
integerPart *significand = significandParts();
unsigned partsCount = partCount();
(D.normalizedExponent + 1) * 28738 <=
8651 * (semantics->minExponent - (int) semantics->precision)) {
/* Underflow to zero and round. */
(D.normalizedExponent + 1) * 28738 <=
8651 * (semantics->minExponent - (int) semantics->precision)) {
/* Underflow to zero and round. */
zeroSignificand();
fs = normalize(rounding_mode, lfLessThanHalf);
zeroSignificand();
fs = normalize(rounding_mode, lfLessThanHalf);
// exponent = 0..0
// significand = 10..0
// exponent = 0..0
// significand = 10..0
+ Val.category = fcNormal;
Val.zeroSignificand();
Val.sign = Negative;
Val.exponent = Sem.minExponent;
Val.zeroSignificand();
Val.sign = Negative;
Val.exponent = Sem.minExponent;