Hexark Hexark - 9 months ago 80
Objective-C Question

ABS(A) and abs(int)

I am baffled in the difference of this two in xcode, ABS(A) and abs(int). Cant seem to find ay explanation online as well. Which should I use? I am actually working on an accelerometer. Using ABS(A) and abs(int) gives me two different values. Using abs(int) would result in an inf value at times, while ABS(A) would give me a different value but never inf. Thanks!



abs() works on int, meaning abs(-10.123) would return 10, while ABS() is a macro from NSObjCRuntime.h which returns a value whose type is the type of the argument.