Mark shortening NaN conversions as Inexact. PR 2856.

Improve description of unsupported formats.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57185 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dale Johannesen 2008-10-06 18:22:29 +00:00
parent e76225a4c1
commit d3d8ce3aba

View File

@ -1727,11 +1727,12 @@ APFloat::convert(const fltSemantics &toSemantics,
APInt::tcShiftLeft(significandParts(), newPartCount, shift); APInt::tcShiftLeft(significandParts(), newPartCount, shift);
else if (shift < 0) else if (shift < 0)
APInt::tcShiftRight(significandParts(), newPartCount, -shift); APInt::tcShiftRight(significandParts(), newPartCount, -shift);
// If the new size is shorter, we lost information.
fs = (shift < 0) ? opInexact : opOK;
// gcc forces the Quiet bit on, which means (float)(double)(float_sNan) // gcc forces the Quiet bit on, which means (float)(double)(float_sNan)
// does not give you back the same bits. This is dubious, and we // does not give you back the same bits. This is dubious, and we
// don't currently do it. You're really supposed to get // don't currently do it. You're really supposed to get
// an invalid operation signal at runtime, but nobody does that. // an invalid operation signal at runtime, but nobody does that.
fs = opOK;
} else { } else {
semantics = &toSemantics; semantics = &toSemantics;
fs = opOK; fs = opOK;
@ -2633,11 +2634,13 @@ APFloat::convertToDouble() const
return api.bitsToDouble(); return api.bitsToDouble();
} }
/// Integer bit is explicit in this format. Current Intel book does not /// Integer bit is explicit in this format. Intel hardware (387 and later)
/// define meaning of: /// does not support these bit patterns:
/// exponent = all 1's, integer bit not set. /// exponent = all 1's, integer bit 0, significand 0 ("pseudoinfinity")
/// exponent = 0, integer bit set. (formerly "psuedodenormals") /// exponent = all 1's, integer bit 0, significand nonzero ("pseudoNaN")
/// exponent!=0 nor all 1's, integer bit not set. (formerly "unnormals") /// exponent = 0, integer bit 1 ("pseudodenormal")
/// exponent!=0 nor all 1's, integer bit 0 ("unnormal")
/// At the moment, the first two are treated as NaNs, the second two as Normal.
void void
APFloat::initFromF80LongDoubleAPInt(const APInt &api) APFloat::initFromF80LongDoubleAPInt(const APInt &api)
{ {