gnd

The float32 operation converts one input value to a 32-bit IEEE-754 floating-point number.

Accepted operand forms

Range and precision

Syntax

[ $destination ] float32 value

Examples

Convert an integer literal:

$ratio float32  10          # 10.0 stored as float32

Convert a decimal string:

$txt    let "2.71828"
$e32    float32 $txt        # rounded to nearest float32

Convert the current _ in place:

let  1e40
float32                      # error: overflow (value too large)

Handle small values:

float32 1e-50                # silently becomes 0 (underflow to sub-normal 0)

Reject non-numeric input:

float32 "hello"              # error: cannot parse as number

float32 always produces one float32 value, never rebinds existing variables, and observes Gendo’s single-assignment rule.