[libc-commits] [libc] [libc][math] Fix signaling NaN handling for math functions. (PR #133347)

via libc-commits libc-commits at lists.llvm.org
Mon Mar 31 17:11:09 PDT 2025


================
@@ -741,8 +742,8 @@ LLVM_LIBC_FUNCTION(float, powf, (float x, float y)) {
         }
       }
       if (y_abs > 0x4f17'0000) {
+        // y is NaN
         if (y_abs > 0x7f80'0000) {
-          // y is NaN
----------------
overmighty wrote:

A bit of a nit, but I think if the comment is going to be on top of the `if`, it should be `// if y is NaN`, otherwise it should remain inside the `if`. My reasoning is that there is a `// y is finite and non-zero.` comment below that is right above an `if` that only checks `x_u`, because it comments what is known about `y` when that `if` is reached and not what would be known about `y` if that `if`'s condition were true. 

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


More information about the libc-commits mailing list