Skip to main content
Version: 8.1

toFloat

This function is used by Ignition's Expression language..

Description​

Tries to coerce value into a float (32-bit floating point vaule). If value is a number, the conversion is direct. If value is a string, it is parsed to see if it represents a float. If not, type casting fails.

Syntax​

toFloat(value[, failover])

  • Parameters

    • Object value - The value to type cast.

    • Object failover - The failover value if type casting fails. [optional]

  • Results

    • Float - The value type cast as a float.

Examples​

Code Snippet
toFloat("38.772") //returns 38.772
Code Snippet
toFloat({Root Container.TextField.text}, 0.0) //returns the value in the text box as a float, or 0.0 if the value doesn't represent a number.