alaylwint:
Doubles aren't as precise as integers the reason is explained here.
I am strange with mql4.
Now I subtract two value Bid - MydoubleVar . But Result is not look like from calculator result.
eg..
Bid value is 1.01424
MydoubleVar is 1.01427
If I used like that
MessageBox(Bid - MydoubleVar);
Message Box replied that -2.99999999999
Normal Calculator result is -0.00003
Why are they different.
Thanks

Double-precision floating-point format - Wikipedia
- en.wikipedia.org
Double-precision floating-point format is a computer number format that occupies 8 bytes (64 bits) in computer memory and represents a wide, dynamic range of values by using a floating point. Double-precision floating-point format usually refers to binary64, as specified by the IEEE 754 standard, not to the 64-bit decimal format decimal64. In...
- Floating point has infinite number of decimals, it's your not understanding floating point and that some numbers can't be represented exactly. (like 1/10.) Double-precision floating-point format - Wikipedia, the free encyclopedia
- If you want the value displayed reasonably, convert it to a string.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I am strange with mql4.
Now I subtract two value Bid - MydoubleVar . But Result is not look like from calculator result.
eg..
Bid value is 1.01424
MydoubleVar is 1.01427
If I used like that
MessageBox(Bid - MydoubleVar);
Message Box replied that -2.99999999999
Normal Calculator result is -0.00003
Why are they different.
Thanks