toFloat (Function)

Signature: toFloat(value: t0) -> float

Description: Converts any numeric type to float, rounding to nearest even. Exact for integer magnitudes up to 2^53 and for wider float sources only when representable. Total, so it returns a bare float rather than a Result.

Parameters

  • value (t0): The integer to widen

Returns: float

Example

print(toFloat(42))  // 42.0
print (toFloat 42)  // 42.0