Xcode 6.3 warning
Asked Answered
S

1

6

I am getting this below warning after I update the Xcode to 6.3 version.

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

Example

 CGPoint startPoint = CGPointMake(15.0f, 25.0f);
 CGPoint endPoint   = CGPointMake(10.0f, 20.0f);
 CGFloat centerDiff = abs(startPoint.y - endPoint.y);
Snack answered 21/4, 2015 at 12:52 Comment(0)
E
25

abs() expects integers. You should use fabs(value) for floating point values

Electrolyse answered 21/4, 2015 at 12:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.