summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-10-12 21:51:36 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-10-12 21:51:36 +0000
commit7247a5f20e1997e38cdfe3558afe8f10d547f2eb (patch)
tree367b90616f993fb49ba90d29b321ea10be98e56c /unittests
parent41242942fcbb2e6bc4e5bed3e8041f7b20ece8af (diff)
downloadllvm-7247a5f20e1997e38cdfe3558afe8f10d547f2eb.tar.gz
llvm-7247a5f20e1997e38cdfe3558afe8f10d547f2eb.tar.bz2
llvm-7247a5f20e1997e38cdfe3558afe8f10d547f2eb.tar.xz
Fix APFloat::getLargest so that it actually returns the correct value. Found by accident while reviewing a patch to nearby code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141816 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/APFloatTest.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/unittests/ADT/APFloatTest.cpp b/unittests/ADT/APFloatTest.cpp
index 3c40a13d36..e70c5f7af2 100644
--- a/unittests/ADT/APFloatTest.cpp
+++ b/unittests/ADT/APFloatTest.cpp
@@ -648,4 +648,9 @@ TEST(APFloatTest, exactInverse) {
EXPECT_FALSE(APFloat(1.40129846e-45f).getExactInverse(0));
}
+TEST(APFloatTest, getLargest) {
+ EXPECT_EQ(3.40282347e+38f, APFloat::getLargest(APFloat::IEEEsingle).convertToFloat());
+ EXPECT_EQ(1.7976931348623157e+308, APFloat::getLargest(APFloat::IEEEdouble).convertToDouble());
+}
+
}