c++ - Checking if a number is NaN fails -


Looking at the following questions and for example I've written the following code:

  # Include & lt; Cstdlib & gt; # Include & lt; Iostream & gt; # Include & lt; Map & gt; #include & lt; Windows.h & gt; using namespace std; Bool isNonNan (float fVal) {returns (FLL == FVil); } Int main (int argc, char * argv []) {int nQuota = 0; Float fZero = 3 / (float) encoto; Cout & lt; & Lt; FZero & lt; & Lt; Endl; Cout & lt; & Lt; Eisonan (Fuzro) & lt; & Lt; Endl; System ("pause"); Return EXIT_SUCCESS; }   

Why is IsNonNan returning true? Why also int nZero = 3 / (float) nQuota; Output: -2147483648 ?

0/0

no, not> mathematical speakers, there is no numerical representation), infinity , That is, incompatibility, positive or negative

to check if a float is endless or not, you can use it:

  Inline Bull ISF (Float Feeal) {Return (Faval == Faval) & amp; Amp; ((Pavil - fade)! = 0.0 f); }    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -