Syntax
Turns a value into a number. Text that holds a number, such as "2.5", gives that number with its decimals.
Float(<value>)Parts
| <value> | A number or a text. Text may have spaces around it and may use 1e3 or 0x10 notation. |
|---|
Returns
The number. NaN when the text holds anything besides one number ("2.5x", "2,5", "abc"). An empty text gives 0, TRUE gives 1.
Good to know
- It is not needed for division:
/already keeps the decimals, and7 / 2is 3.5. - Unlike ValFloat(), which reads the number at the start of the text and gives 0 when there is none,
FloatgivesNaNas soon as the text holds anything else. Test the result before using it. - Storing the result in an
AS integervariable still drops the decimals: the variable's type wins.