fix rounding of floats

Not exactly pretty, but should do the job (rounding requires so much
special cases... ugh - or maybe there is an elegant solution?!).
I've also added some tests to check for regressions.