Hello everyone,
I would like to display numbers with a defined amount of decimal places.
Let's take 0.001
So, if the resulting number where to only contain zeros, I would like to increase the amount of decimals to the first non-zero.
Does anybody know a formula that counts the amount of decimal zeros?
Only the ones before the first non-zero of course, i.e. 0.0010002 should return 2 and not 5.
Alternatively, the formula can return the position of the first non-zero, i.e. 3, instead of the amount of zeros, i.e. 2.
Thank you very much
Alex
I would like to display numbers with a defined amount of decimal places.
Let's take 0.001
Code:
local numbervar Decimals :=2
toText(Value, Decimals)
This would result in "0.00".
So, if the resulting number where to only contain zeros, I would like to increase the amount of decimals to the first non-zero.
Does anybody know a formula that counts the amount of decimal zeros?
Only the ones before the first non-zero of course, i.e. 0.0010002 should return 2 and not 5.
Alternatively, the formula can return the position of the first non-zero, i.e. 3, instead of the amount of zeros, i.e. 2.
Thank you very much
Alex