Fix test floating point arithmetic issues