Capy-Bearer Documentation

f64_from_bits

lib call

Capy

function f64_from_bits(value : u64) f64

Description

f64_from_bits() is the inverse of bits_of() for f64. The pattern 4607182418800017408 encodes 1.0. A float that was stored as its bit pattern comes back exactly, including negative zero and NaN.

Parameters

value : a 64-bit pattern

Return Values

The f64 whose IEEE 754 encoding is value.

Example

Capy

var stored := bits_of(0.1)
print(f64_from_bits(stored) == 0.1, " ", f64_from_bits(4607182418800017408), "\n")

Output

true 1