
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
Forum on trading, automated trading systems and testing trading strategies
MT5/mql5 reported and confirmed bugs.
amrali, 2022.02.17 15:33
Bug in string() function. Wrong conversion of float -> string.
Build 3211 but this is not specific to this build, it's an old one.
A bug is found in string() function where wrong conversion of float -> string.
If you convert an arbitrary single-precision floating-point number to a decimal string, and then convert that back to floating-point, you should recover the original floating-point number. In other words, the conversion will round-trip.
The string() function may return wrong string representation of float numbers that cannot round-trip into the same numeric value.
This also affects implicit casts inside Print(), Alert(), Comment(), FileWrite().
The absence of 1:1 mapping will bring much uncertainty regarding the printed single-precision floating point numbers .
Therefore, what you see is NOT what you get.
This is a sample script to reproduce the bug:
And, here is a temporary solution until the bug is fixed:
This bug is also causing another strange behavior in the display of single-precision float values (input parameters) in dialogue boxes:
Compile and run this script:
That is what I got when I tried to run it: