[libcxx-commits] [PATCH] D66836: [libc++] Add `__truncating_cast` for safely casting float types to integers

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 28 14:17:35 PDT 2019


zoecarver added a comment.

Yes, that sounds right. I can't think of any reason that the condition couldn't be `if (__r >  static_cast<floatT>(numeric_limits<intT>::max()))`. The information lost from shifting the value around is never more than the information lost from static_casting the value (as far as I have been able to reason and test).


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

https://reviews.llvm.org/D66836





More information about the libcxx-commits mailing list