float64
- Details
- Last Updated on Tuesday, 15 January 2013 16:49
syntax
- float64(a)
definition
float64(a) results in a floating point 64 bits item casted from item a. The function results in:
- for integer data items, the integer value is interpreted as floating point value (e.g. an integer value 1 is interpreted as 1.0);
- for float64 data items, we refer to documentation on calculation with floating point in your processor for more exact information on how values will be rounded off;
- for boolean data items, 1.0 for True values and 0.0 for False values;
- for string data items, if the value starts with an allowed numeric value for the value type, this value is casted to a float64 value type. Other characters found after the numeric values are neglected. If the string does not start with an allowed numeric value for the value type, the result value is null.
- for units, a floating point 64 bits variant of the casted unit.
description
float64 is used as a function to cast units or data items to the value type with the similar name. The allowed range of values for the float64 value type can be found in the value types table.
applies to
Data items and units with value types:
- group: Numeric
- uint2
- uint4
- bool
- string
since version
5.15
example
1. attribute<float64> float64A(ADomain): expr = "float64(A)";
2. attribute<float64> float64B(ADomain): expr = "float64(B)";
| A(float64) | B(string) | float64A | float64B | |
| 0 | 'Hello' | 0.0 | null | |
| 1 | 'Test' | 1.0 | null | |
| 1000000 | null | 1000000.0 | null | |
| -2.5 | 'Two words' | -2.5 | null | |
| 99.9 | '88a' | 99.9 | 88.0 |
Table ADomain, nr of rows = 5