Hardcoding numeric_limits values to work on platforms where our float16 class isn't defined
This commit is contained in:
@@ -250,8 +250,8 @@ namespace std
|
||||
public:
|
||||
// General -- meaningful for all specializations.
|
||||
static const bool is_specialized = true;
|
||||
static float16 min() { return float16(0, 1, 0); }
|
||||
static float16 max() { return float16(~0, 30, 0); }
|
||||
static float16 min() { uint16_t v = 0x400; return *(float16 *)&v;/*return float16(0, 1, 0);*/ }
|
||||
static float16 max() { uint16_t v = 0x7bff; return *(float16 *)&v;/*return float16(~0, 30, 0);*/ }
|
||||
static const int radix = 2;
|
||||
static const int digits = 10; // conservative assumption
|
||||
static const int digits10 = 2; // conservative assumption
|
||||
@@ -264,8 +264,8 @@ namespace std
|
||||
|
||||
// Floating point specific.
|
||||
|
||||
static float16 epsilon() { return float16(0.00097656f); } // from OpenEXR, needs to be confirmed
|
||||
static float16 round_error() { return float16(0.00097656f/2); }
|
||||
static float16 epsilon() { uint16_t v = 0x13ff; return *(float16 *)&v;/*return float16(0.00097656f);*/ } // from OpenEXR, needs to be confirmed
|
||||
static float16 round_error() { uint16_t v = 0xfff; return *(float16 *)&v;/*return float16(0.00097656f/2);*/ }
|
||||
static const int min_exponent10 = -9;
|
||||
static const int max_exponent10 = 9;
|
||||
static const int min_exponent = -15;
|
||||
@@ -279,10 +279,10 @@ namespace std
|
||||
static const bool tinyness_before = false;
|
||||
static const float_round_style round_style = round_to_nearest;
|
||||
|
||||
static float16 denorm_min() { return float16(1, 0, 1); }
|
||||
static float16 infinity() { return float16(0, 31, 0); }
|
||||
static float16 quiet_NaN() { return float16(1, 31, 0); }
|
||||
static float16 signaling_NaN () { return float16(1, 31, 0); }
|
||||
static float16 denorm_min() { uint16_t v = 0x8001; return *(float16 *)&v;/*return float16(1, 0, 1);*/ }
|
||||
static float16 infinity() { uint16_t v = 0x7c00; return *(float16 *)&v;/*return float16(0, 31, 0);*/ }
|
||||
static float16 quiet_NaN() { uint16_t v = 0x7c01; return *(float16 *)&v;/*return float16(1, 31, 0);*/ }
|
||||
static float16 signaling_NaN () { uint16_t v = 0x7c01; return *(float16 *)&v;/*return float16(1, 31, 0);*/ }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user