summaryrefslogtreecommitdiff
path: root/regress/lib
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2016-10-23 18:46:04 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2016-10-23 18:46:04 +0000
commit56bfbc8f97d198798acc98fbcfb2949a866bd1de (patch)
treea0206f42bf656b9e610d46c98dbe8439691bcdaa /regress/lib
parent10a52c3c3ca455e0bf3a08ec15ebddd64f75318a (diff)
fix lgamma test on i386 and use symbolic constant; ok martynas@
Diffstat (limited to 'regress/lib')
-rw-r--r--regress/lib/libm/lgamma/lgamma.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/regress/lib/libm/lgamma/lgamma.c b/regress/lib/libm/lgamma/lgamma.c
index 1f568331232..1bc763c5966 100644
--- a/regress/lib/libm/lgamma/lgamma.c
+++ b/regress/lib/libm/lgamma/lgamma.c
@@ -1,11 +1,15 @@
-/* $OpenBSD: lgamma.c,v 1.2 2011/07/09 03:33:07 martynas Exp $ */
+/* $OpenBSD: lgamma.c,v 1.3 2016/10/23 18:46:03 otto Exp $ */
/*
* Written by Martynas Venckus. Public domain
*/
+#define __POSIX_VISIBLE 201403
+
#include <assert.h>
#include <math.h>
+#include <float.h>
+
int
main(int argc, char *argv[])
@@ -49,12 +53,11 @@ main(int argc, char *argv[])
assert(lgammal(1.0L) == 0.0L && signgam == 1);
signgam = 0;
- assert(lgamma(3.0) == M_LN2 && signgam == 1);
+ assert(fabs(lgamma(3.0) - M_LN2) < DBL_EPSILON && signgam == 1);
signgam = 0;
- assert(lgammaf(3.0F) == (float)M_LN2 && signgam == 1);
+ assert(fabsf(lgammaf(3.0F) - (float)M_LN2) < FLT_EPSILON && signgam == 1);
signgam = 0;
- assert(lgammal(3.0L) == 0.6931471805599453094172321214581766L &&
- signgam == 1);
+ assert(fabsl(lgammal(3.0L) - M_LN2l) < LDBL_EPSILON && signgam == 1);
return (0);
}