APFloat(const fltSemantics &); // Default construct to 0.0
APFloat(const fltSemantics &, StringRef);
APFloat(const fltSemantics &, integerPart);
+ APFloat(const fltSemantics &, fltCategory, bool negative);
APFloat(const fltSemantics &, uninitializedTag);
APFloat(const fltSemantics &, const APInt &);
explicit APFloat(double d);
initialize(&ourSemantics);
}
+APFloat::APFloat(const fltSemantics &ourSemantics,
+ fltCategory ourCategory, bool negative) {
+ initialize(&ourSemantics);
+ category = ourCategory;
+ sign = negative;
+ if (isFiniteNonZero())
+ category = fcZero;
+ else if (ourCategory == fcNaN)
+ makeNaN();
+}
+
APFloat::APFloat(const fltSemantics &ourSemantics, StringRef text) {
initialize(&ourSemantics);
convertFromString(text, rmNearestTiesToEven);
excessPrecision = calcSemantics.precision - semantics->precision;
truncatedBits = excessPrecision;
- APFloat decSig = APFloat::getZero(calcSemantics, sign);
- APFloat pow5(calcSemantics);
+ APFloat decSig(calcSemantics, fcZero, sign);
+ APFloat pow5(calcSemantics, fcZero, false);
sigStatus = decSig.convertFromUnsignedParts(decSigParts, sigPartCount,
rmNearestTiesToEven);
}
APFloat APFloat::getSmallestNormalized(const fltSemantics &Sem, bool Negative) {
- APFloat Val(Sem, uninitialized);
+ APFloat Val(Sem, fcNormal, Negative);
// We want (in interchange format):
// sign = {Negative}
// exponent = 0..0
// significand = 10..0
- Val.zeroSignificand();
- Val.sign = Negative;
Val.exponent = Sem.minExponent;
+ Val.zeroSignificand();
Val.significandParts()[partCountForBits(Sem.precision)-1] |=
(((integerPart) 1) << ((Sem.precision - 1) % integerPartWidth));
if (!LHSUnsigned) {
// If the RHS value is > SignedMax, fold the comparison. This handles +INF
// and large values.
- APFloat SMax(RHS.getSemantics());
+ APFloat SMax(RHS.getSemantics(), APFloat::fcZero, false);
SMax.convertFromAPInt(APInt::getSignedMaxValue(IntWidth), true,
APFloat::rmNearestTiesToEven);
if (SMax.compare(RHS) == APFloat::cmpLessThan) { // smax < 13123.0
} else {
// If the RHS value is > UnsignedMax, fold the comparison. This handles
// +INF and large values.
- APFloat UMax(RHS.getSemantics());
+ APFloat UMax(RHS.getSemantics(), APFloat::fcZero, false);
UMax.convertFromAPInt(APInt::getMaxValue(IntWidth), false,
APFloat::rmNearestTiesToEven);
if (UMax.compare(RHS) == APFloat::cmpLessThan) { // umax < 13123.0
if (!LHSUnsigned) {
// See if the RHS value is < SignedMin.
- APFloat SMin(RHS.getSemantics());
+ APFloat SMin(RHS.getSemantics(), APFloat::fcZero, false);
SMin.convertFromAPInt(APInt::getSignedMinValue(IntWidth), true,
APFloat::rmNearestTiesToEven);
if (SMin.compare(RHS) == APFloat::cmpGreaterThan) { // smin > 12312.0
}
} else {
// See if the RHS value is < UnsignedMin.
- APFloat SMin(RHS.getSemantics());
+ APFloat SMin(RHS.getSemantics(), APFloat::fcZero, false);
SMin.convertFromAPInt(APInt::getMinValue(IntWidth), true,
APFloat::rmNearestTiesToEven);
if (SMin.compare(RHS) == APFloat::cmpGreaterThan) { // umin > 12312.0