New MetaTrader 5 Platform Build 5260: Enhancements in Algo Forge, extended OpenBLAS support, and new inheritance rules in MQL5 - page 9
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
Execuse me Alain, 0.30000000000000004 is the actual return value from RYU library. It is consistent with the Expert log output.
No idea what is this library you are using. Here is the one from the RYU algorithm creator https://github.com/ulfjack/ryu, see also this paper https://www.researchgate.net/publication/329410883_Ryu_fast_float-to-string_conversion
I don't see what the Expert log has to do here. 0.3 is the correct RYU value, that's it.
You can test yourself:
I don't have the souce code. Ilyas can confirm the issue.
Here, the shortest string may have 1,2,.. up to 17 significant digits. RYU only picks the shortest string that round-trips (when converted back to a floating-point ...)
That's wrong, I posted the correct RYU definition previously : "the shortest, correct decimal representation that..." round-trips.
C++ code.
The MQL 5 Print() uses the RYU algorithm since build 3210.
No it's not, it's round-trips (fixed at you request).
I think you are mixing RYU algorithm and Round-trips ?
Forum on trading, automated trading systems and testing trading strategies
C++ code.
I corrected your code to x = 0.1 + 0.2, the same as I posted before:
output:
C++17 RYU: 0.30000000000000004
I corrected your code to x = 0.1 + 0.2, the same as I posted before:
output:
C++17 RYU: 0.30000000000000004
Got it, I add missed that point and was focused on x = 0.3
Thank you for your message.
In the tooltip all integers type were interpreted as ulong.
I changed this behaviour, all integer type values will cast to the nearest unsigned type (special 1 bit integer type for bool) before output to the tooltip
Also for a double type values "%.16g" will be used instead of "%.15g" for the tooltip
The watchlist uses RYU for a double type values (IMHO it is fastest and precize algorithm)
Got it, I had missed that point and was focused on x = 0.3
by the way, the link you posted on SO https://stackoverflow.com/questions/65810673/format-a-double-without-losing-precision-but-with-a-minimum-number-of-digits typically describes the situation that a developper faces when converting double -> string.
Also this lecture from microsoft https://www.youtube.com/watch?v=4P_kbF0EbZM explains the concept of "shortest round-trip conversion".
by the way, the link you posted on SO https://stackoverflow.com/questions/65810673/format-a-double-without-losing-precision-but-with-a-minimum-number-of-digits typically describes the situation that a developper faces when converting double -> string.
Also this lecture from microsoft https://www.youtube.com/watch?v=4P_kbF0EbZM explains the concept of "shortest round-trip conversion".
Actually when I convert 0.3 or 0.1+0.2 to a string, I was expecting (and still expect) to see 0.3 in both case. I don't care about all these decimals (as a string in a log or in the Watchlist), that's also what confused me about RYU. If I need to see the decimals I can use a format to get them.
Anyway...
Actually when I convert 0.3 or 0.1+0.2 to a string, I was expecting (and still expect) to see 0.3 in both case. I don't care about all these decimals (as a string in a log or in the Watchlist), that's also what confused me about RYU. If I need to see the decimals I can use a format to get them.
Anyway...
Different people have different needs, but from the noticeable drop in forum posts complaining about vague floating-point inaccuracies, I’m confident that switching Print(), Alert() and string() to use RYU for doubles since build 3120 was the right move.