summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2016-10-24 15:35:00 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2016-10-24 15:35:00 +0000
commit2425e8dce37f9d256006afe2a366bd4ff086e7a7 (patch)
tree399295901a2cd41964b26bfe26077c7a448d3424 /regress
parent67fd2b17029fa1651e89823bdfec9984b9eed7b2 (diff)
using exact valus in floating point tests often does not work as expected,
use epsilon test
Diffstat (limited to 'regress')
-rw-r--r--regress/lib/libm/tgamma/tgamma.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/regress/lib/libm/tgamma/tgamma.c b/regress/lib/libm/tgamma/tgamma.c
index 491fe6efcbb..897ba415dee 100644
--- a/regress/lib/libm/tgamma/tgamma.c
+++ b/regress/lib/libm/tgamma/tgamma.c
@@ -1,10 +1,11 @@
-/* $OpenBSD: tgamma.c,v 1.2 2008/09/07 20:36:10 martynas Exp $ */
+/* $OpenBSD: tgamma.c,v 1.3 2016/10/24 15:34:59 otto Exp $ */
/* Written by Martynas Venckus, 2008, Public domain. */
#include <err.h>
#include <errno.h>
#include <math.h>
+#include <float.h>
extern int errno;
@@ -76,7 +77,7 @@ main(void)
errx(1, "tgamma(-1) = %f", x);
x = tgamma(-177.8); /* x ~< -177.79 */
- if (x != 0)
+ if (fabs(x) > DBL_EPSILON)
errx(1, "tgamma(-177.8) = %f", x);
x = tgamma(171.64); /* x ~> 171.63 */