파이썬 math.floor() 메서드
예시
숫자를 가장 가까운 정수로 내림:
# Import math library
import math
# Round numbers down to the
nearest integer
print(math.floor(0.6))
print(math.floor(1.4))
print(math.floor(5.3))
print(math.floor(-5.3))
print(math.floor(22.6))
print(math.floor(10.0))
정의 및 사용
이 math.floor()
메서드는 필요한 경우 숫자 DOWN을 가장 가까운 정수로 반올림하고 결과를 반환합니다.
팁: 숫자를 가장 가까운 정수로 반올림하려면 방법을 살펴보십시오 .
math.ceil()
통사론
math.floor(x)
매개변수 값
Parameter | Description |
---|---|
x | Required. Specifies the number to round down |
기술적 세부 사항
반환 값: | int 반올림된 숫자를 나타내는 값 |
---|---|
변경 로그: | Python 3+: 값을 반환합니다 int . Python 2.x: float 값 을 반환합니다. |