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);
vcsjones
  • 138,677
  • 31
  • 291
  • 286
Sheik_101
  • 770
  • 1
  • 8
  • 24

1 Answers1

25

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

Philippe Leybaert
  • 168,566
  • 31
  • 210
  • 223