float_set
Create a float from an exponent and mantissa
Concepts
Behaviour
Compute an XFL (xls17) floating point from the provided exponent and mantissa
Return that XFL as an int64_t
Definition
C
Example
C
Parameters
exponent
int32_t
An exponent in the range -96
to 80
mantissa
int64_t
A mantissa. If negative then the sign of the float is negative.
🚧CautionWhen setting a mantissa that is greater or fewer than 16 decimal digits the exponent will be adjusted to ensure the mantissa is exactly 16 digits. This adjustment may result in an
INVALID_FLOAT
in some circumstances.
📘Special caseXFL canonical 0 is also 0 in the enclosing number. Thus there is never a need to call
float_set(0,0);
Return Code
int64_t
The XFL (xls17) enclosing number
If negative, an error:
INVALID_FLOAT
- The adjustment of the mantissa to 16 digits produced an under or overflow.
Last updated