Skip to main content

to_decimal

Function to_decimal 

Source
pub fn to_decimal(v: &Value) -> DogeResult
Expand description

dec(x) — an exact Decimal. An Int converts exactly; a Bool to 0/1; a numeric Str parses exactly (dec("0.10")); a Float converts via its shortest decimal form, so dec(0.1) is exactly 0.1 and not the binary noise a raw cast would carry. A Decimal is returned unchanged. A non-numeric Str is a catchable ValueError; other types are a TypeError.