mirror of https://github.com/ecmwf/eccodes.git
Document init_ibm_float() and init_ieee_float()
This commit is contained in:
parent
1dfb8b4325
commit
e47d12e646
|
@ -51,6 +51,11 @@ struct ibm_table_t
|
||||||
|
|
||||||
static ibm_table_t ibm_table = { 0, {0,}, {0,}, 0, 0 };
|
static ibm_table_t ibm_table = { 0, {0,}, {0,}, 0, 0 };
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief (see the documentation for init_ieee_float() in grib_ieeefloat.cc)
|
||||||
|
*/
|
||||||
|
|
||||||
static void init_ibm_table()
|
static void init_ibm_table()
|
||||||
{
|
{
|
||||||
if (!ibm_table.inited) {
|
if (!ibm_table.inited) {
|
||||||
|
|
|
@ -56,12 +56,34 @@ struct ieee_table_t
|
||||||
|
|
||||||
static ieee_table_t ieee_table = { 0, {0,}, {0,}, 0, 0 };
|
static ieee_table_t ieee_table = { 0, {0,}, {0,}, 0, 0 };
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initializes the ieee_table with IEE754 single precision (32-bit) values.
|
||||||
|
*
|
||||||
|
* Nearest smaller values (e.g., reference values for grid_simple and grid_ccsds)
|
||||||
|
* are taken from this table.
|
||||||
|
*
|
||||||
|
* @details The table layout is as follows:
|
||||||
|
*
|
||||||
|
* | idx (i) | multiplier (e) | value (v = mmin * e) |
|
||||||
|
* |---------|----------------|----------------------|
|
||||||
|
* | 1 | 2^(-149) | 0x800000 * 2^(-149) |
|
||||||
|
* | 2 | 2^(-148) | 0x800000 * 2^(-148) |
|
||||||
|
* | ... | ... | ... |
|
||||||
|
* | 253 | 2^103 | 0x800000 * 2^103 |
|
||||||
|
* | 254 | 2^104 | 0x800000 * 2^104 |
|
||||||
|
*
|
||||||
|
* The vmin and vmax boundaries are defined as:
|
||||||
|
* - vmin = 0x800000 * 2^(-149)
|
||||||
|
* - vmax = 0xffffff * 2^104
|
||||||
|
*/
|
||||||
|
|
||||||
static void init_ieee_table()
|
static void init_ieee_table()
|
||||||
{
|
{
|
||||||
if (!ieee_table.inited) {
|
if (!ieee_table.inited) {
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
unsigned long mmin = 0x800000;
|
unsigned long mmin = 0x800000; // minimum mantissa
|
||||||
unsigned long mmax = 0xffffff;
|
unsigned long mmax = 0xffffff; // maximum mantissa
|
||||||
double e = 1;
|
double e = 1;
|
||||||
for (i = 1; i <= 104; i++) {
|
for (i = 1; i <= 104; i++) {
|
||||||
e *= 2;
|
e *= 2;
|
||||||
|
|
Loading…
Reference in New Issue