MQL4 StringToDouble alters the value of the variable?
MQL4 StringToDouble alters the value of the variable?
Loading saved threads...
skeptic23 · External communityPost link
External question — Stack Overflow Stack Exchange
Author: skeptic23
Original post: https://stackoverflow.com/questions/62959865
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
MQL4 documentation states that the value limits for double type variables is:
"Minimal Positive Value" = 2.2250738585072014e-308
"Maximum Value" = 1.7976931348623158e+308
See
https://docs.mql4.com/basis/types/double
Why does
StringToDouble()
alter the value converted?
Am I doing one thing while expecting a different result?
void OnStart() {
string s1 = "5554535251504900090807060504030201";
double d1 = StringToDouble(s1);
string s2 = DoubleToString(d1);
Print("s2<",s2,">");
printf("%099.8f",d1);
Print("s1<",s1,">");
return;<br>
}
Here's what I get when I run that code:
s1<5554535251504900090807060504030201>
d1<000000000000000000000000000000000000000000000000000000005554535251504899684469244159852544.00000000>
s2<5554535251504899684469244159852544>
5554535251504900090807060504030201
amounts to
5.55454E+33
.
Obviously, that doesn't even come remotely close to the
1.7976931348623158e+308
limit.
What am I missing here?
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Stack Overflow Stack Exchange Author: skeptic23 Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/questions/62959865 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. MQL4 documentation states that the value limits for double type variables is: "Minimal Positive Value" = 2.2250738585072014e-308 "Maximum Value" = 1.7976931348623158e+308 See https://docs.mql4.com/basis/types/double Why does StringToDouble() alter the value converted? Am I doing one thing while expecting a different result? void OnStart() { string s1 = "5554535251504900090807060504030201"; double d1 = StringToDouble(s1); string s2 = DoubleToString(d1); Print("s2<",s2,">"); printf("%099.8f",d1); Print("s1<",s1,">"); return;<br> } Here's what I get when I run that code: s1<5554535251504900090807060504030201> d1<000000000000000000000000000000000000000000000000000000005554535251504899684469244159852544.00000000> s2<5554535251504899684469244159852544> 5554535251504900090807060504030201 amounts to 5.55454E+33 . Obviously, that doesn't even come remotely close to the 1.7976931348623158e+308 limit. What am I missing here?
Checking account access…