summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-03-06 19:33:35 -0500
committerJakob Kaivo <jkk@ung.org>2019-03-06 19:33:35 -0500
commit0540366e3047d5f5326b25be8a21b5a3774adaf8 (patch)
tree3f8262066f6001b5b58617a9db7f685845c8cc01
parent47eab10b73a95e096ca8e400e1342f9f8e7926bf (diff)
add some signbit() tests
-rw-r--r--math.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/math.c b/math.c
index 5120b93..3cf65e6 100644
--- a/math.c
+++ b/math.c
@@ -6,6 +6,13 @@ void test_math_h(void)
int iexp = 1;
double iptr = 0;
+ long double ldm1 = -1.0;
+ double dm1 = -1.0;
+ float fm1 = -1.0;
+ long double ld1 = 1.0;
+ double d1 = 1.0;
+ float f1 = 1.0;
+
testing_header("math.h");
test_defined(HUGE_VAL);
@@ -33,5 +40,14 @@ void test_math_h(void)
test_double(floor(0.9), 0);
test_double(fmod(1, 1), 0);
+ #if defined __STDC_VERSION__ && 19901 <= __STDC_VERSION__
+ test_int_equals(signbit(ldm1), 1);
+ test_int_equals(signbit(dm1), 1);
+ test_int_equals(signbit(fm1), 1);
+ test_int_equals(signbit(ld1), 0);
+ test_int_equals(signbit(d1), 0);
+ test_int_equals(signbit(f1), 0);
+ #endif
+
testing_end();
}