I often get Nan in as3, but I always think that C ++ is of a weak type. I only need the memory. In addition, I usually have a lot of dealings with uint32,
Today, we will step on the trap. A crash is generated when the value is-Nan (0x400000.
Google gains the following:
Http://stackoverflow.com/questions/570669/checking-if-a-double-or-float-is-nan-in-c
For a float F, F! = F will be true only if f is Nan.
For float type variables F, F! = F is valid only when F is Nan.
It seems that it is necessary to determine whether float is a valid value. f = f
ViewCode:
# Include <stdio. h>
Int main (){
Unsigned int I = 0x400000;
Float F = 0.0f;
Printf ("{f: % F, I: % u} \ n", F, I );
* (Unsigned int *) & F) = I;
Printf ("{f: % F, I: % u} \ n", F, I );
F = 0.0f/0.0f;
If (F! = F)
Printf ("F! = F, % F, % u \ n ", F, * (unsigned int *) & F ));
If (F> 0.0f | f = 0.0f | F <0.0f)
Printf ("F> 0.0f | f = 0.0f | F <0.0f) \ n ");
Else
Printf ("cool! \ N ");
Return 0;
}
It turns out that fish are not fish.