Download MetaTrader 5

Math calculation wrong

To add comments, please log in or register
Dominik
27
Dominik  

Hi, 

 I am sitting here for hours now trying to fix this thing until it turned out that my calculator can easily get the wanted result, but it seems that MT4 cant.

 

I should show the result -2.35671324

 

using this calculation:   Print(((1/10)*23.56713241)*(-1));

 

 but instead it is showing -0.

 

Does someone know the reason? Do I need a specific Math-function for letting it calculate that?  

Alain Verleyen
Moderator
31441
Alain Verleyen  
Deyaz:

Hi, 

 I am sitting here for hours now trying to fix this thing until it turned out that my calculator can easily get the wanted result, but it seems that MT4 cant.

 

I should show the result -2.35671324

 

using this calculation:   Print(((1/10)*23.56713241)*(-1));

 

 but instead it is showing -0.

 

Does someone know the reason? Do I need a specific Math-function for letting it calculate that?  

Because 1 and 10 are integer, so 1/10 is 0.

Try

Print(((1./10)*23.56713241)*(-1));
Dominik
27
Dominik  
Wow, so simple. Thanks a lot! It worked. 
To add comments, please log in or register