(j3.2006) reading 0x1.8000p+0

Bill Long longb
Thu Oct 4 15:16:15 EDT 2007



Dan Nagle wrote:
> Hello,
>
> Michael Ingrassia wrote:
>
>   
>> 0x1.8000p+0
>>     
>
>   
>> Given that we reference ISO/IEC 9899:1999 as the C International Standard,
>> and that we describe portable interoperation with stream files (e.g. 9.5.4)
>> this seems like something we should consider describing in a Note
>> or possibly even fixing.
>>     
>
> Where in C99 is this feature referenced,
> and what does it mean?
>
>   

It is in the fprintf section (7.19.6.1), conversion specifier "a".  The 
output is a double written using hex rather than decimal.  The intent is 
to be able to exactly represent the internal bits of a double, avoiding 
rounding that occurs with decimal conversion.  I've never actually seen 
it used, but it is documented in the standard.  In Fortran (08 at 
least), we can accomplish the same goal by writing / reading the real 
value with Z format. That I have seen done.

I don't see this as a new problem with C interop via stream files.  The 
forms of formatted output for other types don't necessarily match up 
between Fortran and C either.   If users want that sort of data 
interchange, they need to stick to the format styles that are common 
between the languages.

Cheers,
Bill


-- 
Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120

            




More information about the J3 mailing list