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(atan, test) {
gc(xasprintf("%.15g", atan(__DBL_MIN__))));
EXPECT_STREQ("1.5707963267949", gc(xasprintf("%.15g", atan(__DBL_MAX__))));
}
BENCH(atanl, bench) {
double _atan(double) asm("atan");
float _atanf(float) asm("atanf");
long double _atanl(long double) asm("atanl");
EZBENCH2("-atan", donothing, _atan(.7)); /* ~18ns */
EZBENCH2("-atanf", donothing, _atanf(.7)); /* ~12ns */
EZBENCH2("-atanl", donothing, _atanl(.7)); /* ~34ns */
}