float_int
Convert an XFL floating point into an integer (floor)
Concepts
Behaviour
Left shift (multiply by 10) the XFL by the number of specified decimal places
Convert the resulting XFL to an integer, discarding any remainder
Return the integer
Definition
C
Example
C
Parameters
float1
int64_t
An XFL floating point enclosing number representing the first operand to the addition
decimal_places
uint32_t
The number of places to shift the decimal to the right before computing the floor of the floating point.
absolute
uint32_t
If 1
also take the absolute of the value before returning it.
πHintNegative return values are reserved for error codes. Therefore if you need to execute this function against a negative XFL you should use
absolute = 1
Return Code
int64_t
The computed positive integer
If negative, an error:
INVALID_FLOAT
- one of the supplied parameters was not a valid XFL enclosing number
INVALID_ARGUMENT
- attempted to specify more than 15 decimal places.
CANT_RETURN_NEGATIVE
- attempted to return a negative integer but this is not allowed, use absolute = 1
Last updated