Get LIBC_TESTLIB building on AARCH64

This commit is contained in:
Justine Tunney 2023-05-11 19:56:33 -07:00
parent 95fab334e4
commit 5e2f7f7ced
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
46 changed files with 975 additions and 1174 deletions

View file

@ -21,42 +21,42 @@
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"
#define coshl(x) coshl(VEIL("t", (long double)(x)))
#define cosh(x) cosh(VEIL("x", (double)(x)))
#define coshf(x) coshf(VEIL("x", (float)(x)))
double _cosh(double) asm("cosh");
float _coshf(float) asm("coshf");
long double _coshl(long double) asm("coshl");
TEST(coshl, test) {
EXPECT_STREQ("1.127625965206381", gc(xdtoal(coshl(+.5))));
EXPECT_STREQ("1.127625965206381", gc(xdtoal(coshl(-.5))));
EXPECT_STREQ("INFINITY", gc(xdtoal(coshl(30000))));
EXPECT_STREQ("INFINITY", gc(xdtoal(coshl(-30000))));
EXPECT_STREQ("1", gc(xdtoal(coshl(+0.))));
EXPECT_STREQ("1", gc(xdtoal(coshl(-0.))));
EXPECT_TRUE(isnan(coshl(NAN)));
EXPECT_STREQ("INFINITY", gc(xdtoal(coshl(INFINITY))));
EXPECT_STREQ("INFINITY", gc(xdtoal(coshl(-INFINITY))));
EXPECT_STREQ("1.127625965206381", gc(xdtoal(_coshl(+.5))));
EXPECT_STREQ("1.127625965206381", gc(xdtoal(_coshl(-.5))));
EXPECT_STREQ("INFINITY", gc(xdtoal(_coshl(30000))));
EXPECT_STREQ("INFINITY", gc(xdtoal(_coshl(-30000))));
EXPECT_STREQ("1", gc(xdtoal(_coshl(+0.))));
EXPECT_STREQ("1", gc(xdtoal(_coshl(-0.))));
EXPECT_TRUE(isnan(_coshl(NAN)));
EXPECT_STREQ("INFINITY", gc(xdtoal(_coshl(INFINITY))));
EXPECT_STREQ("INFINITY", gc(xdtoal(_coshl(-INFINITY))));
}
TEST(cosh, test) {
EXPECT_STREQ("1.12762596520638", gc(xdtoa(cosh(+.5))));
EXPECT_STREQ("1.12762596520638", gc(xdtoa(cosh(-.5))));
EXPECT_STREQ("INFINITY", gc(xdtoa(cosh(30000))));
EXPECT_STREQ("INFINITY", gc(xdtoa(cosh(-30000))));
EXPECT_STREQ("1", gc(xdtoa(cosh(+0.))));
EXPECT_STREQ("1", gc(xdtoa(cosh(-0.))));
EXPECT_TRUE(isnan(cosh(NAN)));
EXPECT_STREQ("INFINITY", gc(xdtoa(cosh(INFINITY))));
EXPECT_STREQ("INFINITY", gc(xdtoa(cosh(-INFINITY))));
EXPECT_STREQ("1.12762596520638", gc(xdtoa(_cosh(+.5))));
EXPECT_STREQ("1.12762596520638", gc(xdtoa(_cosh(-.5))));
EXPECT_STREQ("INFINITY", gc(xdtoa(_cosh(30000))));
EXPECT_STREQ("INFINITY", gc(xdtoa(_cosh(-30000))));
EXPECT_STREQ("1", gc(xdtoa(_cosh(+0.))));
EXPECT_STREQ("1", gc(xdtoa(_cosh(-0.))));
EXPECT_TRUE(isnan(_cosh(NAN)));
EXPECT_STREQ("INFINITY", gc(xdtoa(_cosh(INFINITY))));
EXPECT_STREQ("INFINITY", gc(xdtoa(_cosh(-INFINITY))));
}
TEST(coshf, test) {
EXPECT_STREQ("1.12763", gc(xdtoaf(coshf(+.5))));
EXPECT_STREQ("1.12763", gc(xdtoaf(coshf(-.5))));
EXPECT_STREQ("INFINITY", gc(xdtoaf(coshf(30000))));
EXPECT_STREQ("INFINITY", gc(xdtoaf(coshf(-30000))));
EXPECT_STREQ("1", gc(xdtoaf(coshf(+0.))));
EXPECT_STREQ("1", gc(xdtoaf(coshf(-0.))));
EXPECT_TRUE(isnan(coshf(NAN)));
EXPECT_STREQ("INFINITY", gc(xdtoaf(coshf(INFINITY))));
EXPECT_STREQ("INFINITY", gc(xdtoaf(coshf(-INFINITY))));
EXPECT_STREQ("1.12763", gc(xdtoaf(_coshf(+.5))));
EXPECT_STREQ("1.12763", gc(xdtoaf(_coshf(-.5))));
EXPECT_STREQ("INFINITY", gc(xdtoaf(_coshf(30000))));
EXPECT_STREQ("INFINITY", gc(xdtoaf(_coshf(-30000))));
EXPECT_STREQ("1", gc(xdtoaf(_coshf(+0.))));
EXPECT_STREQ("1", gc(xdtoaf(_coshf(-0.))));
EXPECT_TRUE(isnan(_coshf(NAN)));
EXPECT_STREQ("INFINITY", gc(xdtoaf(_coshf(INFINITY))));
EXPECT_STREQ("INFINITY", gc(xdtoaf(_coshf(-INFINITY))));
}