MCPcopy Index your code
hub / github.com/python/cpython / fma

Method fma

Lib/_pydecimal.py:4444–4465  ·  view source on GitHub ↗

Returns a multiplied by b, plus c. The first two operands are multiplied together, using multiply, the third operand is then added to the result of that multiplication, using add, all with only one final rounding. >>> ExtendedContext.fma(Decimal('3'), Decimal('5'),

(self, a, b, c)

Source from the content-addressed store, hash-verified

4442 return a.exp(context=self)
4443
4444 def fma(self, a, b, c):
4445 """Returns a multiplied by b, plus c.
4446
4447 The first two operands are multiplied together, using multiply,
4448 the third operand is then added to the result of that
4449 multiplication, using add, all with only one final rounding.
4450
4451 >>> ExtendedContext.fma(Decimal('3'), Decimal('5'), Decimal('7'))
4452 Decimal('22')
4453 >>> ExtendedContext.fma(Decimal('3'), Decimal('-5'), Decimal('7'))
4454 Decimal('-8')
4455 >>> ExtendedContext.fma(Decimal('888565290'), Decimal('1557.96930'), Decimal('-86087.7578'))
4456 Decimal('1.38435736E+12')
4457 >>> ExtendedContext.fma(1, 3, 4)
4458 Decimal('7')
4459 >>> ExtendedContext.fma(1, Decimal(3), 4)
4460 Decimal('7')
4461 >>> ExtendedContext.fma(1, 3, Decimal(4))
4462 Decimal('7')
4463 """
4464 a = _convert_other(a, raiseit=True)
4465 return a.fma(b, c, context=self)
4466
4467 def is_canonical(self, a):
4468 """Return True if the operand is canonical; otherwise return False.

Callers 1

test_fmaMethod · 0.95

Calls 2

_convert_otherFunction · 0.85
fmaMethod · 0.45

Tested by 1

test_fmaMethod · 0.76