Get the number of decimal places of any numbers (not just quotes) bypassing Digits() in MQL4 and MQL5 - page 3

 
A100:

What does this have to do with the ghost?

Print(500000000000.00001); // 500000000000.0
 
Simply amazing! Proving so stubbornly and in all seriousness that the wrong answer is the right one. It's not my fault, he came up with it))
 
Alexandr Sokolov:

It's like that here on the forum for some reason, but in the editor it's the same as usual

Well, I'd check to see if I've used that name elsewhere.

 
Алексей Тарабанов:

Well, I'd check if I've used that name somewhere else.

In the editor the name of variable value is not shown in blue (it's only on the forum). And it's blue only in MQL4, while in MQL5 it is black as usual. I don't know why it's so and it doesn't seem to affect the code correctness, no one dumped complaints with screenshots.)

 
fxsaber:

There is no such number among the doubles. It is approximately equal to 500000000.00100016593933105. It is assigned.

You got it. And how many decimal places are there? 8?

 
Алексей Тарабанов:

Not " you have 8", mql has 8 by default. Can't we read the documentation?

What is the default 8 in MQL ? Where is the link to the documentation? And what does this have to do with the original problem?

 
   double x=500000000.0001;
   
   Alert((500000000.0001==NormalizeDouble(500000000.0001,4))); // true
 
int d(double x){
   int n;
   for(n=0;n<8;n++){
      if(x==NormalizeDouble(x,n)){
         return(n);
      }
   }
   return(n-1);
}
 
Dmitry Fedoseev:

I kneel.

 

Dmitry Fedoseev:

int d(double x){
   int n;
   for(n=0;n<8;n++){
      if(x==NormalizeDouble(x,n)){
         return(n);
      }
   }
   return(n-1);
}
I think this also works, but I haven't tested anything yet, but I get the idea, and errors can be corrected as you go along (if there are any)
Reason: