summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-01-19 21:17:05 +0000
committerDale Johannesen <dalej@apple.com>2009-01-19 21:17:05 +0000
commit740e98704d13e789b794656e4ad594ff2230dd08 (patch)
tree910932c94301d35181ad14865ea18f25a0876454 /llvm/lib/Support
parentdb3c05533ca36540a58554d867a4473d4c8e10a8 (diff)
downloadbcm5719-llvm-740e98704d13e789b794656e4ad594ff2230dd08.tar.gz
bcm5719-llvm-740e98704d13e789b794656e4ad594ff2230dd08.zip
compile-time fmod was done incorrectly. PR 3316.
llvm-svn: 62528
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/APFloat.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 4da71441983..fde157d60fc 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -1531,7 +1531,7 @@ APFloat::mod(const APFloat &rhs, roundingMode rounding_mode)
integerPart *x = new integerPart[parts];
bool ignored;
fs = V.convertToInteger(x, parts * integerPartWidth, true,
- rmNearestTiesToEven, &ignored);
+ rmTowardZero, &ignored);
if (fs==opInvalidOp)
return fs;
@@ -1811,7 +1811,9 @@ APFloat::convertToSignExtendedInteger(integerPart *parts, unsigned int width,
if (exponent < 0) {
/* Our absolute value is less than one; truncate everything. */
APInt::tcSet(parts, 0, dstPartsCount);
- truncatedBits = semantics->precision;
+ /* For exponent -1 the integer bit represents .5, look at that.
+ For smaller exponents leftmost truncated bit is 0. */
+ truncatedBits = semantics->precision -1U - exponent;
} else {
/* We want the most significant (exponent + 1) bits; the rest are
truncated. */
OpenPOWER on IntegriCloud