float_int
Concepts
Section titled “Concepts”Behaviour
Section titled “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
- Converts a float representation to an integer with specified decimal places.
- An error code or the resulting integer as a number.
Definition
Section titled “Definition”int64_t float_int ( int64_t float1, uint32_t decimal_places, uint32_t absolute);
function float_int( f1: bigint, decimal_places: number, abs: number ): ErrorCode | number
Example
Section titled “Example”int64_t drops = float_int(xahbalance, 6, 0);
const drops = float_int(xahbalance, 6, 0);
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
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. |
Name | Type | Description |
---|---|---|
f1 | bigint | The float to convert |
decimal_places | number | The number of decimal places to consider. |
abs | number | Indicates whether to take the absolute value. |
Return Code
Section titled “Return Code”Type | Description |
---|---|
int64_t | The computed positive integer |
Type | Description |
---|---|
number or ErrorCode | Returns an error code or the resulting integer as a number. |