Hi all,
Any idea how to obtain the number of decimal place a value has?
eg: 3.12 => 2 decimal places
This is because i need to check if the section is 1 or 1.1
Thanx in advance.
Regards
hengshi
Hi all,
Any idea how to obtain the number of decimal place a value has?
eg: 3.12 => 2 decimal places
This is because i need to check if the section is 1 or 1.1
Thanx in advance.
Regards
hengshi
Subject: decimal place
Lookup in designer help the ‘Fraction’ function:
Fraction ( numExpr )
Here is the example:
’ Print the fractional part of PI
Print Fraction(PI) ’ Prints .141592653589793
'This example shows the relationship between Fix() and Fraction().
’ Print PI
Print PI ’ Prints 3.14159265358979
’ Print the integer part of PI
Print Fix(PI) ’ Prints 3
’ Print the fractional part of PI
Print Fraction(PI) ’ Prints .141592653589793
Subject: decimal place
How about
Subtract out the integer portion of the value
Convert the difference to a string using Cstr
The length of the string - 1 (to remove the period) would be the number of decimal places
E.g.
decimalplaces = len(cstr(x - int(x))) - 1