Default format for Float128

Jerry DeLisle jvdelisle@frontier.com
Mon Sep 6 01:28:00 GMT 2010


On 09/02/2010 04:58 PM, Jerry DeLisle wrote:
> On 09/02/2010 10:08 AM, Steve Kargl wrote:
> --- snip ---
>>> $ ./a.out
>>> 1234567890123456789012345678901234567890
>>> 28.711679904822148
>>> 7.1078787878787878787879000000000000
>>> 42.860000000000000000000000000000000
>>> -21.256198883056640625000000000000000
>>> 28.711679904822147253788000000000000
>>> 1234567890123456789012345678901234567890
>>> 0.33333333333333333333333000000000000
>>> 0.33333333333333333334
>>> 0.33333333333333331
>>> 0.33333334
>>>
>>> There appears to be a lot of excess width here. If I modify write.c with
>>> this:

As first suggested by Dominique:  In write_float.def line 1010.

#if defined(HAVE_GFC_REAL_16) && __LDBL_DIG__ > 18
# define MIN_FIELD_WIDTH 46
#else
# define MIN_FIELD_WIDTH 31
#endif

On my system __LDBL_DIG__ is defined to be 18 resulting in MIN_FIELD_WIDTH 
defined to be 31, which is not large enough.  Changing to this:

#if defined(HAVE_GFC_REAL_16) || __LDBL_DIG__ > 18
# define MIN_FIELD_WIDTH 46
#else
# define MIN_FIELD_WIDTH 31
#endif

yields correct results on my system, but I am not clear what FX was intending 
here.  This is on a 32 bit i686-linux-gnu system and I also see it on x86-64.

Regards,

Jerry



More information about the Fortran mailing list