toFloat16 (Function)

Signature: toFloat16(value: t0) -> float16

Description: Converts any numeric type to float16, rounding to nearest even. Overflow becomes signed infinity; 65520.0 is the first finite double that rounds to infinity. Total and pure.

Parameters

  • value (t0): The number to convert

Returns: float16

Example

print(toFloat16(1.0))  // 1.0
print (toFloat16 1.0)  // 1.0