Skip to main content

decimaled_amount

Schema: lib_math

Description

This function is used to convert raw token values and other fixed-point values into their corresponding decimal amount. It takes in a raw fixed-point value and the number of decimal places and returns the decimal amount.

Usage

Signature

lib_math.decimaled_amount(raw_val numeric, decimals integer)

Parameters

NameTypeDescription
raw_valnumericThe raw value to be converted
decimalsintegerThe number of decimal places to convert to

Results

This function returns a numeric value, representing the decimal amount of the given raw value with the specified number of decimal places.

Examples

Convert a raw value of 1234 to a decimal amount with 2 decimal places; the result will be 12.34
select lib_math.decimaled_amount(1234, 2);