How do I know the real value of a variable of type double? The point is that sometimes thousandths are thrown out by print - the variable itself is formed from a text string, but it goes through a rounding procedure.
-Aleks-: How do I know the real value of a variable of type double? The thing is, sometimes thousands of digits are thrown out via print - the variable itself is formed from a text string, but it goes through a rounding procedure.
Alexey Kozitsyn: Do you want to compare several values of type double?
Not really... there is an assumption that numbers do not always have an integer value of 4=3.9999999999999999999 and an inaccuracy is formed after mathematical operations after rounding.
Can you please send e-mail messages from the Metatrader 4 terminal in such a way that a screenshot of the current chart is taken and put in the middle of the message. Example:
-Aleks-: Not quite... there is an assumption that numbers do not always have an integer value of 4=3.99999999999999999 and after doing the math, you get an inaccuracy after rounding.
Even if inaccuracy appears, use NormalizeDouble(). Set the accuracy you want for your calculations. This is what this function is for.
The example there seems to describe your case:
You should be aware that the normalised number when output to the Journal using Print() may contain more decimal places than you expect. For example,
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
That's not all... https://www.mql5.com/ru/forum/66827
How do I know the real value of a variable of type double? The thing is, sometimes thousands of digits are thrown out via print - the variable itself is formed from a text string, but it goes through a rounding procedure.
Ahem. What do you need it for?
To detect an error in the calculation :)
Do you want to compare several values of type double?
Can you please send e-mail messages from the Metatrader 4 terminal in such a way that a screenshot of the current chart is taken and put in the middle of the message. Example:
There was a buy signal on EurUsd
<скриншот09122015_eurusd.png>
Additional information about the opening.
Tell me how to implement this? Maybe there is an example or something similar that can be redone. Thanks!Not quite... there is an assumption that numbers do not always have an integer value of 4=3.99999999999999999 and after doing the math, you get an inaccuracy after rounding.
Even if inaccuracy appears, use NormalizeDouble(). Set the accuracy you want for your calculations. This is what this function is for.
The example there seems to describe your case:
You should be aware that the normalised number when output to the Journal using Print() may contain more decimal places than you expect. For example,
DoubleToString(a,8)=76.67100000
Print(76.671)=76.67100000000001
Even if inaccuracy appears, use NormalizeDouble(). Set the accuracy you want for your calculations. This is what this function is for.
The example there seems to describe your case:
Yes - it is described, yes - I use it - the question is how not through Print and string in general to get data for analysis :)
Using the same NormalizeDouble(). You get a number of type double. Normalized. Simply Print() outputs it like this.
Here it is written how to do the comparison correctly: https://www.mql5.com/ru/docs/basis/types/double