Convert to Math.Pow Call
Replaces the multiplication of an expression by itself to the Math.Pow method call. Multiplication by the same expression is not a recommended way to raise it to a power, because the length of such a construction increases with the required power. Use the Math.Pow method instead.
Available when the cursor is on an expression in which a variable or expression is multiplied by itself.
Place the caret on an expression in which a variable is multiplied by itself.
The blinking cursor shows the caret's position at which the Refactoring is available.
double Polynom2(double x, Tuple<double, double, double> k) => k.Item3 * (x * x) + k.Item2 * x + k.Item1;
- Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.
- Select Convert to Math.Pow Call from the menu.
After execution, the Refactoring converts the multiplication by the same variable into the equivalent Math.Pow method call.
double Polynom2(double x, Tuple<double, double, double> k) => k.Item3 * (Math.Pow(x, 2)) + k.Item2 * x + k.Item1;