Context
R's help()
function indicates that round()
adheres to a standard that is identical to IEEE 754: round halves to even.
Wikipedia describes this standard with the following example: 23.5 becomes 24 and 24.5 becomes 24.
help()
also states, ...this is dependent on OS services and on representation error.
Experiment
System details
- R version: 3.6.2 (2019-12-12)
- Arch / OS: x86_64, darwin18.7.0 (MacOS)
On my machine, I see that
round(0.55, digits = 1) # [1] 0.6
round(1.55, digits = 1) # [1] 1.6
round(2.55, digits = 1) # [1] 2.5
round(3.55, digits = 1) # [1] 3.5
Question
Should I attribute the discrepancy between the first two and second two statements as errant OS services and or representation error?