Objective c 如何获得最大int值?

Objective c 如何获得最大int值?,objective-c,int,floor,ceil,Objective C,Int,Floor,Ceil,大家好,我有以下代码: (int)index double result=((double)index*0.5); DebugLog(@"result %f", result); -- GIVES ME 0.00 DebugLog(@"result %f", floor(result)); ALSO GIVES ME 0.00 double result=ceil(((double)index*0.5)); DebugLog(@"result %f", result); ---- 0.000

大家好,我有以下代码:

(int)index

double result=((double)index*0.5);
DebugLog(@"result %f", result); -- GIVES ME 0.00
DebugLog(@"result %f", floor(result)); ALSO GIVES ME 0.00

double result=ceil(((double)index*0.5));
DebugLog(@"result %f", result); ---- 0.000

我需要得到0.5的结果,在做地板时得到1。有什么帮助吗?

索引的值是多少?零?index=1,result 0.500000 result 0.000000 result 1.000000检查类型和各自的范围对于index=1,我得到结果0.500000 result 0.000000 result 1.000000很好,我也得到了。也许我早一点就搞错了。