Reputation: 43
I setup my UILabel alpha property to 0.65 using Attributes Inspector but after compiling it is 0.64999976158142 anybody knows why ?
Have seen sometimes constraints, width or height values do the same going from something like 24 to 23.5.
Upvotes: 0
Views: 66
Reputation: 59
Computers use a format, binary floating-point, that cannot accurately represent a number like 0.65.
Probably, when the code is compiled, your “0.65” is already rounded to the nearest number in that format, which results in a small rounding error.
Upvotes: 2