'PHP fmod returns the dividend not remainder

This returns 50727.64 instead of the expected 0.489

fmod((float)50727.64, (float)103680);

Is this because the normal division only returns a decimal?

This code is for a formula to calculate full containers and any partials but appears to not work if the container would be only 1 partial container. In this example, the 103680 is the container size and 50727.64 is the contents. The contents may be any amount above 0 to fill in any number of containers.

Is there another way to extract just the remainder.

I know I can check if the dividend is smaller than the divisor and just use that result of regular division but it seems pointless to add the extra code and check.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source