240 / 10 = 23,9999

This is not a problem of your code, its more a problem of your understanding of floats.

Maybe this helps:

http://stackoverflow.com/questions/2100490/floating-point-inaccuracy-examples