taking absolute value of CGFloat
Use fabs() CGFloat f = -123.4f; CGFloat g = fabs(f); CGFloat is defined as a double on 64-bit machines, and float on 32-bit machines. If you are targeting both 64 and 32 bit than this answer gets more complicated, but is still correct. You want to use fabs() because it works on double datatypes which … Read more