toreal()

Learn how to use the toreal() function to convert the input expression to a value of type real.

Converts the input expression to a value of type real.

Syntax

toreal(Expr)

Parameters

NameTypeRequiredDescription
valuescalar✔️The value to convert to real.

Returns

If conversion is successful, the result is a value of type real. Otherwise, the returned value is real(null).

Example

The following example checks whether the input "123.4" was converted to the real value.

toreal("123.4") == 123.4