Browse Source

Fix sinh's sign handling

In the musl 1.2.1 update, I made a change to disable the new code in
sinh for handling directed rounding modes, but I only incompletely
disabled it. This led to `sinh(-inf)` computing `inf` instead of `-inf`,
detected in [wasi-libc-test]. This patch fixes it.

[wasi-libc-test]: https://github.com/CraneStation/wasi-libc-test/tree/master/libc-test
pull/226/head
Dan Gohman 4 years ago
parent
commit
424d0582ca
  1. 2
      libc-top-half/musl/src/math/sinh.c
  2. 2
      libc-top-half/musl/src/math/sinhf.c

2
libc-top-half/musl/src/math/sinh.c

@ -37,7 +37,7 @@ double sinh(double x)
#ifdef __wasilibc_unmodified_upstream // Wasm doesn't have alternate rounding modes
t = __expo2(absx, 2*h);
#else
t = __expo2(absx);
t = 2*h*__expo2(absx);
#endif
return t;
}

2
libc-top-half/musl/src/math/sinhf.c

@ -29,7 +29,7 @@ float sinhf(float x)
#ifdef __wasilibc_unmodified_upstream // Wasm doesn't have alternate rounding modes
t = __expo2f(absx, 2*h);
#else
t = __expo2f(absx);
t = 2*h*__expo2f(absx);
#endif
return t;
}

Loading…
Cancel
Save