I am trying to use the fmod function but I am not getting the results I am expecting.
It actually returns 9.299999999999994 due to floating point imprecision. Neither 55.8 or 9.3 can be exactly represented as a base 2 floating point number.
It's a very common problem. One good reference is What Every Computer Scientist Should Know About Floating-Point Arithmetic.