Download MetaTrader 5

DoubleToStr vs DoubleToString

To add comments, please log in or register
Christian Köchy
36
Christian Köchy  
is there a difference between DoubleToStr and DoubleToString?
Simon Gniadkowski
Moderator
18024
Simon Gniadkowski  
shck:
is there a difference between DoubleToStr and DoubleToString?
Yes, please read about them in the MetaEditor help file.
Christian Köchy
36
Christian Köchy  
RaptorUK:
Yes, please read about them in the MetaEditor help file.


I had already looked there and at first glance I saw no difference, so I asked here for it.
ydrol
593
ydrol  
There doesn't appear to be much - except a default of 8 and a mistake in the documentation 'int value'?
Alain Verleyen
Moderator
32520
Alain Verleyen  
shck:

I had already looked there and at first glance I saw no difference, so I asked here for it.

There is no difference, to 2 functions are exactly the same. Only documentation is different.

   Print("double To String(120.0 + M_PI) : ",DoubleToString(120.0+M_PI)," <=> ",DoubleToStr(120.0+M_PI));
   Print("double To String(120.0 + M_PI,16) : ",DoubleToString(120.0+M_PI,16)," <=> ",DoubleToStr(120.0+M_PI,16));
   Print("double To String(120.0 + M_PI,-16) : ",DoubleToString(120.0+M_PI,-16)," <=> ",DoubleToStr(120.0+M_PI,-16));
   Print("double To String(120.0 + M_PI,-1) : ",DoubleToString(120.0+M_PI,-1)," <=> ",DoubleToStr(120.0+M_PI,-1));
   Print("double To String(120.0 + M_PI,-20) : ",DoubleToString(120.0+M_PI,-20)," <=> ",DoubleToStr(120.0+M_PI,-20));

2014.02.05 19:58:12.211 _template EURUSD,M1: double To String(120.0 + M_PI,-20) : 1.231416e+002 <=> 1.231416e+002
2014.02.05 19:58:12.211 _template EURUSD,M1: double To String(120.0 + M_PI,-1) : 1.2e+002 <=> 1.2e+002
2014.02.05 19:58:12.211 _template EURUSD,M1: double To String(120.0 + M_PI,-16) : 1.2314159265358980e+002 <=> 1.2314159265358980e+002
2014.02.05 19:58:12.211 _template EURUSD,M1: double To String(120.0 + M_PI,16) : 123.1415926535897967 <=> 123.1415926535897967
2014.02.05 19:58:12.211 _template EURUSD,M1: double To String(120.0 + M_PI) : 123.14159265 <=> 123.14159265

Christian Köchy
36
Christian Köchy  
angevoyageur:

There is no difference, to 2 functions are exactly the same. Only documentation is different.


Is there a reason for two identical functions? Which would be the best choice for the future?
Ubzen
5394
Ubzen  
shck: Is there a reason for two identical functions? Which would be the best choice for the future?
Probably the new one.
Simon Gniadkowski
Moderator
18024
Simon Gniadkowski  
shck:

Is there a reason for two identical functions? Which would be the best choice for the future?
One is for backwards compatibility with old mql4 the other for compatibility with mql5.
To add comments, please log in or register