Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > faq 1.#QNAN00000000 and -1.#IND000000000

Reply
Thread Tools

faq 1.#QNAN00000000 and -1.#IND000000000

 
 
fcvcnet
Guest
Posts: n/a
 
      11-01-2006
Hi,
I got result 1.#QNAN00000000 and -1.#IND000000000 in my programme, what
happened?
why?
Thanks.


 
Reply With Quote
 
 
 
 
Kavya
Guest
Posts: n/a
 
      11-01-2006

fcvcnet wrote:
> Hi,
> I got result 1.#QNAN00000000 and -1.#IND000000000 in my programme, what
> happened?
> why?


If you can post your code then it might be more easy to find the
problem.

 
Reply With Quote
 
 
 
 
Jim Langston
Guest
Posts: n/a
 
      11-01-2006
"fcvcnet" <(E-Mail Removed)> wrote in message
news:ei9ndm$5lf$(E-Mail Removed)99.com...
> Hi,
> I got result 1.#QNAN00000000 and -1.#IND000000000 in my programme, what
> happened?
> why?
> Thanks.


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.


 
Reply With Quote
 
Marcus Kwok
Guest
Posts: n/a
 
      11-01-2006
Jim Langston <(E-Mail Removed)> wrote:
> "fcvcnet" <(E-Mail Removed)> wrote in message
> news:ei9ndm$5lf$(E-Mail Removed)99.com...
>> Hi,
>> I got result 1.#QNAN00000000 and -1.#IND000000000 in my programme, what
>> happened?
>> why?
>> Thanks.

>
> 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.


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

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
 
Reply With Quote
 
Geo
Guest
Posts: n/a
 
      11-01-2006

fcvcnet wrote:
> Hi,
> I got result 1.#QNAN00000000 and -1.#IND000000000 in my programme, what
> happened?
> why?
> Thanks.


recently I had to do some experimentation with this stuff, here's some
code and the output


float pinf = std::numeric_limits<float>::infinity();
double dpinf = std::numeric_limits<double>::infinity();

float ninf = -std::numeric_limits<float>::infinity();
float zero = 0.0;
float NaN = std::numeric_limits<float>::quiet_NaN();
float nNaN = -std::numeric_limits<float>::quiet_NaN();
double dNaN = std::numeric_limits<double>::quiet_NaN();

float xNaN = static_cast<float>(dNaN);

std::cout << "+ve infinity " << pinf << "\n";
std::cout << "-ve infinity " << ninf << "\n";
std::cout << "+ve QNAN " << NaN << "\n";
std::cout << "+ve dQNAN " << dNaN << "\n";
std::cout << "+ve xQNAN " << xNaN << "\n";
std::cout << "-ve QNAN " << nNaN << "\n";
std::cout << "+inf = +inf " << (pinf == pinf) << "\n";
std::cout << "+inf <= +inf " << (pinf <= pinf) << "\n";
std::cout << "+inf = +dinf " << (pinf == dpinf) << "\n";
std::cout << "+inf = -inf " << (pinf == ninf) << "\n";
std::cout << "+inf / +inf " << pinf/pinf << "\n";
std::cout << "+inf / -inf " << pinf/ninf << "\n";
std::cout << "+inf / zero " << pinf/zero << "\n";
std::cout << "+inf * -inf " << pinf*ninf << "\n";
std::cout << "+inf + -inf " << pinf+ninf << "\n";
std::cout << "+inf + +inf " << pinf+pinf << "\n";
std::cout << "+inf - -inf " << pinf-ninf << "\n";
std::cout << "+inf - +inf " << pinf-pinf << "\n";
std::cout << "-inf - -inf " << ninf-ninf << "\n";
std::cout << "\n\n";
std::cout << "NaN = NaN " << (NaN == NaN) << "\n";
std::cout << "-NaN = -NaN " << (nNaN == nNaN) << "\n";
std::cout << "-NaN = NaN " << (nNaN == NaN) << "\n";
std::cout << "NaN = -NaN " << (NaN == nNaN) << "\n";
std::cout << "NaN = +inf " << (NaN == pinf) << "\n";
std::cout << "NaN = -inf " << (NaN == ninf) << "\n";
std::cout << "0 / zero " << 0/zero << "\n";

