From 2425e8dce37f9d256006afe2a366bd4ff086e7a7 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Mon, 24 Oct 2016 15:35:00 +0000 Subject: using exact valus in floating point tests often does not work as expected, use epsilon test --- regress/lib/libm/tgamma/tgamma.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'regress') 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 #include #include +#include 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 */ -- cgit v1.2.3