double()

Converts the specified string representation of a number to an equivalent double-precision floating-point number.

Syntax

double(STR_EXPR)
Required Parameters
STR_EXPR
Target string expression to be converted to a real number

Description

If the expression is null, it returns null. If the real number conversion fails, it also returns null. If the value returned by the expression is not a string, the function automatically converts the value to a string and attempts a real number conversion.

Usage

json "{}" | eval numbers=double("1.2") => 1.2

json "{}" | eval numbers=double("0") => 0.0

json "{}" | eval numbers=double(0) => 0.0

json "{}" | eval numbers=double("invalid") => null

json "{}" | eval numbers=double(null) => null