[PATCH] D102671: [APFloat] convertToDouble/Float can work on shorter types

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 01:50:55 PDT 2021


foad added a comment.

Looks good to me but I'd appreciate a review from someone else as well.



================
Comment at: llvm/unittests/ADT/APFloatTest.cpp:4719
+  APFloat D2(-0.0);
+  EXPECT_EQ(-0.0, D1.convertToDouble());
+  APFloat D3(1.0);
----------------
This should be D2? So maybe use something stronger than EXPECT_EQ, that distinguishes +0 from -0?

You've made the same typo below for B2, H2, etc.


================
Comment at: llvm/unittests/ADT/APFloatTest.cpp:4737-4738
+  APFloat D10 = APFloat::getInf(APFloat::IEEEdouble());
+  EXPECT_TRUE(std::isinf(D10.convertToDouble()));
+  EXPECT_TRUE(0 < D10.convertToDouble());
+  APFloat D11 = APFloat::getInf(APFloat::IEEEdouble(), true);
----------------
Instead of two EXPECT_TRUE checks can't you use `EXPECT_EQ(std::numeric_limits<double>::infinity(), D10.convertToDouble())` ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102671/new/

https://reviews.llvm.org/D102671



More information about the llvm-commits mailing list