What do 1.#INF00, -1.#IND00 and -1.#IND mean?

I'm messing around with some C code using floats, and I'm getting 1.#INF00, -1.#IND00 and -1.#IND when I try to print floats in the screen. What does those values mean?

I believe that 1.#INF00 means positive infinity, but what about -1.#IND00 and -1.#IND? I also saw sometimes this value: 1.$NaN which is Not a Number, but what causes those strange values and how can those help me with debugging?

I'm using MinGW which I believe uses IEEE 754 representation for float point numbers.

Can someone list all those invalid values and what they mean?

Well, I have a problems with a specific C code. I'm dealing with solving a task without using any "refined" coding, that is, doing regular stuff with the simplest of the libraries and functions.

For anyone wondering about the difference between -1.#IND00 and -1.#IND (which the question specifically asked, and none of the answers address):

-1.#IND00

This specifically means a non-zero number divided by zero, e.g. 3.14 / 0 (source)

-1.#IND (a synonym for NaN)

This means one of four things (see wiki from source):

1) sqrt or log of a negative number

2) operations where both variables are 0 or infinity, e.g. 0 / 0

3) operations where at least one variable is already NaN, e.g. NaN * 5

4) out of range trig, e.g. arcsin(2)

Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Learn more Time taken to execute a function shows 1.#INF00

For those of you in a .NET environment the following can be a handy way to filter non-numbers out (this example is in VB.NET, but it's probably similar in C#):

If Double.IsNaN(MyVariableName) Then
    MyVariableName = 0 ' Or whatever you want to do here to "correct" the situation
End If

If you try to use a variable that has a NaN value you will get the following error:

Value was either too large or too small for a Decimal.

5 Res: 2622.030000: Sum: 5 Res: 524.406000: Arithmetic mean: 5 Res: 1#INF00: Geometric mean: 5 Res: 1#INF00: Standard deviation

Your question "what are they" is already answered above.

As far as debugging (your second question) though, and in developing libraries where you want to check for special input values, you may find the following functions useful in Windows C++:

_isnan(), _isfinite(), and _fpclass()

On Linux/Unix you should find isnan(), isfinite(), isnormal(), isinf(), fpclassify() useful (and you may need to link with libm by using the compiler flag -lm).

Hi, I'm a beginner at c++, and really stupid at it. I have so many questions about this file, tried my best to google answers but still really can't figure them out by myself. Please, if you can help me! The following code kinda works, and it produce a '.txt' file. However, there are several numbers in '.txt ' being ' 1.

Unfortunately, code REDs are sometimes virtually unavoidable in ordinal-threshold models (it has to do with the limited precision of the approximation to the multivariate-normal integral). It would seem that the problems you were encountering initially were due to a bug that has been corrected since the release of the third beta.

and other trick is using if condition i mean if utilisateur use 0 show message say that we can't division par zero but if you don't mind me asking, my professor say that there is an assembleur function in dev c++ can change that message so i am looking for it.

An extent is the minimum bounding box/rectangle (xmin, ymin and xmax, ymax) defined by coordinate pairs of a data source. All coordinates for the data source fall within this boundary.

Comments
  • It is the way the Microsoft C runtime library formats Infinity and NaN floating point values. MinGW does not have its own CRT, it uses the OS supplied msvcrt.dll. The exact way it looks depends on the printf() format specifier you used, thus the extra zeros, it can even turn into 1.#J. The C99 standard sets the expected output, adopted in VS2015, so this quirk is going to disappear.
  • I know the OP didn't really ask for this, but as a handy test, myfloat == myfloat will return false if you have one of these magic values.
  • @tenpn Actually in C++, +infinity==+infinity. Try checking 1.0 / 0.0: 1.#INF00 == 1.#INF00 returns true, -1.#INF00 == -1.#INF00 returns true, but 1.#INF00 == -1.#INF00 is false.
  • Not sure about other configurations, but on Windows 7 / Visual studio 2010. float nan = sqrtf(-1.0f); nan == nan; // evaluates to true... in contrary to what tenpn said.. (Comment By Yevgen V)
  • If you can use C++11 have a look at std::isfinite() and the like. If you can use Boost you're lucky as well
  • @Jeff that's likely related to optimization. See the relevant docs page.
  • This doesn't detect 1.#INF. You also need to use Double.IsInfinity(MyVariableName) to check for +/- infinity.