* Christopher:
I am trying to calculate a number of sums a double can hold with a max
addend of x. I performed the following computation:
cout<<std::numeric_limits<double>::max()<<endl;
cout<<std::numeric_limits<double>::max() / x<<endl;
when x = 10 I got the following output:
4294967295
1.79769e+307
is the computation to find the number of computations itself overflowing?
The first result is incorrect for any implementation.
But I think it's more likely that it isn't actually the result
from the first statement shown; instead it's probably -1 assigned
to an unsigned int -- i.e. you have _not_ shown the actual code.
The second result is what you'd expect for IEEE 64-bit double.
How can I accomplish my goal?
I am trying to do this to effectivley write a test program to average the
results of a function and need to figure how many iterations to do before
division.
That makes no sense to me.
Here's one way: scale the function result down by 10^12.
Then you can do at least 10^12 additions before overflow.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?