Skip to content

Commit

Permalink
Fix sinh's sign handling
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sunfishcode committed Dec 1, 2020
1 parent 5879558 commit 424d058
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libc-top-half/musl/src/math/sinh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 1 addition & 1 deletion libc-top-half/musl/src/math/sinhf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 424d058

Please sign in to comment.