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"
@ -38,3 +39,12 @@ TEST(tan, test) {
gc(xasprintf("%.15g", tan(__DBL_MIN__))));
EXPECT_STREQ("-0.0049620158744449", gc(xasprintf("%.15g", tan(__DBL_MAX__))));
}
BENCH(tan, bench) {
double _tan(double) asm("tan");
float _tanf(float) asm("tanf");
long double _tanl(long double) asm("tanl");
EZBENCH2("tan", donothing, _tan(.7)); /* ~19ns */
EZBENCH2("tanf", donothing, _tanf(.7)); /* ~32ns */
EZBENCH2("tanl", donothing, _tanl(.7)); /* ~28ns */
}