Fixed case err=0
Simplified rounding code