Float
- Last UpdatedOct 04, 2024
- 1 minute read
- PI System
- PI Server 2018
- PI Server
Convert a string to a number.
Syntax
Float(x)
Arguments
-
x
A string or a number, or an attribute whose value evaluates to a number at time of evaluation
Returns
A number for a numeric string. If x is already a number, x is returned
Exceptions
If x is not a number or a numeric string, returns
Notes
Unit of measure of the argument, if it exists, is carried over to the result. Float also takes timespan and boolean as argument. Note, however, that Float only converts timespan format to the number of seconds from 12:00am Jan 1, 1970.
Example
-
Float("12.3")
[Converts string to a number and returns 12.3]
-
Float(12.3)
[Returns 12.3]
-
Float('*')
[Return the total number of seconds passed since Jan 1, 1970]