파이썬[Python]: decimal - fma 메서드

decimal 모듈 - fma 메서드(method)


/// 설명

(self * other) + third 를 반환합니다.
Decimal(self).fma(other, third)

※ 형식
Decimal().fma(other, third, context=None)

reference
https://docs.python.org/3/library/decimal.html#module-decimal

/// 예제

1
2
3
4
5
6
7
8
9
10
11
import decimal
 
print(decimal.Decimal(1).fma(35))  # 8
print(decimal.Decimal(2).fma(35))  # 11
print(decimal.Decimal(3).fma(35))  # 14
print(decimal.Decimal(4).fma(35))  # 17
print(decimal.Decimal(5).fma(35))  # 20
 
# Decimal(x).fma(y, z)
# = (x * y) + z
 
cs

* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)


– 당신을 응원합니다. –

댓글

이 블로그의 인기 게시물

파이썬[Python]: 내장함수 - from_bytes 메서드

파이썬[Python]: 내장함수 - __len__ 메서드

파이썬[Python]: kivy - 한글 사용

파이썬[Python]: 내장함수 - bit_length 메서드

C 언어: sin 함수, cos 함수, tan 함수