Count whole numbers in symbol price

 
Hi I want to count whole numbers. for example: 1.23456 is counted as 1 because there is only 1 whole number, for 123.456 it must be 3 and so on. I didn't find any predefined variable for this. does anyone knows way how to do that? Thanks!
 
#define IntegerDigitsCount(x) ((int)MathLog10(MathAbs(x)) + 1)
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart()
  {
   Print(IntegerDigitsCount(1.23456));
   Print(IntegerDigitsCount(123.456));
  }
//+------------------------------------------------------------------+
// output:
// 1
// 3


Note that the function MathLog10() for numbers is somewhat like StringLen() for strings.

 
amrali:


Note that the function MathLog10() for numbers is somewhat like StringLen() for strings.

Thanks it works perfectly

Reason: