-1.#IND

I have some code that will allow me to draw a crescent moon shape, and have extracted the values to excel to be drawn. However in place of some numbers, there is '-1.#IND' in place. Firstly if anyone could explain what this means, as google came back with 0 links. And secondly if there is anyway to stop it from occuring. Thank you
In MS Excel, "-1.#IND is a NaN (Not a Number) value used to identify an undefined value."

I think you can get this value if you do a division by zero. There might be other ways to get it, but that's probably the most common.
> explain what this means

See: http://en.wikipedia.org/wiki/NaN

With floating point, NaN (eg. 0.0/0.0 or square root of a negative number), infinity ( eg. result of the division of a non-zero value by zero), overflow (which may result in infinity), and underflow (which may result in a subnormal value) are all possibilities which have to be taken care of programmatically.

For example, anything can happen if we use the non-predicate version of std::sort() on a sequence of floating point values containing NaNs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include <cmath>
#include <limits>

void classify( double value )
{
   std::cout << "  infinite? " << std::isinf(value)
             << "  NaN? " << std::isnan(value)
             << "  normal? " << std::isnormal(value) << '\n' ;
}

#define CLASSIFY(a) {  \
                       std::cout << #a << ": " << std::boolalpha ; \
                       classify(a) ; \
                    }
int main()
{
   const double zero = 0.0, ten = 10.0,
                MAX_VAL = std::numeric_limits<double>::max(),
                MIN_VAL = std::numeric_limits<double>::min() ;
   
   CLASSIFY( ten ) ; // normal
   CLASSIFY( MAX_VAL ) ; // normal
   CLASSIFY( MIN_VAL ) ; // normal
   CLASSIFY( std::sqrt(ten) ) ; // normal
   CLASSIFY( std::sqrt(MIN_VAL) ) ; // normal
   
   CLASSIFY( HUGE_VAL ) ; // overflow 
   CLASSIFY( INFINITY ) ; // infinity
   CLASSIFY( NAN ) ; // not a number
   
   CLASSIFY( MAX_VAL / MIN_VAL ) ; // overflow 
   CLASSIFY( MIN_VAL / MAX_VAL ) ; // subnormal 
   CLASSIFY( ten / zero ) ; // division by zero => infinity
   CLASSIFY( zero / zero ) ; // not a number
   CLASSIFY( std::sqrt(-1.0) ) ; // not a number
}


http://liveworkspace.org/code/ms4af$0
google came back with 0 links


A little bit of creativity goes a long way:

http://lmgtfy.com/?q=%22-1.%23IND%22
Topic archived. No new replies allowed.