-
[python] round 는 당신이 알고 있는 반올림이 아닙니다실수모음 2023. 1. 14. 04:35
https://stackoverflow.com/questions/33019698/how-to-properly-round-up-half-float-numbers
How to properly round-up half float numbers?
I am facing a strange behavior of the round() function: for i in range(1, 15, 2): n = i / 2 print(n, "=>", round(n)) This code prints: 0.5 => 0 1.5 => 2 2.5 => 2 3.5 => 4 ...
stackoverflow.com
다음과 같이 쓰자
'실수모음' 카테고리의 다른 글
1차원 dp를 사용할 땐, 중복 갱신에 주의해야 함(경우에 따라 역순으로 갱신할것) (0) 2023.08.28 코딩 할 때가 아닌 것 같은데?? (0) 2023.03.03 [c++] cin 실패 (0) 2022.12.26 [c++] dp 캐싱할때 절대 나오지 않는걸로 초기화해야함 (0) 2022.12.23 [c++] 실수 & 코너케이스(수정 24.03.26.) (1) 2022.12.22