Skip to main content
Version: v4.24

float

Casts an expression to a float.

float(x:any) -> float

Description

The float function converts the given value x to a floating-point value.

Examples

Cast an integer to a float

from {x: float(42)}
{x: 42.0}

Cast a string to a float

from {x: float("4.2")}
{x: 4.2}

See Also

int, uint, time, string, ip