F
fcvcnet
Hi,
I got result 1.#QNAN00000000 and -1.#IND000000000 in my programme, what
happened?
why?
Thanks.
I got result 1.#QNAN00000000 and -1.#IND000000000 in my programme, what
happened?
why?
Thanks.
fcvcnet said:Hi,
I got result 1.#QNAN00000000 and -1.#IND000000000 in my programme, what
happened?
why?
fcvcnet said:Hi,
I got result 1.#QNAN00000000 and -1.#IND000000000 in my programme, what
happened?
why?
Thanks.
Jim Langston said:NAN is not a number. This can happen with a floating point math won't work.
In some cases dividing by 0 will produce a NAN, but in others it produces
infinity (not sure if the specs say whiat it should produce).
Not sure what IND is. It may be infinity, but I would think that would be
INF, so I'm not sure.
fcvcnet said:Hi,
I got result 1.#QNAN00000000 and -1.#IND000000000 in my programme, what
happened?
why?
Thanks.
Marcus Kwok said:I'm not sure either, but IND might mean "indeterminate". As in,
(informally) 1/0 is infinity but 0/0 is indeterminate.
http://mathworld.wolfram.com/Indeterminate.html
Jim Langston said:NAN is not a number. This can happen with a floating point math won't
work. In some cases dividing by 0 will produce a NAN, but in others it
produces infinity (not sure if the specs say whiat it should produce).
Not sure what IND is. It may be infinity, but I would think that would be
INF, so I'm not sure.
cts said:Odd that no one seems to have brought up errno.
When something in the C libraries, like the math library, fails, the
global variable errno is set. If you get a value of #QNAN or #IND,
it's likely that an error in the standard math library. You can easily
check this after an operation and you can get a nice string
representation of the error message too.
example:
#include <cmath>
#include <cstring>
#include <iostream>
errno = 0; // clear out any previous errors
// example math call
y = std::atan(x); // we suspect that something screwy happens here,
maybe 'x' is a bad value
// check if there was a catastrophe, if yes, print out the error
message
if (errno)
std::cout << strerror(errno) << std::endl;
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.