I am using floats with some code, and I'm getting 1 # INF00, -1 . IND00 and -1 # IND When I try to print floats in the screen. What do those values mean?
I believe 1. # INF00 means positive infinity, but what about -1. #inded and -1 #industries? I also sometimes saw this value: 1. $ NaN which is not a number, but what is the reason for those strange values and how can this help me with debugging?
I am using what I believe is the float point number
Can anyone list all those invalid values and what do they mean?
From
From:
This page will answer the following questions.
- My program is just printed 1. # Inds 1. What happens on #inf (windows) or nan or ing (on linux)?
- How can I tell if a number is actually a number and neither is neither nan or eternal?
- How can I find out more about the type of NAN runtime?
- Do you have any sample code to show how it works?
- Where can I learn more?
The question is, with the exception of floating point, if you get some strange non-numerical output where you are expecting a number, then you can either limit the floating point arithmetic limit You have crossed or have asked for some results which is undefined, to keep things simple, I will stick to working with double floating point type. There are similar comments for float type.
Debugging 1. # Ind, 1. #inf, nan, and ing
If your operation can be bigger it can be stored in a double In comparison, a positive number, Operation 1. Inf in Windows on INF or Linux. Similarly, your code-1 will return. #INF or -inf If the result is too high in a negative number, then it must be stored in double by dividing a positive number from zero, a positive infinity arises, and a negative infinity arises by dividing a negative number from zero. At the end of this page, the example code will display some actions that produce irreversibly.
Some operations do not make mathematical meanings, like taking the square root of a negative number (yes, this operation is understood in terms of complex numbers, but one double represents a real number and therefore the result is There is no double to represent.) This is also true for logarithmic negative numbers. Both the sqrt (-1.0) and logs (-1.0) will not return the JNER word "NaN" for a "number", which is a "no no" window as a NAN-1 display. # Ind ("Ind" for "Uncertain"), while Linux displays Nain. Other operations which will return one NN, in 0/0, 0 *, and / ???? For example, see sample code below
In short, if you receive 1. # INF or INF, then search for overflow or division with zero. If you receive 1. # Ind or Nain, then look for illegal operations. Perhaps you are just a bug if it is more subtle and you have something that is difficult to calculate, avoid overflow, underflow and precision damage. This article provides ideas for computing results that intermediate steps are calculated directly.
Comments
Post a Comment