mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Signbit, tests of frexp.
This commit is contained in:
18
test/unit/stdlib/math/frexp_signbit.c3
Normal file
18
test/unit/stdlib/math/frexp_signbit.c3
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user