Signbit, tests of frexp.

This commit is contained in:
Christoffer Lerno
2023-03-18 19:13:17 +01:00
parent a041c53cdd
commit 48a35b3277
4 changed files with 43 additions and 8 deletions

View File

@@ -0,0 +1,18 @@
module std::math @test;
fn void test_frexp()
{
int a;
double z = math::frexp(231.23, &a);
assert((z - 0.903242187) < 0.0000001 && a == 8);
float z2 = math::frexp(231.23f, &a);
assert((z2 - 0.903242187) < 0.0000001 && a == 8);
}
fn void test_signbit()
{
assert(math::signbit(-231.3) == 1);
assert(math::signbit(231.3) == 0);
assert(math::signbit(float.inf) == 0);
assert(math::signbit(-float.inf) == 1);
}