Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone `isNan`在Objective-C中_Iphone - Fatal编程技术网

Iphone `isNan`在Objective-C中

Iphone `isNan`在Objective-C中,iphone,Iphone,Objective-C是否有类似isNan(Javascript示例)的函数?我刚刚注意到这段代码导致显示Nan%,因此我需要检测值是否为Nan,以便将其更改为0 [portefeuillePercentWaarde setText:[NSString stringWithFormat:@"%.2f%%", verschilPrencentage]]; 试着添加 #include <math.h> 投票以重复方式结束。好消息是另一个问题有你的答案:)@e.James:不是重复的:

Objective-C是否有类似isNan(Javascript示例)的函数?我刚刚注意到这段代码导致显示
Nan%
,因此我需要检测值是否为Nan,以便将其更改为0

[portefeuillePercentWaarde setText:[NSString stringWithFormat:@"%.2f%%", verschilPrencentage]];
试着添加

#include <math.h>

投票以重复方式结束。好消息是另一个问题有你的答案:)@e.James:不是重复的:你的链接是针对NSNumber的,这个问题是针对float/double的。Objective-C是针对float或double的:
isnan(verschilPrencentage)
;浮动点类型的Swift:
verschilPrencentage.isNaN
double x;

// do some operation here
x = doSomething();
if (x != x)
  printf("%g is probably NaN, it's not equal to itself\n", x);