X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Ftest-printf-frexp.c;h=fc3723f0f26f84e7d6d3638b0f63fe66fe1b38b6;hb=afd0e4d2fd87ba6eaddc04476ed6d808c3afc5b0;hp=9465c2009b320de4434ec8ed1d9b54e751ddfb75;hpb=973c0665ffa8d014c50b2c9b808d437c69fb5c50;p=gnulib.git
diff --git a/tests/test-printf-frexp.c b/tests/test-printf-frexp.c
index 9465c2009..fc3723f0f 100644
--- a/tests/test-printf-frexp.c
+++ b/tests/test-printf-frexp.c
@@ -1,10 +1,10 @@
/* Test of splitting a double into fraction and mantissa.
Copyright (C) 2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -12,8 +12,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see . */
/* Written by Bruno Haible , 2007. */
@@ -22,9 +21,19 @@
#include "printf-frexp.h"
#include
+#include
#include
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
static double
my_ldexp (double x, int d)
@@ -40,7 +49,12 @@ int
main ()
{
int i;
- double x;
+ /* The use of 'volatile' guarantees that excess precision bits are dropped
+ when dealing with denormalized numbers. It is necessary on x86 systems
+ where double-floats are not IEEE compliant by default, to avoid that the
+ results become platform and compiler option dependent. 'volatile' is a
+ portable alternative to gcc's -ffloat-store option. */
+ volatile double x;
for (i = 1, x = 1.0; i <= DBL_MAX_EXP; i++, x *= 2.0)
{