+ve infinity 1.#INF
-ve infinity -1.#INF
+ve QNAN 1.#QNAN
+ve dQNAN 1.#QNAN
+ve xQNAN 1.#QNAN
-ve QNAN -1.#IND
+inf = +inf 1
+inf <= +inf 1
+inf = +dinf 1
+inf = -inf 0
+inf / +inf -1.#IND
+inf / -inf -1.#IND
+inf / zero 1.#INF
+inf * -inf -1.#INF
+inf + -inf -1.#IND
+inf + +inf 1.#INF
+inf - -inf 1.#INF
+inf - +inf -1.#IND
-inf - -inf -1.#IND


NaN = NaN 0
-NaN = -NaN 0
-NaN = NaN 0
NaN = -NaN 0
NaN = +inf 0
NaN = -inf 0
0 / zero -1.#IND

 
Reply With Quote
 
Geo
Guest
Posts: n/a
 
      11-01-2006
Meant to say, results are from gcc on pentium, and seem to agree with
IEEE 754. VC 6.0 results differ for some cases, VC 7.0 is the same as
gcc.

 
Reply With Quote
 
fcvcnet
Guest
Posts: n/a
 
      11-02-2006
Thanks you very much.

"Geo" <(E-Mail Removed)>
??????:(E-Mail Removed) ups.com...
> Meant to say, results are from gcc on pentium, and seem to agree with
> IEEE 754. VC 6.0 results differ for some cases, VC 7.0 is the same as
> gcc.
>



 
Reply With Quote
 
fcvcnet
Guest
Posts: n/a
 
      11-02-2006
Thanks you very much.
"Marcus Kwok" <(E-Mail Removed)> 写入消息新闻:eiagra$8dp$(E-Mail Removed)...
> Jim Langston <(E-Mail Removed)> wrote:
>> "fcvcnet" <(E-Mail Removed)> wrote in message
>> news:ei9ndm$5lf$(E-Mail Removed)99.com...
>>> Hi,
>>> I got result 1.#QNAN00000000 and -1.#IND000000000 in my programme,
>>> what
>>> happened?
>>> why?
>>> Thanks.

>>
>> 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.

>
> 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
>
> --
> Marcus Kwok
> Replace 'invalid' with 'net' to reply



 
Reply With Quote
 
fcvcnet
Guest
Posts: n/a
 
      11-02-2006
Thanks you very much.

"Jim Langston" <(E-Mail Removed)> 写入消息新闻:Cz_1h.69$(E-Mail Removed)...
> "fcvcnet" <(E-Mail Removed)> wrote in message
> news:ei9ndm$5lf$(E-Mail Removed)99.com...
>> Hi,
>> I got result 1.#QNAN00000000 and -1.#IND000000000 in my programme,
>> what happened?
>> why?
>> Thanks.

>
> 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.
>



 
Reply With Quote
 
fcvcnet
Guest
Posts: n/a
 
      11-02-2006
Marcus Kwok
Thanks you very much.
your url
http://mathworld.wolfram.com/Indeterminate.html

is very useful!
Thanks again!


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Eskimo.com, and hence C FAQ and Steve Summit, offline dj3vande@csclub.uwaterloo.ca.invalid C Programming 1 11-13-2009 09:57 PM
FAQ or not FAQ? =?ISO-8859-15?Q?Juli=E1n?= Albo C++ 28 01-15-2007 04:33 AM
FAQ/FAQ notes site makeover Peter Michaux Javascript 22 11-27-2006 01:55 AM
FAQ - How do I direct someone to this FAQ? FAQ server Javascript 1 08-04-2006 10:13 PM
[de] Update of FAQ in German/FAQ auf Deutsch ueberarbeitet Josef 'Jupp' Schugt Ruby 0 09-22-2003 08:56 PM



Advertisments