Fused Multiply-Add: New feature in Python 3.13
Perform the multiplication & addition in one operation.
Non members can click here to read the story!
What is Fused Multiply-Add?
Fused Multiply Add is a mathematical operation that does the multiplication and addition in a single operation.
(x * y) + z
In mathematical computation, there are scenario’s where there is a need to do multiplication & addition sequentially. FMA(Fused Multiply Add) does this as a one operation making it more accurate than the traditional multiplication & addition combined.
How does Fused Multiply-Add works?
FMA takes the 3 numbers — Multiply the first two numbers and add the output of the operation with the third number.
What is the advantages of FMA over traditional Multiplication & Addition?
FMA improves the accuracy of the computations, especially when involving decimal numbers.
In the traditional way of calculation, when we multiply two numbers, the output is rounded to some extent. This rounded number is then added to the next number and then the output is rounded again.