• 회원가입
  • 로그인
  • 구글아이디로 로그인

[module] Python - math.ceil() 메서드 ★ - 천장 반올림 (= 상위 정수로 반올림. = ceil메서드 = 실메서드)

1992  

목차

  1. math.ceil() 예제 - 상위 정수로 반올림.
  2. math.ceil() 정의
  3. math.ceil() 구문

 

math.ceil() 예제 - 상위 정수로 반올림.

 

import math

print(math.ceil(1.3)) # 2

print(math.ceil(5.2)) # 6

print(math.ceil(-5.2)) # -5

print(math.ceil(10.6)) # 11 

print(math.ceil(10.0)) # 10

 

 

math.ceil() 정의

 

가장 가까운 상위 정수로 반올림.

※ Python 버전별로 반환값 자료형 다름.

 


cf.

math.floor() : 가장 가까운 하위 정수로 반올림.

round() : 일반적인 반올림.

 


math.ceil() 구문

 

math.ceil(x)

 


[매개변수]

 

x

필수. 반올림 할 숫자.

 


[반환값]

 

Python 3.X 버전 : int 자료형의 반올림 된 숫자.

Python 2.X 버전 : float 자료형의 반올림 된 숫자.

 



분류 제목
module Python - statistics.stdev() 메서드 -
module Python - statistics.pvariance() 메서드 -
module Python - statistics.variance() 메서드 -
module Python - math 모듈 메서드・상수 종류 (※ 수학 모듈)
module Python - math.acos() 메서드 -
module Python - math.acosh() 메서드 -
module Python - math.asin() 메서드 -
module Python - math.asinh() 메서드 -
module Python - math.atan() 메서드 -
module Python - math.atan2() 메서드 -
module Python - math.atanh() 메서드 -
module Python - math.ceil() 메서드 ★ - 천장 반올림 (= 상위 정수로 반올림. = ceil메서드…
module Python - math.comb() 메서드 -
module Python - math.copysign() 메서드 -
module Python - math.cos() 메서드 -
module Python - math.cosh() 메서드 -
module Python - math.degrees() 메서드 -
module Python - math.dist() 메서드 -
module Python - math.erf() 메서드 -
module Python - math.erfc() 메서드 -
3/7
목록
찾아주셔서 감사합니다. Since 2012