isnan isinf

在linux下有两个函数

isnan(x)  isinf(x)

对应在windows下的函数:

 _isnan(x) !_finite(x)

为了跨平台,要么用boost要么这样写:

int isnan(double x) { return x != x; } int isinf(double x) { return !isnan(x) && isnan(x - x); }
int iserr(double x) {return isnan(x)||isinf(x);}
http://stackoverflow.com/questions/2249110/how-do-i-make-a-portable-isnan-isinf-function

你可能感兴趣的:(windows,linux,跨平台)