float_sto_set
Concepts
Section titled “Concepts”Behaviour
Section titled “Behaviour”- Read a serialized floating point number.
- If there are more fields/data after the serialized floating pointer number then ignore them.
- Return it as an XFL enclosing number
- Sets the buffer for storing float representations.
- Returns ErrorCode or the result as a number.
Definition
Section titled “Definition”int64_t float_sto_set ( uint32_t read_ptr, uint32_t read_len);
function float_sto_set(buf: ByteArray | HexString): ErrorCode | number
Example
Section titled “Example”int64_t vault_pusd = float_sto_set(vault, 8);if (vault_pusd < 0) rollback("Failed to parse serialized float.", 33, 1);
const vault_pusd = float_sto_set(vault)if (typeof vault_pusd === 'string') rollback("Failed to parse serialized float.", 1)
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
read_ptr | uint32_t | Pointer to a buffer contianing the serialized XFL. May be null. |
read_len | uint32_t | The length of the buffer. |
Name | Type | Description |
---|---|---|
buf | ByteArray | HexString | The buffer to set. |
Return Code
Section titled “Return Code”Type | Description |
---|---|
int64_t | The number of bytes written to the output buffer. |
Type | Description |
---|---|
ErrorCode or number | An error code or the result as a number. |