bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf-frexp and the radix of floating point numbers


From: Bruno Haible
Subject: Re: printf-frexp and the radix of floating point numbers
Date: Sun, 25 Feb 2007 19:15:57 +0100
User-agent: KMail/1.5.4

Paul Eggert wrote:
> IBM mainframes use radix 16.  This is not likely to change so long as
> there are IBM mainframes (which will be quite some time).  Modern IBM
> mainframes support radix 2 as an option, but I suspect radix 16 is
> still the normal default

Oh well. I'm adding a comment about it. May the problem be handled when
it actually occurs. (Are such mainframes porting targets for GNU software?
Do they lack the C99 printf 'a' and 'A' conversion?)

> Radix-10 floating point is making a bit of a comeback, by the way.
> Usually, though, it's not via redefining 'double'.  See, for example,
> <http://www2.hursley.ibm.com/decimal/>.

Yes. Decimal arithmetic is a basic datatype for financial applications.
Now also gcc comes with a libdecnumber.

Bruno


--- lib/printf-frexp.c  25 Feb 2007 14:20:46 -0000      1.1
+++ lib/printf-frexp.c  25 Feb 2007 18:08:24 -0000      1.3
@@ -28,10 +28,10 @@
 
 # include <float.h>
 # include <math.h>
-# include "verify.h"
 
-/* This file assumes FLT_RADIX is 2.  */
-verify (FLT_RADIX == 2);
+/* This file assumes FLT_RADIX = 2.  If FLT_RADIX is a power of 2 greater
+   than 2, or not even a power of 2, some rounding errors can occur, so that
+   then the returned mantissa is only guaranteed to be <= 2.0, not < 2.0.  */
 
 # ifdef USE_LONG_DOUBLE
 #  define FUNC printf_frexpl
--- modules/printf-frexp        25 Feb 2007 14:20:46 -0000      1.1
+++ modules/printf-frexp        25 Feb 2007 17:41:48 -0000
@@ -8,7 +8,6 @@
 m4/printf-frexp.m4
 
 Depends-on:
-verify
 
 configure.ac:
 gl_FUNC_PRINTF_FREXP
--- modules/printf-frexpl       25 Feb 2007 14:28:50 -0000      1.1
+++ modules/printf-frexpl       25 Feb 2007 17:41:48 -0000
@@ -10,7 +10,6 @@
 m4/longdouble.m4
 
 Depends-on:
-verify
 
 configure.ac:
 gl_FUNC_PRINTF_FREXPL





reply via email to

[Prev in Thread] Current Thread [Next in Thread]