Xcode 6.3 警告

Xcode 6.3 warning

我将 Xcode 更新到 6.3 版本后收到以下警告。

Using integer absolute value function 'abs' when argument is of floating point type

示例

 CGPoint startPoint = CGPointMake(15.0f, 25.0f);
 CGPoint endPoint   = CGPointMake(10.0f, 20.0f);
 CGFloat centerDiff = abs(startPoint.y - endPoint.y);

abs() 需要整数。您应该使用 fabs(value) 作为浮点值