1

Simply that, it's just that when I put:

float f;
if(f%1){
//do something
//

It returns an error, is there a way to do modulo on float types or i have to do a conversion? I am using xCode IDE and the Objective-C language

raej99
  • 85
  • 5

2 Answers2

5

Yes, use fmod:

double f = 2.5;
double g = fmod (f, 2.0); // => g = 0.5
Paul R
  • 208,748
  • 37
  • 389
  • 560
0

% is for integers. Try using fmod().

Jimmy Xiao
  • 156
  • 5