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

[netCDF #YUZ-849018]: NetCDF float vs double in attribute

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: [netCDF #YUZ-849018]: NetCDF float vs double in attribute
  • Date: Tue, 29 Apr 2008 08:32:23 -0600

Seth,

If the attribute value is specified as -97.f, it is stored exactly as
a 32-bit float.  If it were specified as -97.0, it would be stored
exactly as a 64-bit double.  The values are exactly equal, whether you
compare them by converting the float to a double first or vice versa.

The reason this notation is used is to indicate the type of the
attribute without an explicit type declaration, by using the type of
the attribute value.  This worked fine for the six netCDF-3 types, but
netCDF-4 will also permit explicit attribute type declarations in CDL.

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: YUZ-849018
Department: Support netCDF
Priority: Normal
Status: Closed