[PATCH] D53339: [clang-tidy] Add the abseil-duration-factory-float check

Hyrum Wright via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 16 20:43:25 PDT 2018


hwright added inline comments.


================
Comment at: clang-tidy/abseil/DurationFactoryFloatCheck.cpp:27
+  double value = FloatLiteral.getValueAsApproximateDouble();
+  if (std::fmod(value, 1) == 0) {
+    bool is_negative = false;
----------------
alexfh wrote:
> Probably doesn't matter much, but would `std::modf` be more appropriate in this context?
I'm not actually sure.  Since we're checking the remainder against `0`, we don't need to also separately get the integral part, since if the conditional passes, we know the original value //is// the integral part.  It would seem that `std::modf` just adds more complexity.


https://reviews.llvm.org/D53339





More information about the cfe-commits mailing list