I have two CGFloat values, and want to calculate the modulo result. Or in other words: I want to know what's left if valueA is placed as much as possible into valueB.
So I just tried:
CGFloat moduloResult = valueB % valueA;
the compiler complains about the % and tells me: "invalid operands to binary %". Any idea?
Best Answer
% is for
int
orlong
, notfloat
ordouble
.You can use
fmod()
orfmodf()
from<math.h>
instead.Better is
<tgmath.h>
as suggested by the inventor of CGFloat.