I am very hesitant to put this because I know that 99.9% of the time the user is to blame for an error but I am seriously confused about this one.
I have a float named rotation defined in my header as such:
@property(nonatomic)float rotation;
After the rotation has been given a value I check it using this if statement
if (fabsf(rotation) == M_PI_2)
{
NSLog(@"Execute more code now");
}
Now I have checked the definition of M_PI_2 and came up with 1.57079632679489661923132169163975144
I noticed that it wasn't working so I put another NSLog before the if statement as such:
NSLog(@"%f == %f", fabs(rotation), M_PI_2);
These were the results I got:
2014-06-26 16:29:40.831 76J284E[82085:60b] 0.000000 == 1.570796
2014-06-26 16:29:40.834 76J284E[82085:60b] 3.141593 == 1.570796
2014-06-26 16:29:44.653 76J284E[82085:60b] 0.000000 == 1.570796
2014-06-26 16:29:44.658 76J284E[82085:60b] 3.141593 == 1.570796
2014-06-26 16:29:47.951 76J284E[82085:60b] 0.000000 == 1.570796
2014-06-26 16:29:47.953 76J284E[82085:60b] 3.141593 == 1.570796
2014-06-26 16:29:54.305 76J284E[82085:60b] 0.000000 == 1.570796
2014-06-26 16:29:54.310 76J284E[82085:60b] 1.570796 == 1.570796
2014-06-26 16:29:54.313 76J284E[82085:60b] 4.712389 == 1.570796
2014-06-26 16:29:54.318 76J284E[82085:60b] 3.141593 == 1.570796
Shouldn't a few of those trigger the if statement? What am I doing wrong here, thanks.
Edit
I should add that I am defining rotation with M_PI_2 (At certain times)