MCPcopy Index your code
hub / github.com/RustPython/RustPython / fma

Method fma

Lib/_pydecimal.py:4441–4462  ·  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

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