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

@ -22,51 +22,51 @@
#include "libc/x/x.h"
#include "libc/x/xasprintf.h"
#define tanhl(x) tanhl(VEIL("t", (long double)(x)))
#define tanh(x) tanh(VEIL("x", (double)(x)))
#define tanhf(x) tanhf(VEIL("x", (float)(x)))
double _tanh(double) asm("tanh");
float _tanhf(float) asm("tanhf");
long double _tanhl(long double) asm("tanhl");
TEST(tanhl, test) {
EXPECT_STREQ(".09966799462495582", _gc(xdtoal(tanhl(+.1))));
EXPECT_STREQ("-.09966799462495582", _gc(xdtoal(tanhl(-.1))));
EXPECT_STREQ("0", _gc(xdtoal(tanhl(0))));
EXPECT_STREQ("-0", _gc(xdtoal(tanhl(-0.))));
EXPECT_TRUE(isnan(tanhl(NAN)));
EXPECT_STREQ("1", _gc(xdtoal(tanhl(INFINITY))));
EXPECT_STREQ("-1", _gc(xdtoal(tanhl(-INFINITY))));
TEST(_tanhl, test) {
EXPECT_STREQ(".09966799462495582", _gc(xdtoal(_tanhl(+.1))));
EXPECT_STREQ("-.09966799462495582", _gc(xdtoal(_tanhl(-.1))));
EXPECT_STREQ("0", _gc(xdtoal(_tanhl(0))));
EXPECT_STREQ("-0", _gc(xdtoal(_tanhl(-0.))));
EXPECT_TRUE(isnan(_tanhl(NAN)));
EXPECT_STREQ("1", _gc(xdtoal(_tanhl(INFINITY))));
EXPECT_STREQ("-1", _gc(xdtoal(_tanhl(-INFINITY))));
}
TEST(tanh, test) {
EXPECT_STREQ("0", _gc(xasprintf("%.15g", tanh(0.))));
EXPECT_STREQ("-0", _gc(xasprintf("%.15g", tanh(-0.))));
EXPECT_STREQ("0.0996679946249558", _gc(xasprintf("%.15g", tanh(.1))));
EXPECT_STREQ("-0.0996679946249558", _gc(xasprintf("%.15g", tanh(-.1))));
EXPECT_STREQ("0.46211715726001", _gc(xasprintf("%.15g", tanh(.5))));
EXPECT_STREQ("-0.46211715726001", _gc(xasprintf("%.15g", tanh(-.5))));
EXPECT_STREQ("0.761594155955765", _gc(xasprintf("%.15g", tanh(1.))));
EXPECT_STREQ("-0.761594155955765", _gc(xasprintf("%.15g", tanh(-1.))));
EXPECT_STREQ("0.905148253644866", _gc(xasprintf("%.15g", tanh(1.5))));
EXPECT_STREQ("-0.905148253644866", _gc(xasprintf("%.15g", tanh(-1.5))));
EXPECT_STREQ("0.964027580075817", _gc(xasprintf("%.15g", tanh(2.))));
EXPECT_TRUE(isnan(tanh(NAN)));
EXPECT_TRUE(isnan(tanh(-NAN)));
EXPECT_STREQ("1", _gc(xasprintf("%.15g", tanh(INFINITY))));
EXPECT_STREQ("-1", _gc(xasprintf("%.15g", tanh(-INFINITY))));
TEST(_tanh, test) {
EXPECT_STREQ("0", _gc(xasprintf("%.15g", _tanh(0.))));
EXPECT_STREQ("-0", _gc(xasprintf("%.15g", _tanh(-0.))));
EXPECT_STREQ("0.0996679946249558", _gc(xasprintf("%.15g", _tanh(.1))));
EXPECT_STREQ("-0.0996679946249558", _gc(xasprintf("%.15g", _tanh(-.1))));
EXPECT_STREQ("0.46211715726001", _gc(xasprintf("%.15g", _tanh(.5))));
EXPECT_STREQ("-0.46211715726001", _gc(xasprintf("%.15g", _tanh(-.5))));
EXPECT_STREQ("0.761594155955765", _gc(xasprintf("%.15g", _tanh(1.))));
EXPECT_STREQ("-0.761594155955765", _gc(xasprintf("%.15g", _tanh(-1.))));
EXPECT_STREQ("0.905148253644866", _gc(xasprintf("%.15g", _tanh(1.5))));
EXPECT_STREQ("-0.905148253644866", _gc(xasprintf("%.15g", _tanh(-1.5))));
EXPECT_STREQ("0.964027580075817", _gc(xasprintf("%.15g", _tanh(2.))));
EXPECT_TRUE(isnan(_tanh(NAN)));
EXPECT_TRUE(isnan(_tanh(-NAN)));
EXPECT_STREQ("1", _gc(xasprintf("%.15g", _tanh(INFINITY))));
EXPECT_STREQ("-1", _gc(xasprintf("%.15g", _tanh(-INFINITY))));
EXPECT_STREQ("2.2250738585072e-308",
_gc(xasprintf("%.15g", tanh(__DBL_MIN__))));
EXPECT_STREQ("1", _gc(xasprintf("%.15g", tanh(__DBL_MAX__))));
_gc(xasprintf("%.15g", _tanh(__DBL_MIN__))));
EXPECT_STREQ("1", _gc(xasprintf("%.15g", _tanh(__DBL_MAX__))));
EXPECT_STREQ("-0.761594155955765",
_gc(xasprintf("%.15g", tanh(-1.0000000000000002))));
_gc(xasprintf("%.15g", _tanh(-1.0000000000000002))));
EXPECT_STREQ("-2.1073424255447e-08",
_gc(xasprintf("%.15g", tanh(-2.1073424255447e-08))));
_gc(xasprintf("%.15g", _tanh(-2.1073424255447e-08))));
}
TEST(tanhf, test) {
EXPECT_STREQ(".099668", _gc(xdtoaf(tanhf(+.1))));
EXPECT_STREQ("-.099668", _gc(xdtoaf(tanhf(-.1))));
EXPECT_STREQ("0", _gc(xdtoaf(tanhf(0))));
EXPECT_STREQ("-0", _gc(xdtoaf(tanhf(-0.))));
EXPECT_TRUE(isnan(tanhf(NAN)));
EXPECT_STREQ("1", _gc(xdtoaf(tanhf(INFINITY))));
EXPECT_STREQ("-1", _gc(xdtoaf(tanhf(-INFINITY))));
TEST(_tanhf, test) {
EXPECT_STREQ(".099668", _gc(xdtoaf(_tanhf(+.1))));
EXPECT_STREQ("-.099668", _gc(xdtoaf(_tanhf(-.1))));
EXPECT_STREQ("0", _gc(xdtoaf(_tanhf(0))));
EXPECT_STREQ("-0", _gc(xdtoaf(_tanhf(-0.))));
EXPECT_TRUE(isnan(_tanhf(NAN)));
EXPECT_STREQ("1", _gc(xdtoaf(_tanhf(INFINITY))));
EXPECT_STREQ("-1", _gc(xdtoaf(_tanhf(-INFINITY))));
}