gooly: How do I check if a sum or an other calculation exceeds the highest possible double
A sum can NOT exceed highest possible value BY DEFINITION. Since you can't compute first and then check you must reverse the test:
double MaxDoub = 1.79*MathPow(10,308); // Truncate to prevent rounding problem. bool chckMax( double x,double y){ return(MaxDoub/x < y); // if 10/3 < 4 then 10 < 3 * 4 }
I don't know why you even have the question.
WHRoeder:
A sum can NOT exceed highest possible value BY DEFINITION. Since you can't compute first and then check you must reverse the test:
I don't know why you even have the question.
Ouch, could have thought of that myself: reverse the test.
I need that to be safe for a simplified calc. of the standard deviation, where I have to sum up the square of the new value.
Anyway, thanks a lot,
Gooly
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
Hi
How do I check if a sum or an other calculation exceeds the highest possible double (see https://www.mql5.com/en/forum/140395/page2)
I'd like to do
I guess that it'll cause an Error. But how do I catch that without risking the run of the program?
Thanks in advance,
Gooy