core :: Reader :: read_double
Float
Returns 0.0
when an error is pending (last_error != null
).
# Read a floating point on 64 bits and return it as a `Float`
#
# Returns `0.0` when an error is pending (`last_error != null`).
fun read_double: Float
do
if last_error != null then return 0.0
var b0 = read_byte
var b1 = read_byte
var b2 = read_byte
var b3 = read_byte
var b4 = read_byte
var b5 = read_byte
var b6 = read_byte
var b7 = read_byte
# Check for error, `last_error` is set by `read_byte`
if b0 < 0 or b1 < 0 or b2 < 0 or b3 < 0 or
b4 < 0 or b5 < 0 or b6 < 0 or b7 < 0 then return 0.0
return native_read_double(b0, b1, b2, b3, b4, b5, b6, b7, big_endian)
end
lib/binary/binary.nit:244,2--265,4