Method: Flt::FormatBase.from_bits
- Defined in:
- lib/float-formats/classes.rb
.from_bits(i) ⇒ Object
Defines a floating-point number from the encoded integral value.
867 868 869 870 871 872 873 874 875 876 877 878 879 880 |
# File 'lib/float-formats/classes.rb', line 867 def self.from_bits(i) v = Bytes.from_i(i) if v.size<total_bytes fill = (0.chr*(total_bytes-v.size)) if @endianness==:little_endian v << fill else v = Bytes.new(fill) + bytes end elsif v.size>total_bytes raise "Invalid floating point value" end from_bytes v end |