UFixed(N)
Inherits Comparable < Comparable < Comparable < FixedDecimal::Value < Struct < Value < Object
An unsigned binary fixed-point number stored in a UInt128.
The low N bits hold the fraction and the high 128 - N bits hold the
integer part, so the value is raw / 2**N. N must be in 0..128.
ratio = UFixed(128).new("0.75") # all 128 bits are fraction
ratio.to_f64 # => 0.75
Constructors
Builds a value from a sign and a magnitude in units of the least
significant bit. Raises OverflowError when out of range, or when
magnitude is nil (the convention for an intermediate overflow).
Converts, rounding half-to-even. Raises OverflowError if it is out
of range.
Converts a float, rounding half-to-even. Raises ArgumentError for NaN
or infinity and OverflowError if it is out of range.
Converts from any Fixed or UFixed, rounding half-to-even when
fraction bits are lost. Raises OverflowError if it is out of range.
Converts, rounding half-to-even. Raises OverflowError if it is out
of range.
Converts, rounding half-to-even. Raises OverflowError if it is out
of range.
Parses a decimal string such as "-12.375", "1_000.5", ".5" or
"6.02e23", rounding half-to-even to the nearest representable value.
Raises ArgumentError if string is not a valid decimal number and
OverflowError if it is out of range. Leading and trailing whitespace
(ASCII only, as with String#to_i) is ignored when whitespace is true.