correction:

floating point errors are only a concern when using decimal parts. float and double can perfectly hold integer values without any form of precision loss in so far as you don't try to store more integer bits than the floating point value has (implicit or explicit) enough mantissa bits.

So you can store a short in a float (24bits mantissa) and a long in a double (53 bits mantissa) and retrieve them back without rounding issues. (and actually still have room to spare)