[libc-commits] [libc] [libc][math][c23] Add {ldexp, scalbn, scalbln}f16 C23 math functions (PR #94797)
via libc-commits
libc-commits at lists.llvm.org
Mon Jun 10 12:33:22 PDT 2024
================
@@ -183,6 +184,10 @@ template <size_t Bits> struct DyadicFloat {
return r;
}
+ LIBC_INLINE explicit constexpr operator float16() const {
+ return static_cast<float16>(static_cast<float>(*this));
+ }
----------------
overmighty wrote:
By the way, they're the same inputs for which the test was initially failing before the `DyadicFloat<16>` change, which made me add `operator float16()`. So the incorrect result (in this specific case at least) still comes from this path:
```cpp
return multiply_add(d_lo, T(round_and_sticky), d_hi * scale_up_factor) *
scale_down_factor;
```
https://github.com/llvm/llvm-project/blob/main/libc/src/__support/FPUtil/dyadic_float.h#L160-L161
https://github.com/llvm/llvm-project/pull/94797
More information about the libc-commits
mailing list