C# - Math FusedMultiplyAdd() Method
The C# Math FusedMultiplyAdd() method returns (x*y) + z.
Syntax
public static double FusedMultiplyAdd (double x, double y, double z);
Parameters
x |
Specify the value to be multiplied with y. |
y |
Specify the value to be multiplied with x. |
z |
Specify the value to be added with x*y. |
Return Value
Returns (x*y) + z.
Example:
In the below example, FusedMultiplyAdd() method is used to return (x*y) + z.
using System; class MyProgram { static void Main(string[] args) { Console.WriteLine(Math.FusedMultiplyAdd(2, 3, 10)); Console.WriteLine(Math.FusedMultiplyAdd(-2, 5, 10)); Console.WriteLine(Math.FusedMultiplyAdd(2.1, 3.3, 55)); } }
The output of the above code will be:
16 0 61.93
❮ C# Math Methods