summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2012-03-13 10:34:04 +0000
committerotto <otto@openbsd.org>2012-03-13 10:34:04 +0000
commit526b9c640d0ad78b4567edb7727a054edd4466a0 (patch)
treee1d6bb8fe0094113c025da37a55ccfc40a5f4039
parentrough test of the bc(1) math lib (diff)
downloadwireguard-openbsd-526b9c640d0ad78b4567edb7727a054edd4466a0.tar.xz
wireguard-openbsd-526b9c640d0ad78b4567edb7727a054edd4466a0.zip
better bounds
-rw-r--r--regress/usr.bin/bc/t19.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/regress/usr.bin/bc/t19.c b/regress/usr.bin/bc/t19.c
index 28b0cf8710f..1e241e97373 100644
--- a/regress/usr.bin/bc/t19.c
+++ b/regress/usr.bin/bc/t19.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: t19.c,v 1.1 2012/03/13 10:12:52 otto Exp $ */
+/* $OpenBSD: t19.c,v 1.2 2012/03/13 10:34:04 otto Exp $ */
/*
* Copyright (c) 2012 Otto Moerbeek <otto@drijf.net>
@@ -60,8 +60,13 @@ main()
prec = pow(10, -scale[si]);
if (prec < LDBL_EPSILON)
prec = LDBL_EPSILON;
+ prec *= 2;
/* XXX cheating ? */
- if (diff > 20*prec) {
+ if (funcs[fi].f == logl)
+ prec *= 4;
+ else if (funcs[fi].f == expl)
+ prec *= 8;
+ if (diff > prec) {
printf("%s %d %Le %Le %Le %Le %Le\n",
funcs[fi].name, scale[si],
v, d1, d2, diff, prec);