{
FINITE, /* Finite number (normalized or denormalized). */
INFINITE, /* Positive or negative infinity. */
NAN, /* Not a number. */
{
FINITE, /* Finite number (normalized or denormalized). */
INFINITE, /* Positive or negative infinity. */
NAN, /* Not a number. */
ZERO, /* Positive or negative zero. */
MISSING, /* System missing. */
LOWEST, /* LOWEST on e.g. missing values. */
ZERO, /* Positive or negative zero. */
MISSING, /* System missing. */
LOWEST, /* LOWEST on e.g. missing values. */
-float_convert (enum float_format from, const void *src,
- enum float_format to, void *dst)
+float_convert (enum float_format from, const void *src,
+ enum float_format to, void *dst)
{
if ((from == FLOAT_IEEE_SINGLE_LE || from == FLOAT_IEEE_SINGLE_BE)
&& (to == FLOAT_IEEE_SINGLE_LE || to == FLOAT_IEEE_SINGLE_BE))
{
if ((from == FLOAT_IEEE_SINGLE_LE || from == FLOAT_IEEE_SINGLE_BE)
&& (to == FLOAT_IEEE_SINGLE_LE || to == FLOAT_IEEE_SINGLE_BE))
else if ((from == FLOAT_IEEE_DOUBLE_LE || from == FLOAT_IEEE_DOUBLE_BE)
&& (to == FLOAT_IEEE_DOUBLE_LE || to == FLOAT_IEEE_DOUBLE_BE))
put_uint64 (bswap_64 (get_uint64 (src)), dst);
else if ((from == FLOAT_IEEE_DOUBLE_LE || from == FLOAT_IEEE_DOUBLE_BE)
&& (to == FLOAT_IEEE_DOUBLE_LE || to == FLOAT_IEEE_DOUBLE_BE))
put_uint64 (bswap_64 (get_uint64 (src)), dst);
{
struct fp fp;
extract_number (from, src, &fp);
assemble_number (to, &fp, dst);
{
struct fp fp;
extract_number (from, src, &fp);
assemble_number (to, &fp, dst);
are in practice) is stored in *BEST_GUESS. */
int
float_identify (double expected_value, const void *number, size_t length,
are in practice) is stored in *BEST_GUESS. */
int
float_identify (double expected_value, const void *number, size_t length,
/* Returns the 16-bit unsigned integer at P,
which need not be aligned. */
static inline uint16_t
/* Returns the 16-bit unsigned integer at P,
which need not be aligned. */
static inline uint16_t
/* Returns the 32-bit unsigned integer at P,
which need not be aligned. */
static inline uint32_t
/* Returns the 32-bit unsigned integer at P,
which need not be aligned. */
static inline uint32_t
/* Returns the 64-bit unsigned integer at P,
which need not be aligned. */
static inline uint64_t
/* Returns the 64-bit unsigned integer at P,
which need not be aligned. */
static inline uint64_t
/* Stores 16-bit unsigned integer X at P,
which need not be aligned. */
static inline void
/* Stores 16-bit unsigned integer X at P,
which need not be aligned. */
static inline void
/* Stores 32-bit unsigned integer X at P,
which need not be aligned. */
static inline void
/* Stores 32-bit unsigned integer X at P,
which need not be aligned. */
static inline void
/* Stores 64-bit unsigned integer X at P,
which need not be aligned. */
static inline void
/* Stores 64-bit unsigned integer X at P,
which need not be aligned. */
static inline void
/* Returns NATIVE converted to a form that, when stored in
memory, will be in little-endian byte order. */
static inline uint16_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in little-endian byte order. */
static inline uint16_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in big-endian byte order. */
static inline uint16_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in big-endian byte order. */
static inline uint16_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in VAX-endian byte order. */
static inline uint16_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in VAX-endian byte order. */
static inline uint16_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in little-endian byte order. */
static inline uint32_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in little-endian byte order. */
static inline uint32_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in big-endian byte order. */
static inline uint32_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in big-endian byte order. */
static inline uint32_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in VAX-endian byte order. */
static inline uint32_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in VAX-endian byte order. */
static inline uint32_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in little-endian byte order. */
static inline uint64_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in little-endian byte order. */
static inline uint64_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in big-endian byte order. */
static inline uint64_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in big-endian byte order. */
static inline uint64_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in VAX-endian byte order. */
static inline uint64_t
/* Returns NATIVE converted to a form that, when stored in
memory, will be in VAX-endian byte order. */
static inline uint64_t
{
return native_to_be64 (((native & UINT64_C(0xff00ff0000000000)) >> 40) |
((native & UINT64_C(0x00ff00ff00000000)) >> 24) |
{
return native_to_be64 (((native & UINT64_C(0xff00ff0000000000)) >> 40) |
((native & UINT64_C(0x00ff00ff00000000)) >> 24) |
{
case FLOAT_IEEE_SINGLE_LE:
extract_ieee (le_to_native32 (get_uint32 (bits)), 8, 23, fp);
{
case FLOAT_IEEE_SINGLE_LE:
extract_ieee (le_to_native32 (get_uint32 (bits)), 8, 23, fp);
-extract_ieee (uint64_t bits, int exp_bits, int frac_bits, struct fp *fp)
+extract_ieee (uint64_t bits, int exp_bits, int frac_bits, struct fp *fp)
{
const int bias = (1 << (exp_bits - 1)) - 1;
const uint64_t max_raw_frac = (UINT64_C(1) << frac_bits) - 1;
{
const int bias = (1 << (exp_bits - 1)) - 1;
const uint64_t max_raw_frac = (UINT64_C(1) << frac_bits) - 1;
fp->class = LOWEST;
else if (raw_exp == max_raw_exp - 1 && raw_frac == max_raw_frac)
fp->class = raw_sign ? MISSING : HIGHEST;
fp->class = LOWEST;
else if (raw_exp == max_raw_exp - 1 && raw_frac == max_raw_frac)
fp->class = raw_sign ? MISSING : HIGHEST;
-extract_vax (uint64_t bits, int exp_bits, int frac_bits, struct fp *fp)
+extract_vax (uint64_t bits, int exp_bits, int frac_bits, struct fp *fp)
fp->class = LOWEST;
else if (raw_exp == max_raw_exp && raw_frac == max_raw_frac)
fp->class = raw_sign ? MISSING : HIGHEST;
fp->class = LOWEST;
else if (raw_exp == max_raw_exp && raw_frac == max_raw_frac)
fp->class = raw_sign ? MISSING : HIGHEST;
-extract_z (uint64_t bits, int exp_bits, int frac_bits, struct fp *fp)
+extract_z (uint64_t bits, int exp_bits, int frac_bits, struct fp *fp)
fp->class = raw_sign ? MISSING : HIGHEST;
else if (raw_sign && raw_exp == max_raw_exp && raw_frac == max_raw_frac - 1)
fp->class = LOWEST;
fp->class = raw_sign ? MISSING : HIGHEST;
else if (raw_sign && raw_exp == max_raw_exp && raw_frac == max_raw_frac - 1)
fp->class = LOWEST;
/* Parses a hexadecimal floating point number string at S (useful
for testing) into neutral format at FP. */
static void
/* Parses a hexadecimal floating point number string at S (useful
for testing) into neutral format at FP. */
static void
{
case FLOAT_IEEE_SINGLE_LE:
put_uint32 (native_to_le32 (assemble_ieee (fp, 8, 23)), number);
{
case FLOAT_IEEE_SINGLE_LE:
put_uint32 (native_to_le32 (assemble_ieee (fp, 8, 23)), number);
{
assert (fp->class == FINITE);
assert (fp->fraction != 0);
/* Make sure that the leading fraction bit is 1. */
{
assert (fp->class == FINITE);
assert (fp->fraction != 0);
/* Make sure that the leading fraction bit is 1. */
{
uint64_t last_frac_bit = UINT64_C(1) << (64 - frac_bits);
uint64_t decision_bit = last_frac_bit >> 1;
{
uint64_t last_frac_bit = UINT64_C(1) << (64 - frac_bits);
uint64_t decision_bit = last_frac_bit >> 1;
IEEE format with EXP_BITS exponent bits and FRAC_BITS fraction
bits, and returns the value. */
static uint64_t
IEEE format with EXP_BITS exponent bits and FRAC_BITS fraction
bits, and returns the value. */
static uint64_t
normalize_and_round_fp (fp, frac_bits + 1);
if (fp->exponent - 1 > max_norm_exp)
{
normalize_and_round_fp (fp, frac_bits + 1);
if (fp->exponent - 1 > max_norm_exp)
{
VAX format with EXP_BITS exponent bits and FRAC_BITS fraction
bits, and returns the value. */
static uint64_t
VAX format with EXP_BITS exponent bits and FRAC_BITS fraction
bits, and returns the value. */
static uint64_t
normalize_and_round_fp (fp, frac_bits + 1);
if (fp->exponent > max_finite_exp)
{
normalize_and_round_fp (fp, frac_bits + 1);
if (fp->exponent > max_finite_exp)
{
has more than 53 bits of precision. That is, we never shift a
1-bit off the right end of the fraction. */
static void
has more than 53 bits of precision. That is, we never shift a
1-bit off the right end of the fraction. */
static void
architecture format with EXP_BITS exponent bits and FRAC_BITS
fraction bits, and returns the value. */
static uint64_t
architecture format with EXP_BITS exponent bits and FRAC_BITS
fraction bits, and returns the value. */
static uint64_t
const int min_denorm_exp = min_norm_exp - (frac_bits - 1);
const uint64_t max_raw_frac = (UINT64_C(1) << frac_bits) - 1;
const int min_denorm_exp = min_norm_exp - (frac_bits - 1);
const uint64_t max_raw_frac = (UINT64_C(1) << frac_bits) - 1;
normalize_and_round_fp (fp, frac_bits);
normalize_hex_fp (fp);
if (fp->exponent > max_norm_exp)
normalize_and_round_fp (fp, frac_bits);
normalize_hex_fp (fp);
if (fp->exponent > max_norm_exp)
{
case FINITE:
normalize_and_round_fp (fp, 64);
normalize_hex_fp (fp);
assert (fp->fraction != 0);
{
case FINITE:
normalize_and_round_fp (fp, 64);
normalize_hex_fp (fp);
assert (fp->fraction != 0);