Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libm The compiler is allowed to use intermediate h...
details: https://anonhg.NetBSD.org/src/rev/ef0bd5196549
branches: trunk
changeset: 771313:ef0bd5196549
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sat Nov 19 12:46:41 2011 +0000
description:
The compiler is allowed to use intermediate higher precision for float
arithmetic, which may cause differences smaller than float precision
but still much larger than eps = 1e-30.
Forcing intermediate results to volatile variables removes the excess
precision.
diffstat:
tests/lib/libm/t_sqrt.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r a27eb582ccd1 -r ef0bd5196549 tests/lib/libm/t_sqrt.c
--- a/tests/lib/libm/t_sqrt.c Sat Nov 19 12:32:54 2011 +0000
+++ b/tests/lib/libm/t_sqrt.c Sat Nov 19 12:46:41 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sqrt.c,v 1.1 2011/10/16 08:25:40 jruoho Exp $ */
+/* $NetBSD: t_sqrt.c,v 1.2 2011/11/19 12:46:41 mlelstv Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_sqrt.c,v 1.1 2011/10/16 08:25:40 jruoho Exp $");
+__RCSID("$NetBSD: t_sqrt.c,v 1.2 2011/11/19 12:46:41 mlelstv Exp $");
#include <atf-c.h>
#include <math.h>
@@ -177,7 +177,7 @@
#ifndef __vax__
const float x[] = { 0.0, 0.005, 1.0, 99.0, 123.123, 9999.9999 };
const float eps = 1.0e-30;
- float y, z;
+ volatile float y, z;
size_t i;
for (i = 0; i < __arraycount(x); i++) {
@@ -187,7 +187,7 @@
if (fabsf(y - z) > eps)
atf_tc_fail_nonfatal("sqrtf(%0.03f) != "
- "powf(%0.03f, 1/3)\n", x[i], x[i]);
+ "powf(%0.03f, 1/2)\n", x[i], x[i]);
}
#endif
}
Home |
Main Index |
Thread Index |
Old Index