I would like to count the number of decimals (i.e. number of digits below the fractional comma/point) in a double value. I can think of many (dirty & not culture safe) ways of doing this, but I am looking for a reliable solution.
Does anyone has a solution to this problem
Thanks in advance,
Joannes

Conting the number of decimals (variant of the Math.Round utility)?
jazg
Danny Tsai
Hi!
You have at least two choices:
1. format to string using current culture and count characters after separator (a little weird, but easy to implement and understand culture settings)
2. do something like that pseudocode:
double current = your_value - Math.Floor(your_value);
int count = 0;
while(current != 0)
{
}