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

971020: Precision of DOUBLE



Jan,

> To: address@hidden
> From: Jan Polcher <address@hidden>
> Subject: LINUX + g77 and Double
> Organization: .
> Keywords: 199710191607.KAA18217

In the above message, you wrote:

> Hello,
> 
> Thank you very much for the 3.3.1 version. It is quite a large improvement
> to the 2.4 version.
> 
> I have compiled it on a LINUX box using gcc-2.7.2.3 and g77-0.5.21. As the
> option are a little different from what you give for the f2c translator
> in the INSTALL file here are the option which worked for me :
> 
>  export CPPFLAGS=-Df2cFortran
>  export FC=g77
>  export FFLAGS='-ff2c'
> 
> Now I have a difficult question for you !
> We would like to use netCDF for the restart files of our GCM. This means
> that we have to store the data with the precision of the machine in
> netCDF. I have done a few tests where I store a R*4 and R*8 as float and
> double in netCDF and see how it looks when I read it again.
> 
> On a Pentium it works fine. In any case the double external type 
> contains everything up to the last bit. On a VPP700 things are not that
> simple.
> 
> true R*4 -> archived correctly in the double and float external types
> true R*8 -> archived correctly in the double external type
> (DOUBLE PRECISION declaration in FORTRAN)
> promoted R*8 -> neither format contains the correct full data !
> 
> I could not yet try a Cray C90 as I do not have the 3.3.1 version there. 
> Anyway I would not be able to not try all computers so I would like from
> you if you know, on theoretical or experimental grounds, if it will work
> on all or most computers. That is if the data is stored in the double type
> I can get all my bites back !
> 
> I presume it depends on how XDR interacts with the machine binary systems !
> 
>       Thank you very much for your help.
> 
> 
>               Best regards
> 
>                       Jan
> 
> 
> - ------------------- PLEASE NOTE, new address ! -------------------------
> 
> Jan Polcher                                           TEL: -33-1-44277352
> Laboratoire de Météorologie Dynamique du CNRS         FAX: -33-1-44276272
> Tour 25, 5eme étage,  BP 99,     4 pl. Jussieu,      75252 PARIS cedex 05
> http://www.lmd.jussieu.fr/~polcher/            address@hidden

I expect that only the following cases are guaranteed to maintain the
bit-pattern:

    1.  Internal, 4-byte IEEE floating-point values stored as 
        netCDF floats; and

    2.  Internal, 8-byte IEEE floating-point values stored as netCDF
        doubles.

I've copied a more authoritative person on this reply (Glenn Davis).
Hopefully, you'll hear from him on this matter.

--------
Steve Emmerson   <http://www.unidata.ucar.edu>