Builtin

to_float

to_float(a) to_float(a, default_if_empty_string)

Returns the value of a converted to a float.

If a is a string and is "" then default_if_empty_string, a float (or int), is returned instead.

For bool, false=0.0 and true=1.0.

For times, returns number of microseconds since Jan 1 1970 UTC.

Examples

int
to_float(0)
0.00

str
to_float("42")
42.00

str with default
to_float("", 99)
99.00