summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2008-01-14 02:18:00 +0000
committerdas <das@FreeBSD.org>2008-01-14 02:18:00 +0000
commit84da39ce04778e1d34709bc5e46ee8f5ee10ff57 (patch)
treebf68b31464aa3da69d83e603beca05cc75eab6f9 /tools
parent4f45aea521bd20b04ffc664d0990d604a6db4b53 (diff)
downloadFreeBSD-src-84da39ce04778e1d34709bc5e46ee8f5ee10ff57.zip
FreeBSD-src-84da39ce04778e1d34709bc5e46ee8f5ee10ff57.tar.gz
Tests for lrintl() and llrintl(). I didn't add anything specially
tailored for the long double format; instead, I just modified the existing tests to test lrintl() and llrintl() as well.
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/lib/msun/test-lrint.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/tools/regression/lib/msun/test-lrint.c b/tools/regression/lib/msun/test-lrint.c
index 44bcee7..1693a34a 100644
--- a/tools/regression/lib/msun/test-lrint.c
+++ b/tools/regression/lib/msun/test-lrint.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2005 David Schultz <das@FreeBSD.org>
+ * Copyright (c) 2005-2008 David Schultz <das@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,10 @@ __FBSDID("$FreeBSD$");
#include <math.h>
#include <stdio.h>
+#ifdef __i386__
+#include <ieeefp.h>
+#endif
+
#define test(func, x, result, excepts) do { \
assert(feclearexcept(FE_ALL_EXCEPT) == 0); \
assert((func)(x) == (result) || fetestexcept(FE_INVALID)); \
@@ -46,20 +50,20 @@ __FBSDID("$FreeBSD$");
#define testall(x, result, excepts) do { \
test(lrint, x, result, excepts); \
test(lrintf, x, result, excepts); \
+ test(lrintl, x, result, excepts); \
test(llrint, x, result, excepts); \
test(llrintf, x, result, excepts); \
+ test(llrintl, x, result, excepts); \
} while (0)
#define IGNORE 0
#pragma STDC FENV_ACCESS ON
-int
-main(int argc, char *argv[])
+void
+run_tests(void)
{
- printf("1..1\n");
-
assert(fesetround(FE_DOWNWARD) == 0);
testall(0.75, 0, FE_INEXACT);
testall(-0.5, -1, FE_INEXACT);
@@ -120,6 +124,19 @@ main(int argc, char *argv[])
#else
#error "Unsupported long long size"
#endif
+}
+
+int
+main(int argc, char *argv[])
+{
+
+ printf("1..1\n");
+
+ run_tests();
+#ifdef __i386__
+ fpsetprec(FP_PE);
+ run_tests();
+#endif
printf("ok 1 - lrint\n");
OpenPOWER on IntegriCloud