struct BigDecimal
Overview
A BigDecimal
can represent arbitrarily large precision decimals.
It is internally represented by a pair of BigInt
and UInt64
: value and scale.
Value contains the actual value, and scale tells the decimal point place.
E.g. when value is 1234
and scale 2
, the result is 12.34
.
NOTE To use BigDecimal
, you must explicitly import it with require "big"
The general idea and some of the arithmetic algorithms were adapted from the MIT/APACHE-licensed bigdecimal-rs.
Included Modules
- Comparable(BigDecimal)
- Comparable(BigRational)
- Comparable(Float)
- Comparable(Int)
Defined in:
ssz/big_codec.crClass Method Summary
- .ssz_basic? : Bool
- .ssz_decode(io : IO, size : Int32)
- .ssz_decode(bytes : Bytes)
- .ssz_fixed? : Bool
- .ssz_variable? : Bool
Instance Method Summary
- #ssz_basic? : Bool
- #ssz_encode(io : IO)
- #ssz_encode : Bytes
- #ssz_fixed? : Bool
- #ssz_size : Int32
- #ssz_variable? : Bool
Instance methods inherited from struct Number
hash_tree_root : Bytes
hash_tree_root,
ssz_basic? : Bool
ssz_basic?,
ssz_encode(io : IO)
ssz_encode,
ssz_size : Int32
ssz_size,
ssz_variable? : Bool
ssz_variable?
Class methods inherited from struct Number
ssz_basic? : Bool
ssz_basic?,
ssz_decode(io : IO, size : Int32 = 0)
ssz_decode,
ssz_variable? : Bool
ssz_variable?
Instance methods inherited from class Object
ssz_basic? : Bool
ssz_basic?,
ssz_encode(io : IO)ssz_encode : Bytes ssz_encode, ssz_fixed? : Bool ssz_fixed?, ssz_size : Int32 ssz_size, ssz_variable? : Bool ssz_variable?
Class methods inherited from class Object
ssz_basic? : Bool
ssz_basic?,
ssz_decode(io : IO, size : Int32 = 0)ssz_decode(bytes : Bytes) ssz_decode, ssz_fixed? : Bool ssz_fixed?, ssz_variable? : Bool ssz_variable?