[libc-commits] [libc] [libc][math] Implement nexttoward functions (PR #72763)

via libc-commits libc-commits at lists.llvm.org
Sat Nov 18 17:51:23 PST 2023


================
@@ -169,8 +171,49 @@ LIBC_INLINE T nextafter(T from, T to) {
     int_val = (to_bits.uintval() & sign_mask) + UIntType(1);
   }
 
+  UIntType exponent_bits = int_val & FloatProperties<T>::EXPONENT_MASK;
+  if (exponent_bits == UIntType(0))
+    raise_except_if_required(FE_UNDERFLOW | FE_INEXACT);
+  else if (exponent_bits == FloatProperties<T>::EXPONENT_MASK)
+    raise_except_if_required(FE_OVERFLOW | FE_INEXACT);
----------------
lntue wrote:

SGTM.  Thanks for fixing this TODO item.

https://github.com/llvm/llvm-project/pull/72763


More information about the libc-commits mailing list