Float64
Inherits Float / Number / Steppable / Comparable / Value / Object
Constructors
Create a Float64 value from its representation as a byte array in big endian.
bytes = Bytes[0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
Float64.from_be_bytes(bytes)
# => 12.5
Create a Float64 value from its representation as a byte array.
Create a Float64 value from its representation as a byte array in little endian.
bytes = Bytes[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40]
Float64.from_le_bytes(bytes)
# => 12.5
Instance methods
to_be_bytes
Return the memory representation of this number as a byte array in big-endian (network) byte order.
bytes = "12.5".to_be_bytes
# => Bytes[0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
Return the memory representation of this number as a byte array using the specified format
to_le_bytes
Return the memory representation of this number as a byte array in little-endian byte order.
bytes = 12.5.to_le_bytes
# => Bytes[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40]
to_ne_bytes
Return the memory representation of this number as a byte array in native-endian byte order.