mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
parent
c42dbe0e9e
commit
839e2f4cfb
24 changed files with 807 additions and 0 deletions
59
test/libc/tinymath/sinh_test.c
Normal file
59
test/libc/tinymath/sinh_test.c
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2021 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/math.h"
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/x/x.h"
|
||||
|
||||
#define sinhl(x) sinhl(VEIL("t", (long double)(x)))
|
||||
#define sinh(x) sinh(VEIL("x", (double)(x)))
|
||||
#define sinhf(x) sinhf(VEIL("x", (float)(x)))
|
||||
|
||||
TEST(sinh, test) {
|
||||
EXPECT_STREQ(".521095305493747", gc(xdtoa(sinh(+.5))));
|
||||
EXPECT_STREQ("-.521095305493747", gc(xdtoa(sinh(-.5))));
|
||||
EXPECT_STREQ("INFINITY", gc(xdtoa(sinh(30000))));
|
||||
EXPECT_STREQ("-INFINITY", gc(xdtoa(sinh(-30000))));
|
||||
EXPECT_STREQ("0", gc(xdtoa(sinh(0))));
|
||||
EXPECT_STREQ("NAN", gc(xdtoa(sinh(NAN))));
|
||||
EXPECT_STREQ("INFINITY", gc(xdtoa(sinh(INFINITY))));
|
||||
EXPECT_STREQ("-INFINITY", gc(xdtoa(sinh(-INFINITY))));
|
||||
}
|
||||
|
||||
TEST(sinhl, test) {
|
||||
EXPECT_STREQ(".5210953054937474", gc(xdtoal(sinhl(+.5))));
|
||||
EXPECT_STREQ("-.5210953054937474", gc(xdtoal(sinhl(-.5))));
|
||||
EXPECT_STREQ("INFINITY", gc(xdtoal(sinhl(30000))));
|
||||
EXPECT_STREQ("-INFINITY", gc(xdtoal(sinhl(-30000))));
|
||||
EXPECT_STREQ("0", gc(xdtoal(sinhl(0))));
|
||||
EXPECT_STREQ("NAN", gc(xdtoal(sinhl(NAN))));
|
||||
EXPECT_STREQ("INFINITY", gc(xdtoal(sinhl(INFINITY))));
|
||||
EXPECT_STREQ("-INFINITY", gc(xdtoal(sinhl(-INFINITY))));
|
||||
}
|
||||
|
||||
TEST(sinhf, test) {
|
||||
EXPECT_STREQ(".521095", gc(xdtoaf(sinhf(+.5))));
|
||||
EXPECT_STREQ("-.521095", gc(xdtoaf(sinhf(-.5))));
|
||||
EXPECT_STREQ("INFINITY", gc(xdtoaf(sinhf(30000))));
|
||||
EXPECT_STREQ("-INFINITY", gc(xdtoaf(sinhf(-30000))));
|
||||
EXPECT_STREQ("0", gc(xdtoaf(sinhf(0))));
|
||||
EXPECT_STREQ("NAN", gc(xdtoaf(sinhf(NAN))));
|
||||
EXPECT_STREQ("INFINITY", gc(xdtoaf(sinhf(INFINITY))));
|
||||
EXPECT_STREQ("-INFINITY", gc(xdtoaf(sinhf(-INFINITY))));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue