Does rounding rules for .5 applies also for .05, .005 etc? I couldn't figure out why rounding for 45.445 and 73.445 differ.
> round(45.445,2)
[1] 45.45
> round(73.445,2)
[1] 73.44
Does rounding rules for .5 applies also for .05, .005 etc? I couldn't figure out why rounding for 45.445 and 73.445 differ.
> round(45.445,2)
[1] 45.45
> round(73.445,2)
[1] 73.44
The double numbers are not represented exactly and round
uses the represented number.
sprintf("%.20f", 45.445)
#[1] "45.44500000000000028422"
sprintf("%.20f", 73.445)
#[1] "73.44499999999999317879"