Skip to main content

Module decimal

Module decimal 

Source

Traitsยง

DecimalCast
A utility trait that provides checked conversions between decimal types inspired by NumCast

Functionsยง

apply_decimal_cast ๐Ÿ”’
apply_rescaler ๐Ÿ”’
Apply the rescaler function to the value. If the rescaler is infallible, use the infallible function. Otherwise, use the fallible function and validate the precision.
cast_decimal_to_decimal ๐Ÿ”’
cast_decimal_to_decimal_error ๐Ÿ”’
cast_decimal_to_decimal_same_type ๐Ÿ”’
cast_decimal_to_float ๐Ÿ”’
Cast a decimal array to a floating point array.
cast_decimal_to_integer ๐Ÿ”’
cast_floating_point_to_decimal ๐Ÿ”’
cast_string_to_decimal ๐Ÿ”’
Cast Utf8 to decimal
convert_to_bigger_or_equal_scale_decimal ๐Ÿ”’
convert_to_smaller_scale_decimal ๐Ÿ”’
generic_string_to_decimal_cast ๐Ÿ”’
make_downscaler ๐Ÿ”’
Construct closures to downscale decimals from (input_precision, input_scale) to (output_precision, output_scale).
make_upscaler ๐Ÿ”’
Construct closures to upscale decimals from (input_precision, input_scale) to (output_precision, output_scale).
parse_string_to_decimal_nativeDeprecated
Parses the given string as a decimal with the given scale, returning the unscaled representation in the decimal typeโ€™s native integer (e.g. i32 for Decimal32Type, i256 for Decimal256Type).
rescale_decimal
Rescales a decimal value from (input_precision, input_scale) to (output_precision, output_scale) and returns the converted number when it fits within the output precision.
single_float_to_decimal
Cast a single floating point value to a decimal native with the given multiple. Returns None if the value cannot be represented with the requested precision.
string_to_decimal_cast ๐Ÿ”’
string_view_to_decimal_cast ๐Ÿ”’