I have a question about rounding up Osao. (Python)

Asked 1 years ago, Updated 1 years ago, 93 views

I understand that if the last digit is 5 days, the first digit is discarded if it is an even number, and if it is an odd digit, it is raised to an even number.

In that picture, I want to know why the front digit is 0.8565 instead of 0.8564.

Python3 is in use.

rounding

2022-09-21 19:32

1 Answers

We created a demo. Based on Python 3.6. I hope it's helpful.

'%0.5f % 0.85645' ==>  0.85645
'%0.5f % 0.85644' ==>  0.85644
'%0.4f % 0.85645' ==>  0.8565
'%0.4f % 0.85644' ==>  0.8564
'%0.3f % 0.85645' ==>  0.856
'%0.3f % 0.85644' ==>  0.856


2022-09-21 19:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.