Import more Musl math

This commit is contained in:
Justine Tunney 2022-07-12 15:49:11 -07:00
parent 6d52664aa7
commit 3027d67037
48 changed files with 1749 additions and 180 deletions

View file

@ -18,6 +18,7 @@
*/
#include "libc/math.h"
#include "libc/runtime/gc.internal.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"
@ -45,3 +46,12 @@ TEST(log1pf, test) {
EXPECT_STREQ("-INFINITY", gc(xdtoaf(log1pf(-1))));
EXPECT_STREQ("-NAN", gc(xdtoaf(log1pf(-2))));
}
BENCH(log1p, bench) {
double _log1p(double) asm("log1p");
float _log1pf(float) asm("log1pf");
long double _log1pl(long double) asm("log1pl");
EZBENCH2("log1p", donothing, _log1p(.7)); /* ~17ns */
EZBENCH2("log1pf", donothing, _log1pf(.7)); /* ~17ns */
EZBENCH2("log1pl", donothing, _log1pl(.7)); /* ~28ns */
}