파이썬[Python]: decimal - compare_signal 메서드
decimal 모듈 - compare_signal 메서드(method)
/// 설명
두 Decimal 인스턴스의 값을 비교합니다. 둘 중 하나라도 'NaN' 이면 오류를 발생시킵니다.
참고: compare()
※ 형식
Decimal().compare_signal(other, context=None)
reference
https://docs.python.org/3/library/decimal.html#module-decimal
참고: compare()
※ 형식
Decimal().compare_signal(other, context=None)
reference
https://docs.python.org/3/library/decimal.html#module-decimal
/// 예제
1 2 3 4 5 6 7 8 9 10 | import decimal print(decimal.Decimal('1').compare_signal(decimal.Decimal('1'))) # 0 print(decimal.Decimal('1').compare_signal(decimal.Decimal('2'))) # -1 print(decimal.Decimal('1').compare_signal(decimal.Decimal('0'))) # 1 # a < b ---> Decimal('-1') # a == b ---> Decimal('0') # a > b ---> Decimal('1') | cs |
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기