how to calculate the float reminder for the two float values

floating-point, objective-c

Solution

In C , C++ and Objective-C that would be `fmod`.

Problem

I have two float values, 'a' and 'b' . I need to calculate the reminder of these two float values, and it must be a float value. Let ``` float a = 1.1; float b = 0.5; ``` So the remainder 'r' should be accurate value i.e. r = a % b r = 1.1 % 0.5 ``` 0.5) 1.1 (2 1.0 ______ 0.1 r = 0.1 ``` But it causes to an error invalid operand for float values. How to do it?

Original source