In this challenge: rounding numbers.
Most answers use floating point numbers, which means that many potential input values are impossible due to the limited precision.
For example, the inputs .02675
and 4
. In this challenge, that would mean rounding .02675
to 4
decimal places, which should result in .0268
.
However, 0.02675
can't be represented exactly in the common floating point formats, and it's actually stored as .02674999...
, which rounds to .0267
.
Are these answers are invalid because they can't accept all the potential input values?