round(1.5)
round(2.5)
round(3.5)
round(4.5)
round(5.5)
round(6.5)
The results of the respective
2
2
4
4
6
6
It's coming out. I thought it was a function of rounding off I wonder why the results are coming out like this. Shouldn't 2, 3, 4, 5, 6 7 come out?
Note> Run your answers at http://tryhelloworld.co.kr/questions/1087 and move them to your own answers.
python round
Looking at the Python document, it says .
Note The behavior of round() for floats can be surprising: for example, round(2.675, 2) gives 2.67 instead of the expected 2.68. This is not a bug: it’s a result of the fact that most decimal fractions can’t be represented exactly as a float. See Floating Point Arithmetic: Issues and Limitations for more information.
If you interpret it, you round 2.675 to the second decimal place and you get 2.67. This is a problem that arises because it is difficult to accurately represent decimal numbers. It's not a bug.
That's what it says.
554 Uncaught (inpromise) Error on Electron: An object could not be cloned
555 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
557 PHP ssh2_scp_send fails to send files as intended
777 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.