2

is there any equivalent function for fmod() in android?

--- in c++ : ----

double fmod(double x, double y)
float fmodf(float x, float y)

The fmod functions compute the floating-point remainder of dividing x by y.

The return value is x - n y, where n is the quotient of x / y, rounded to the first integer towards zero.

Dan Methad
  • 217
  • 2
  • 6
  • 17

1 Answers1

1

The modulus operator, %, actually supports both floats and doubles in Java.

And as harism commented, there is the Math.IEEEremainder(double f1, double f2) function for doubles if you prefer.

http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Math.html#IEEEremainder(double, double)

Ryan
  • 672
  • 8
  • 15