X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSupport%2FAPFloat.cpp;h=19b8221b60cb55389d7c9858fe93d0595c5e2c54;hb=dd65ba2dbe6a8cb0fb15818193d011ccd20263a0;hp=6bcc053d467a1b4653dc82b60bd3123226fed5da;hpb=091d6ba2757d2db7f5db28e3b87a0c87dd0a3360;p=oota-llvm.git diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp index 6bcc053d467..19b8221b60c 100644 --- a/lib/Support/APFloat.cpp +++ b/lib/Support/APFloat.cpp @@ -767,6 +767,15 @@ APFloat::isLargest() const { && isSignificandAllOnes(); } +bool +APFloat::isInteger() const { + // This could be made more efficient; I'm going for obviously correct. + if (!isFinite()) return false; + APFloat truncated = *this; + truncated.roundToIntegral(rmTowardZero); + return compare(truncated) == cmpEqual; +} + bool APFloat::bitwiseIsEqual(const APFloat &rhs) const { if (this == &rhs) @@ -1771,7 +1780,7 @@ APFloat::remainder(const APFloat &rhs) /* Normalized llvm frem (C fmod). This is not currently correct in all cases. */ APFloat::opStatus -APFloat::mod(const APFloat &rhs, roundingMode rounding_mode) +APFloat::mod(const APFloat &rhs) { opStatus fs; fs = modSpecials(rhs); @@ -1796,10 +1805,10 @@ APFloat::mod(const APFloat &rhs, roundingMode rounding_mode) rmNearestTiesToEven); assert(fs==opOK); // should always work - fs = V.multiply(rhs, rounding_mode); + fs = V.multiply(rhs, rmNearestTiesToEven); assert(fs==opOK || fs==opInexact); // should not overflow or underflow - fs = subtract(V, rounding_mode); + fs = subtract(V, rmNearestTiesToEven); assert(fs==opOK || fs==opInexact); // likewise if (isZero())