F
Fabian Wein
Hi,
I had one case, where gcc 4.1.0 on an opteron gave 0.0 in case of an
division by 0. I wrote an simple example where I get now inf.
When i do a square-root of a negative number via pow() I get nan.
Now my question is, is there a way that in such cases exceptions are
thrown? At least for the function call this would be nice!
Thanks a lot,
Fabian
double x = 62.5e-6;
double t = x / 0.0;
std::cout << x << " divided by 0.0 = " << t << std::endl;
// -> 6.25e-05 divided by 0.0 = inf
double p = pow(-0.0003, 0.5);
std::cout << "pow = " << p << std::endl;
// -> pow = nan
I had one case, where gcc 4.1.0 on an opteron gave 0.0 in case of an
division by 0. I wrote an simple example where I get now inf.
When i do a square-root of a negative number via pow() I get nan.
Now my question is, is there a way that in such cases exceptions are
thrown? At least for the function call this would be nice!
Thanks a lot,
Fabian
double x = 62.5e-6;
double t = x / 0.0;
std::cout << x << " divided by 0.0 = " << t << std::endl;
// -> 6.25e-05 divided by 0.0 = inf
double p = pow(-0.0003, 0.5);
std::cout << "pow = " << p << std::endl;
// -> pow = nan