I tried
printf "%.3f\n" 2.555500000000000104805053
printf "%.3f\n" 2.555500000000000104805054
the result was
2.555
2.556
same with printf "%.3f\n" 3.555500000000000104805053
But 0.555500..., 1., 4., 5., 6., 7., 8., 9. are correct -> x.556
What is the problem with rounding with printf?
- MacOS Ventura 13.2
- The shell is zsh 5.8.1 (x86_64-apple-darwin22.0), but it appears also in bash-3.2
- In ksh (shell) the output is identical (2.556) with both commands