help with "double" data type please

 

this is what says in the mql4book but I find it not to be true:


"The values of real constants and variables consist of an integer part, a decimal point, and a fractional part. The values can be positive or negative. The integer part and the fractional part are made of digits from 0 to 9. The amount of significant figures after decimal point can reach the value of 15.

Example:

27.12 -1.0 2.5001 -765456.0 198732.07 0.123456789012345

The values of double type may range from -1.7 * e-308 to 1.7 * e308. In the computer memory, the values of constants and variables of double type take 8 bytes."


I used the following code:

//--------------------

s= 0.123456789;

Alert("s= ", s);

//--------------------


and the alert window shows: "s= 0.1235"

why is variable s truncated to first 4 digits? i need all 9 digits

please someone answer

 

Hello user

Please read ALL the documents relating to Print(), Comment() and Alert()

You will then discover that what you got displayed is true.

Read the third line of each builtins docs - is third line in my MetaEditor help docs.

.

You will discover that this is an historical design feature of MQL4 - namely price feeds used 2 or 4 digits only...

 
usermql4:

s= 0.123456789;

Alert("s= ", s);

//--------------------

and the alert window shows: "s= 0.1235"

why is variable s truncated to first 4 digits? i need all 9 digits

print defaults to 4 digits. Try:

Alert("s=",DoubleToStr(Point,Digits));

Alert("s=",DoubleToStr(Point,9));

 
thank you all topic can be closed