Echelon FTXL User Manual
Page 79
FTXL User’s Guide
67
This floating-point format can represent numbers with the following
characteristics:
•
1038
10
*
1
±
approximate maximum value
•
7
10
*
1
−
±
approximate relative resolution
The float_type structure declaration represents a floating-point number in IEEE
754 single-precision format. This format has one sign bit, eight exponent bits,
and 23 mantissa bits; the data is stored in big-endian order. The float_type type
is identical to the type used to represent floating-point network variables.
For example, the LonTalk Interface Developer utility generates the following
definitions for the floating point type SNVT_volt_f:
/*
* Type: SNVT_volt_f
*/
typedef LON_STRUCT_BEGIN(SNVT_volt_f)
{
LonByte Flags_1; /* Use bit field macros, defined
below */
LonByte Flags_2; /* Use bit field macros, defined
below */
ncuLong LS_mantissa;
} LON_STRUCT_END(SNVT_volt_f);
/*
* Macros to access the sign bit field contained in
* Flags_1
*/
#define LON_SIGN_MASK 0x80
#define LON_SIGN_SHIFT 7
#define LON_SIGN_FIELD Flags_1
/*
* Macros to access the MS_exponent bit field contained in
* Flags_1
*/
#define LON_MSEXPONENT_MASK 0x7F
#define LON_MSEXPONENT_SHIFT 0
#define LON_MSEXPONENT_FIELD Flags_1
/*
* Macros to access the LS_exponent bit field contained in
* Flags_2
*/
#define LON_LSEXPONENT_MASK 0x80
#define LON_LSEXPONENT_SHIFT 7
#define LON_LSEXPONENT_FIELD Flags_2
/*
* Macros to access the MS_mantissa bit field contained in
* Flags_2
*/
#define LON_MSMANTISSA_MASK 0x7F
#define LON_MSMANTISSA_SHIFT 0