Thread: Meaning of "-1.#QNAN00000"

  1. #1
    Math wizard
    Join Date
    Dec 2006
    Location
    USA
    Posts
    582

    Meaning of "-1.#QNAN00000"

    I've seen "-1.#INF" appearing as the results of a calculation (from division by zero with floating point values) indicating infinity (even though division by zero has no solution (if not 0/0, otherwise all real numbers)). This is the first time I've ever seen "-1.#QNAN0000000000" appearing as the result of a calculation and it causing my game to crash from an infinite loop. This line is triggering it, as per the debugger's line-by-line output (edited to shorten it but its otherwise the same thing):

    Code:
    XSpeed += (PlatformXSpeed[LoopCount]/960.0*(double)PlatformDelayed[LoopCount]);
    XSpeed is a double, PlatformXSpeed is also a double, LoopCount is an int (it's used to count loops - integers are a must for array references) but PlatformNodeDelayActive is an int used as a flag (it's either 0 or 1) and needs to be typecasted. I'm mainly after wanting to know what the "QNAN" means.

    Edit: Just so you know what the problem was, I referenced the wrong variable (a copy/paste mistake). The variable, LoopCount, was supposed to reference a different loop counting variable (I have 3 of them in all, for nesting loops) and I forgot to change this. As a consequence, it was referencing the array at something well into the thousands instead of being less than 1000, causing a reference to data outside the array's bounds. Where the QNAN stuff comes in, I'll have to wait for responses.
    Last edited by ulillillia; 10-09-2010 at 08:23 PM. Reason: Explained the cause better
    High elevation is the best elevation. The higher, the better the view!
    My computer: XP Pro SP3, 3.4 GHz i7-2600K CPU (OC'd to 4 GHz), 4 GB DDR3 RAM, X-Fi Platinum sound, GeForce 460, 1920x1440 resolution, 1250 GB HDD space, Visual C++ 2008 Express

  2. #2
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    Search for QNaN on this page.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Regarding the XSpeed calculation, the floating point unit is telling you Quietly that the result is Not-a-Number.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. HELP!what is the meaning of "&" ???
    By zxlew in forum C Programming
    Replies: 2
    Last Post: 01-18-2009, 03:29 AM
  2. the meaning of " >> "
    By arian in forum C++ Programming
    Replies: 8
    Last Post: 03-30-2005, 10:40 AM
  3. Greatness, and its meaning
    By axon in forum A Brief History of Cprogramming.com
    Replies: 52
    Last Post: 11-18-2004, 10:53 PM
  4. The Meaning of Life: A Trick Question?
    By chix/w/guns in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 07-12-2004, 07:53 PM
  5. would you help me with Linked list, please?
    By unhwan in forum C Programming
    Replies: 1
    Last Post: 06-11-2002, 12:24 AM

Tags for this Thread