Data.Spline.Key:interpolateKeys from smoothie-0.4.0.2

Percentage Accurate: 99.8% → 99.8%
Time: 8.3s
Alternatives: 6
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right) \end{array} \]
(FPCore (x) :precision binary64 (* (* x x) (- 3.0 (* x 2.0))))
double code(double x) {
	return (x * x) * (3.0 - (x * 2.0));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (x * x) * (3.0d0 - (x * 2.0d0))
end function
public static double code(double x) {
	return (x * x) * (3.0 - (x * 2.0));
}
def code(x):
	return (x * x) * (3.0 - (x * 2.0))
function code(x)
	return Float64(Float64(x * x) * Float64(3.0 - Float64(x * 2.0)))
end
function tmp = code(x)
	tmp = (x * x) * (3.0 - (x * 2.0));
end
code[x_] := N[(N[(x * x), $MachinePrecision] * N[(3.0 - N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right) \end{array} \]
(FPCore (x) :precision binary64 (* (* x x) (- 3.0 (* x 2.0))))
double code(double x) {
	return (x * x) * (3.0 - (x * 2.0));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (x * x) * (3.0d0 - (x * 2.0d0))
end function
public static double code(double x) {
	return (x * x) * (3.0 - (x * 2.0));
}
def code(x):
	return (x * x) * (3.0 - (x * 2.0))
function code(x)
	return Float64(Float64(x * x) * Float64(3.0 - Float64(x * 2.0)))
end
function tmp = code(x)
	tmp = (x * x) * (3.0 - (x * 2.0));
end
code[x_] := N[(N[(x * x), $MachinePrecision] * N[(3.0 - N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)
\end{array}

Alternative 1: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right) \end{array} \]
(FPCore (x) :precision binary64 (* (* x x) (- 3.0 (* x 2.0))))
double code(double x) {
	return (x * x) * (3.0 - (x * 2.0));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (x * x) * (3.0d0 - (x * 2.0d0))
end function
public static double code(double x) {
	return (x * x) * (3.0 - (x * 2.0));
}
def code(x):
	return (x * x) * (3.0 - (x * 2.0))
function code(x)
	return Float64(Float64(x * x) * Float64(3.0 - Float64(x * 2.0)))
end
function tmp = code(x)
	tmp = (x * x) * (3.0 - (x * 2.0));
end
code[x_] := N[(N[(x * x), $MachinePrecision] * N[(3.0 - N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right) \]
  2. Final simplification99.8%

    \[\leadsto \left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right) \]

Alternative 2: 63.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1.5:\\ \;\;\;\;x \cdot \left(x \cdot 3\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot -4.5 + -6.75\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 1.5) (* x (* x 3.0)) (+ (* x -4.5) -6.75)))
double code(double x) {
	double tmp;
	if (x <= 1.5) {
		tmp = x * (x * 3.0);
	} else {
		tmp = (x * -4.5) + -6.75;
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 1.5d0) then
        tmp = x * (x * 3.0d0)
    else
        tmp = (x * (-4.5d0)) + (-6.75d0)
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 1.5) {
		tmp = x * (x * 3.0);
	} else {
		tmp = (x * -4.5) + -6.75;
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 1.5:
		tmp = x * (x * 3.0)
	else:
		tmp = (x * -4.5) + -6.75
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 1.5)
		tmp = Float64(x * Float64(x * 3.0));
	else
		tmp = Float64(Float64(x * -4.5) + -6.75);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 1.5)
		tmp = x * (x * 3.0);
	else
		tmp = (x * -4.5) + -6.75;
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 1.5], N[(x * N[(x * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * -4.5), $MachinePrecision] + -6.75), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.5:\\
\;\;\;\;x \cdot \left(x \cdot 3\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot -4.5 + -6.75\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.5

    1. Initial program 99.8%

      \[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right) \]
    2. Step-by-step derivation
      1. *-commutative99.8%

        \[\leadsto \color{blue}{\left(3 - x \cdot 2\right) \cdot \left(x \cdot x\right)} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left(3 - x \cdot 2\right) \cdot \left(x \cdot x\right)} \]
    4. Step-by-step derivation
      1. flip--99.8%

        \[\leadsto \color{blue}{\frac{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}{3 + x \cdot 2}} \cdot \left(x \cdot x\right) \]
      2. clear-num99.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}}} \cdot \left(x \cdot x\right) \]
      3. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{1 \cdot \left(x \cdot x\right)}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}}} \]
      4. *-un-lft-identity99.7%

        \[\leadsto \frac{\color{blue}{x \cdot x}}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}} \]
      5. pow299.7%

        \[\leadsto \frac{\color{blue}{{x}^{2}}}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}} \]
      6. clear-num99.7%

        \[\leadsto \frac{{x}^{2}}{\color{blue}{\frac{1}{\frac{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}{3 + x \cdot 2}}}} \]
      7. flip--99.7%

        \[\leadsto \frac{{x}^{2}}{\frac{1}{\color{blue}{3 - x \cdot 2}}} \]
      8. sub-neg99.7%

        \[\leadsto \frac{{x}^{2}}{\frac{1}{\color{blue}{3 + \left(-x \cdot 2\right)}}} \]
      9. distribute-rgt-neg-in99.7%

        \[\leadsto \frac{{x}^{2}}{\frac{1}{3 + \color{blue}{x \cdot \left(-2\right)}}} \]
      10. metadata-eval99.7%

        \[\leadsto \frac{{x}^{2}}{\frac{1}{3 + x \cdot \color{blue}{-2}}} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{{x}^{2}}{\frac{1}{3 + x \cdot -2}}} \]
    6. Taylor expanded in x around 0 76.5%

      \[\leadsto \frac{{x}^{2}}{\color{blue}{0.3333333333333333}} \]
    7. Step-by-step derivation
      1. div-inv76.6%

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{0.3333333333333333}} \]
      2. unpow276.6%

        \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot \frac{1}{0.3333333333333333} \]
      3. metadata-eval76.6%

        \[\leadsto \left(x \cdot x\right) \cdot \color{blue}{3} \]
      4. associate-*l*76.6%

        \[\leadsto \color{blue}{x \cdot \left(x \cdot 3\right)} \]
    8. Applied egg-rr76.6%

      \[\leadsto \color{blue}{x \cdot \left(x \cdot 3\right)} \]

    if 1.5 < x

    1. Initial program 99.9%

      \[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right) \]
    2. Step-by-step derivation
      1. *-commutative99.9%

        \[\leadsto \color{blue}{\left(3 - x \cdot 2\right) \cdot \left(x \cdot x\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\left(3 - x \cdot 2\right) \cdot \left(x \cdot x\right)} \]
    4. Step-by-step derivation
      1. associate-*r*99.9%

        \[\leadsto \color{blue}{\left(\left(3 - x \cdot 2\right) \cdot x\right) \cdot x} \]
      2. flip--98.4%

        \[\leadsto \left(\color{blue}{\frac{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}{3 + x \cdot 2}} \cdot x\right) \cdot x \]
      3. associate-*l/98.4%

        \[\leadsto \color{blue}{\frac{\left(3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right) \cdot x}{3 + x \cdot 2}} \cdot x \]
      4. associate-*l/88.8%

        \[\leadsto \color{blue}{\frac{\left(\left(3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right) \cdot x\right) \cdot x}{3 + x \cdot 2}} \]
      5. *-commutative88.8%

        \[\leadsto \frac{\color{blue}{\left(x \cdot \left(3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right)\right)} \cdot x}{3 + x \cdot 2} \]
      6. sub-neg88.8%

        \[\leadsto \frac{\left(x \cdot \color{blue}{\left(3 \cdot 3 + \left(-\left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right)\right)}\right) \cdot x}{3 + x \cdot 2} \]
      7. metadata-eval88.8%

        \[\leadsto \frac{\left(x \cdot \left(\color{blue}{9} + \left(-\left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right)\right)\right) \cdot x}{3 + x \cdot 2} \]
      8. swap-sqr88.8%

        \[\leadsto \frac{\left(x \cdot \left(9 + \left(-\color{blue}{\left(x \cdot x\right) \cdot \left(2 \cdot 2\right)}\right)\right)\right) \cdot x}{3 + x \cdot 2} \]
      9. distribute-rgt-neg-in88.8%

        \[\leadsto \frac{\left(x \cdot \left(9 + \color{blue}{\left(x \cdot x\right) \cdot \left(-2 \cdot 2\right)}\right)\right) \cdot x}{3 + x \cdot 2} \]
      10. pow288.8%

        \[\leadsto \frac{\left(x \cdot \left(9 + \color{blue}{{x}^{2}} \cdot \left(-2 \cdot 2\right)\right)\right) \cdot x}{3 + x \cdot 2} \]
      11. metadata-eval88.8%

        \[\leadsto \frac{\left(x \cdot \left(9 + {x}^{2} \cdot \left(-\color{blue}{4}\right)\right)\right) \cdot x}{3 + x \cdot 2} \]
      12. metadata-eval88.8%

        \[\leadsto \frac{\left(x \cdot \left(9 + {x}^{2} \cdot \color{blue}{-4}\right)\right) \cdot x}{3 + x \cdot 2} \]
    5. Applied egg-rr88.8%

      \[\leadsto \color{blue}{\frac{\left(x \cdot \left(9 + {x}^{2} \cdot -4\right)\right) \cdot x}{3 + x \cdot 2}} \]
    6. Taylor expanded in x around 0 0.4%

      \[\leadsto \frac{\color{blue}{\left(9 \cdot x\right)} \cdot x}{3 + x \cdot 2} \]
    7. Step-by-step derivation
      1. *-commutative0.4%

        \[\leadsto \frac{\color{blue}{\left(x \cdot 9\right)} \cdot x}{3 + x \cdot 2} \]
    8. Simplified0.4%

      \[\leadsto \frac{\color{blue}{\left(x \cdot 9\right)} \cdot x}{3 + x \cdot 2} \]
    9. Taylor expanded in x around inf 0.4%

      \[\leadsto \color{blue}{4.5 \cdot x - 6.75} \]
    10. Step-by-step derivation
      1. sub-neg0.4%

        \[\leadsto \color{blue}{4.5 \cdot x + \left(-6.75\right)} \]
      2. add-sqr-sqrt0.4%

        \[\leadsto 4.5 \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} + \left(-6.75\right) \]
      3. sqrt-prod0.4%

        \[\leadsto 4.5 \cdot \color{blue}{\sqrt{x \cdot x}} + \left(-6.75\right) \]
      4. unpow20.4%

        \[\leadsto 4.5 \cdot \sqrt{\color{blue}{{x}^{2}}} + \left(-6.75\right) \]
      5. unpow20.4%

        \[\leadsto 4.5 \cdot \sqrt{\color{blue}{x \cdot x}} + \left(-6.75\right) \]
      6. sqr-neg0.4%

        \[\leadsto 4.5 \cdot \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}} + \left(-6.75\right) \]
      7. sqrt-unprod0.0%

        \[\leadsto 4.5 \cdot \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)} + \left(-6.75\right) \]
      8. add-sqr-sqrt7.6%

        \[\leadsto 4.5 \cdot \color{blue}{\left(-x\right)} + \left(-6.75\right) \]
      9. distribute-rgt-neg-out7.6%

        \[\leadsto \color{blue}{\left(-4.5 \cdot x\right)} + \left(-6.75\right) \]
      10. distribute-neg-in7.6%

        \[\leadsto \color{blue}{-\left(4.5 \cdot x + 6.75\right)} \]
      11. *-un-lft-identity7.6%

        \[\leadsto -\color{blue}{1 \cdot \left(4.5 \cdot x + 6.75\right)} \]
      12. distribute-lft-neg-in7.6%

        \[\leadsto \color{blue}{\left(-1\right) \cdot \left(4.5 \cdot x + 6.75\right)} \]
      13. metadata-eval7.6%

        \[\leadsto \color{blue}{-1} \cdot \left(4.5 \cdot x + 6.75\right) \]
      14. *-commutative7.6%

        \[\leadsto -1 \cdot \left(\color{blue}{x \cdot 4.5} + 6.75\right) \]
      15. fma-def7.6%

        \[\leadsto -1 \cdot \color{blue}{\mathsf{fma}\left(x, 4.5, 6.75\right)} \]
    11. Applied egg-rr7.6%

      \[\leadsto \color{blue}{-1 \cdot \mathsf{fma}\left(x, 4.5, 6.75\right)} \]
    12. Step-by-step derivation
      1. fma-udef7.6%

        \[\leadsto -1 \cdot \color{blue}{\left(x \cdot 4.5 + 6.75\right)} \]
      2. distribute-lft-in7.6%

        \[\leadsto \color{blue}{-1 \cdot \left(x \cdot 4.5\right) + -1 \cdot 6.75} \]
      3. neg-mul-17.6%

        \[\leadsto \color{blue}{\left(-x \cdot 4.5\right)} + -1 \cdot 6.75 \]
      4. distribute-rgt-neg-in7.6%

        \[\leadsto \color{blue}{x \cdot \left(-4.5\right)} + -1 \cdot 6.75 \]
      5. metadata-eval7.6%

        \[\leadsto x \cdot \color{blue}{-4.5} + -1 \cdot 6.75 \]
      6. metadata-eval7.6%

        \[\leadsto x \cdot -4.5 + \color{blue}{-6.75} \]
    13. Simplified7.6%

      \[\leadsto \color{blue}{x \cdot -4.5 + -6.75} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification58.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.5:\\ \;\;\;\;x \cdot \left(x \cdot 3\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot -4.5 + -6.75\\ \end{array} \]

Alternative 3: 75.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1.5:\\ \;\;\;\;x \cdot \left(x \cdot 3\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(x \cdot -3\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 1.5) (* x (* x 3.0)) (* x (* x -3.0))))
double code(double x) {
	double tmp;
	if (x <= 1.5) {
		tmp = x * (x * 3.0);
	} else {
		tmp = x * (x * -3.0);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 1.5d0) then
        tmp = x * (x * 3.0d0)
    else
        tmp = x * (x * (-3.0d0))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 1.5) {
		tmp = x * (x * 3.0);
	} else {
		tmp = x * (x * -3.0);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 1.5:
		tmp = x * (x * 3.0)
	else:
		tmp = x * (x * -3.0)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 1.5)
		tmp = Float64(x * Float64(x * 3.0));
	else
		tmp = Float64(x * Float64(x * -3.0));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 1.5)
		tmp = x * (x * 3.0);
	else
		tmp = x * (x * -3.0);
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 1.5], N[(x * N[(x * 3.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(x * -3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.5:\\
\;\;\;\;x \cdot \left(x \cdot 3\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot -3\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.5

    1. Initial program 99.8%

      \[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right) \]
    2. Step-by-step derivation
      1. *-commutative99.8%

        \[\leadsto \color{blue}{\left(3 - x \cdot 2\right) \cdot \left(x \cdot x\right)} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left(3 - x \cdot 2\right) \cdot \left(x \cdot x\right)} \]
    4. Step-by-step derivation
      1. flip--99.8%

        \[\leadsto \color{blue}{\frac{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}{3 + x \cdot 2}} \cdot \left(x \cdot x\right) \]
      2. clear-num99.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}}} \cdot \left(x \cdot x\right) \]
      3. associate-*l/99.7%

        \[\leadsto \color{blue}{\frac{1 \cdot \left(x \cdot x\right)}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}}} \]
      4. *-un-lft-identity99.7%

        \[\leadsto \frac{\color{blue}{x \cdot x}}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}} \]
      5. pow299.7%

        \[\leadsto \frac{\color{blue}{{x}^{2}}}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}} \]
      6. clear-num99.7%

        \[\leadsto \frac{{x}^{2}}{\color{blue}{\frac{1}{\frac{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}{3 + x \cdot 2}}}} \]
      7. flip--99.7%

        \[\leadsto \frac{{x}^{2}}{\frac{1}{\color{blue}{3 - x \cdot 2}}} \]
      8. sub-neg99.7%

        \[\leadsto \frac{{x}^{2}}{\frac{1}{\color{blue}{3 + \left(-x \cdot 2\right)}}} \]
      9. distribute-rgt-neg-in99.7%

        \[\leadsto \frac{{x}^{2}}{\frac{1}{3 + \color{blue}{x \cdot \left(-2\right)}}} \]
      10. metadata-eval99.7%

        \[\leadsto \frac{{x}^{2}}{\frac{1}{3 + x \cdot \color{blue}{-2}}} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{{x}^{2}}{\frac{1}{3 + x \cdot -2}}} \]
    6. Taylor expanded in x around 0 76.5%

      \[\leadsto \frac{{x}^{2}}{\color{blue}{0.3333333333333333}} \]
    7. Step-by-step derivation
      1. div-inv76.6%

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{0.3333333333333333}} \]
      2. unpow276.6%

        \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot \frac{1}{0.3333333333333333} \]
      3. metadata-eval76.6%

        \[\leadsto \left(x \cdot x\right) \cdot \color{blue}{3} \]
      4. associate-*l*76.6%

        \[\leadsto \color{blue}{x \cdot \left(x \cdot 3\right)} \]
    8. Applied egg-rr76.6%

      \[\leadsto \color{blue}{x \cdot \left(x \cdot 3\right)} \]

    if 1.5 < x

    1. Initial program 99.9%

      \[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right) \]
    2. Step-by-step derivation
      1. *-commutative99.9%

        \[\leadsto \color{blue}{\left(3 - x \cdot 2\right) \cdot \left(x \cdot x\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\left(3 - x \cdot 2\right) \cdot \left(x \cdot x\right)} \]
    4. Step-by-step derivation
      1. flip--98.4%

        \[\leadsto \color{blue}{\frac{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}{3 + x \cdot 2}} \cdot \left(x \cdot x\right) \]
      2. clear-num98.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}}} \cdot \left(x \cdot x\right) \]
      3. associate-*l/98.3%

        \[\leadsto \color{blue}{\frac{1 \cdot \left(x \cdot x\right)}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}}} \]
      4. *-un-lft-identity98.3%

        \[\leadsto \frac{\color{blue}{x \cdot x}}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}} \]
      5. pow298.3%

        \[\leadsto \frac{\color{blue}{{x}^{2}}}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}} \]
      6. clear-num98.3%

        \[\leadsto \frac{{x}^{2}}{\color{blue}{\frac{1}{\frac{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}{3 + x \cdot 2}}}} \]
      7. flip--99.8%

        \[\leadsto \frac{{x}^{2}}{\frac{1}{\color{blue}{3 - x \cdot 2}}} \]
      8. sub-neg99.8%

        \[\leadsto \frac{{x}^{2}}{\frac{1}{\color{blue}{3 + \left(-x \cdot 2\right)}}} \]
      9. distribute-rgt-neg-in99.8%

        \[\leadsto \frac{{x}^{2}}{\frac{1}{3 + \color{blue}{x \cdot \left(-2\right)}}} \]
      10. metadata-eval99.8%

        \[\leadsto \frac{{x}^{2}}{\frac{1}{3 + x \cdot \color{blue}{-2}}} \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{{x}^{2}}{\frac{1}{3 + x \cdot -2}}} \]
    6. Step-by-step derivation
      1. unpow299.8%

        \[\leadsto \frac{\color{blue}{x \cdot x}}{\frac{1}{3 + x \cdot -2}} \]
      2. div-inv99.8%

        \[\leadsto \frac{x \cdot x}{\color{blue}{1 \cdot \frac{1}{3 + x \cdot -2}}} \]
      3. times-frac99.9%

        \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{x}{\frac{1}{3 + x \cdot -2}}} \]
      4. +-commutative99.9%

        \[\leadsto \frac{x}{1} \cdot \frac{x}{\frac{1}{\color{blue}{x \cdot -2 + 3}}} \]
      5. fma-def99.9%

        \[\leadsto \frac{x}{1} \cdot \frac{x}{\frac{1}{\color{blue}{\mathsf{fma}\left(x, -2, 3\right)}}} \]
    7. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{x}{\frac{1}{\mathsf{fma}\left(x, -2, 3\right)}}} \]
    8. Taylor expanded in x around 0 0.3%

      \[\leadsto \frac{x}{1} \cdot \frac{x}{\color{blue}{0.3333333333333333}} \]
    9. Step-by-step derivation
      1. frac-2neg0.3%

        \[\leadsto \frac{x}{1} \cdot \color{blue}{\frac{-x}{-0.3333333333333333}} \]
      2. neg-sub00.3%

        \[\leadsto \frac{x}{1} \cdot \frac{\color{blue}{0 - x}}{-0.3333333333333333} \]
      3. div-sub0.3%

        \[\leadsto \frac{x}{1} \cdot \color{blue}{\left(\frac{0}{-0.3333333333333333} - \frac{x}{-0.3333333333333333}\right)} \]
      4. metadata-eval0.3%

        \[\leadsto \frac{x}{1} \cdot \left(\frac{0}{\color{blue}{-0.3333333333333333}} - \frac{x}{-0.3333333333333333}\right) \]
      5. metadata-eval0.3%

        \[\leadsto \frac{x}{1} \cdot \left(\color{blue}{0} - \frac{x}{-0.3333333333333333}\right) \]
      6. add-sqr-sqrt0.3%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-0.3333333333333333}\right) \]
      7. sqrt-prod0.3%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \frac{\color{blue}{\sqrt{x \cdot x}}}{-0.3333333333333333}\right) \]
      8. unpow20.3%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \frac{\sqrt{\color{blue}{{x}^{2}}}}{-0.3333333333333333}\right) \]
      9. unpow20.3%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \frac{\sqrt{\color{blue}{x \cdot x}}}{-0.3333333333333333}\right) \]
      10. sqr-neg0.3%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \frac{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}{-0.3333333333333333}\right) \]
      11. sqrt-unprod0.0%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{-0.3333333333333333}\right) \]
      12. add-sqr-sqrt51.6%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \frac{\color{blue}{-x}}{-0.3333333333333333}\right) \]
      13. neg-sub051.6%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \frac{\color{blue}{0 - x}}{-0.3333333333333333}\right) \]
      14. div-sub51.6%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \color{blue}{\left(\frac{0}{-0.3333333333333333} - \frac{x}{-0.3333333333333333}\right)}\right) \]
      15. metadata-eval51.6%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \left(\frac{0}{\color{blue}{-0.3333333333333333}} - \frac{x}{-0.3333333333333333}\right)\right) \]
      16. metadata-eval51.6%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \left(\color{blue}{0} - \frac{x}{-0.3333333333333333}\right)\right) \]
      17. add-sqr-sqrt51.6%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \left(0 - \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-0.3333333333333333}\right)\right) \]
      18. sqrt-prod51.6%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \left(0 - \frac{\color{blue}{\sqrt{x \cdot x}}}{-0.3333333333333333}\right)\right) \]
      19. unpow251.6%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \left(0 - \frac{\sqrt{\color{blue}{{x}^{2}}}}{-0.3333333333333333}\right)\right) \]
      20. unpow251.6%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \left(0 - \frac{\sqrt{\color{blue}{x \cdot x}}}{-0.3333333333333333}\right)\right) \]
      21. sqr-neg51.6%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \left(0 - \frac{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}{-0.3333333333333333}\right)\right) \]
      22. sqrt-unprod0.0%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \left(0 - \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{-0.3333333333333333}\right)\right) \]
      23. add-sqr-sqrt0.3%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \left(0 - \frac{\color{blue}{-x}}{-0.3333333333333333}\right)\right) \]
      24. frac-2neg0.3%

        \[\leadsto \frac{x}{1} \cdot \left(0 - \left(0 - \color{blue}{\frac{x}{0.3333333333333333}}\right)\right) \]
    10. Applied egg-rr51.6%

      \[\leadsto \frac{x}{1} \cdot \color{blue}{\left(0 + x \cdot -3\right)} \]
    11. Step-by-step derivation
      1. +-lft-identity51.6%

        \[\leadsto \frac{x}{1} \cdot \color{blue}{\left(x \cdot -3\right)} \]
    12. Simplified51.6%

      \[\leadsto \frac{x}{1} \cdot \color{blue}{\left(x \cdot -3\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification70.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.5:\\ \;\;\;\;x \cdot \left(x \cdot 3\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(x \cdot -3\right)\\ \end{array} \]

Alternative 4: 62.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ x \cdot \left(x \cdot 3\right) \end{array} \]
(FPCore (x) :precision binary64 (* x (* x 3.0)))
double code(double x) {
	return x * (x * 3.0);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = x * (x * 3.0d0)
end function
public static double code(double x) {
	return x * (x * 3.0);
}
def code(x):
	return x * (x * 3.0)
function code(x)
	return Float64(x * Float64(x * 3.0))
end
function tmp = code(x)
	tmp = x * (x * 3.0);
end
code[x_] := N[(x * N[(x * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(x \cdot 3\right)
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right) \]
  2. Step-by-step derivation
    1. *-commutative99.8%

      \[\leadsto \color{blue}{\left(3 - x \cdot 2\right) \cdot \left(x \cdot x\right)} \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\left(3 - x \cdot 2\right) \cdot \left(x \cdot x\right)} \]
  4. Step-by-step derivation
    1. flip--99.4%

      \[\leadsto \color{blue}{\frac{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}{3 + x \cdot 2}} \cdot \left(x \cdot x\right) \]
    2. clear-num99.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}}} \cdot \left(x \cdot x\right) \]
    3. associate-*l/99.3%

      \[\leadsto \color{blue}{\frac{1 \cdot \left(x \cdot x\right)}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}}} \]
    4. *-un-lft-identity99.3%

      \[\leadsto \frac{\color{blue}{x \cdot x}}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}} \]
    5. pow299.3%

      \[\leadsto \frac{\color{blue}{{x}^{2}}}{\frac{3 + x \cdot 2}{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}} \]
    6. clear-num99.3%

      \[\leadsto \frac{{x}^{2}}{\color{blue}{\frac{1}{\frac{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}{3 + x \cdot 2}}}} \]
    7. flip--99.7%

      \[\leadsto \frac{{x}^{2}}{\frac{1}{\color{blue}{3 - x \cdot 2}}} \]
    8. sub-neg99.7%

      \[\leadsto \frac{{x}^{2}}{\frac{1}{\color{blue}{3 + \left(-x \cdot 2\right)}}} \]
    9. distribute-rgt-neg-in99.7%

      \[\leadsto \frac{{x}^{2}}{\frac{1}{3 + \color{blue}{x \cdot \left(-2\right)}}} \]
    10. metadata-eval99.7%

      \[\leadsto \frac{{x}^{2}}{\frac{1}{3 + x \cdot \color{blue}{-2}}} \]
  5. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\frac{{x}^{2}}{\frac{1}{3 + x \cdot -2}}} \]
  6. Taylor expanded in x around 0 56.6%

    \[\leadsto \frac{{x}^{2}}{\color{blue}{0.3333333333333333}} \]
  7. Step-by-step derivation
    1. div-inv56.6%

      \[\leadsto \color{blue}{{x}^{2} \cdot \frac{1}{0.3333333333333333}} \]
    2. unpow256.6%

      \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot \frac{1}{0.3333333333333333} \]
    3. metadata-eval56.6%

      \[\leadsto \left(x \cdot x\right) \cdot \color{blue}{3} \]
    4. associate-*l*56.6%

      \[\leadsto \color{blue}{x \cdot \left(x \cdot 3\right)} \]
  8. Applied egg-rr56.6%

    \[\leadsto \color{blue}{x \cdot \left(x \cdot 3\right)} \]
  9. Final simplification56.6%

    \[\leadsto x \cdot \left(x \cdot 3\right) \]

Alternative 5: 3.1% accurate, 3.0× speedup?

\[\begin{array}{l} \\ x \cdot 4.5 \end{array} \]
(FPCore (x) :precision binary64 (* x 4.5))
double code(double x) {
	return x * 4.5;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = x * 4.5d0
end function
public static double code(double x) {
	return x * 4.5;
}
def code(x):
	return x * 4.5
function code(x)
	return Float64(x * 4.5)
end
function tmp = code(x)
	tmp = x * 4.5;
end
code[x_] := N[(x * 4.5), $MachinePrecision]
\begin{array}{l}

\\
x \cdot 4.5
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right) \]
  2. Step-by-step derivation
    1. *-commutative99.8%

      \[\leadsto \color{blue}{\left(3 - x \cdot 2\right) \cdot \left(x \cdot x\right)} \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\left(3 - x \cdot 2\right) \cdot \left(x \cdot x\right)} \]
  4. Step-by-step derivation
    1. associate-*r*99.8%

      \[\leadsto \color{blue}{\left(\left(3 - x \cdot 2\right) \cdot x\right) \cdot x} \]
    2. flip--99.4%

      \[\leadsto \left(\color{blue}{\frac{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}{3 + x \cdot 2}} \cdot x\right) \cdot x \]
    3. associate-*l/99.4%

      \[\leadsto \color{blue}{\frac{\left(3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right) \cdot x}{3 + x \cdot 2}} \cdot x \]
    4. associate-*l/93.4%

      \[\leadsto \color{blue}{\frac{\left(\left(3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right) \cdot x\right) \cdot x}{3 + x \cdot 2}} \]
    5. *-commutative93.4%

      \[\leadsto \frac{\color{blue}{\left(x \cdot \left(3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right)\right)} \cdot x}{3 + x \cdot 2} \]
    6. sub-neg93.4%

      \[\leadsto \frac{\left(x \cdot \color{blue}{\left(3 \cdot 3 + \left(-\left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right)\right)}\right) \cdot x}{3 + x \cdot 2} \]
    7. metadata-eval93.4%

      \[\leadsto \frac{\left(x \cdot \left(\color{blue}{9} + \left(-\left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right)\right)\right) \cdot x}{3 + x \cdot 2} \]
    8. swap-sqr93.4%

      \[\leadsto \frac{\left(x \cdot \left(9 + \left(-\color{blue}{\left(x \cdot x\right) \cdot \left(2 \cdot 2\right)}\right)\right)\right) \cdot x}{3 + x \cdot 2} \]
    9. distribute-rgt-neg-in93.4%

      \[\leadsto \frac{\left(x \cdot \left(9 + \color{blue}{\left(x \cdot x\right) \cdot \left(-2 \cdot 2\right)}\right)\right) \cdot x}{3 + x \cdot 2} \]
    10. pow293.4%

      \[\leadsto \frac{\left(x \cdot \left(9 + \color{blue}{{x}^{2}} \cdot \left(-2 \cdot 2\right)\right)\right) \cdot x}{3 + x \cdot 2} \]
    11. metadata-eval93.4%

      \[\leadsto \frac{\left(x \cdot \left(9 + {x}^{2} \cdot \left(-\color{blue}{4}\right)\right)\right) \cdot x}{3 + x \cdot 2} \]
    12. metadata-eval93.4%

      \[\leadsto \frac{\left(x \cdot \left(9 + {x}^{2} \cdot \color{blue}{-4}\right)\right) \cdot x}{3 + x \cdot 2} \]
  5. Applied egg-rr93.4%

    \[\leadsto \color{blue}{\frac{\left(x \cdot \left(9 + {x}^{2} \cdot -4\right)\right) \cdot x}{3 + x \cdot 2}} \]
  6. Taylor expanded in x around 0 43.2%

    \[\leadsto \frac{\color{blue}{\left(9 \cdot x\right)} \cdot x}{3 + x \cdot 2} \]
  7. Step-by-step derivation
    1. *-commutative43.2%

      \[\leadsto \frac{\color{blue}{\left(x \cdot 9\right)} \cdot x}{3 + x \cdot 2} \]
  8. Simplified43.2%

    \[\leadsto \frac{\color{blue}{\left(x \cdot 9\right)} \cdot x}{3 + x \cdot 2} \]
  9. Taylor expanded in x around inf 2.9%

    \[\leadsto \color{blue}{4.5 \cdot x} \]
  10. Step-by-step derivation
    1. *-commutative2.9%

      \[\leadsto \color{blue}{x \cdot 4.5} \]
  11. Simplified2.9%

    \[\leadsto \color{blue}{x \cdot 4.5} \]
  12. Final simplification2.9%

    \[\leadsto x \cdot 4.5 \]

Alternative 6: 2.5% accurate, 9.0× speedup?

\[\begin{array}{l} \\ -6.75 \end{array} \]
(FPCore (x) :precision binary64 -6.75)
double code(double x) {
	return -6.75;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = -6.75d0
end function
public static double code(double x) {
	return -6.75;
}
def code(x):
	return -6.75
function code(x)
	return -6.75
end
function tmp = code(x)
	tmp = -6.75;
end
code[x_] := -6.75
\begin{array}{l}

\\
-6.75
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right) \]
  2. Step-by-step derivation
    1. *-commutative99.8%

      \[\leadsto \color{blue}{\left(3 - x \cdot 2\right) \cdot \left(x \cdot x\right)} \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\left(3 - x \cdot 2\right) \cdot \left(x \cdot x\right)} \]
  4. Step-by-step derivation
    1. associate-*r*99.8%

      \[\leadsto \color{blue}{\left(\left(3 - x \cdot 2\right) \cdot x\right) \cdot x} \]
    2. flip--99.4%

      \[\leadsto \left(\color{blue}{\frac{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}{3 + x \cdot 2}} \cdot x\right) \cdot x \]
    3. associate-*l/99.4%

      \[\leadsto \color{blue}{\frac{\left(3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right) \cdot x}{3 + x \cdot 2}} \cdot x \]
    4. associate-*l/93.4%

      \[\leadsto \color{blue}{\frac{\left(\left(3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right) \cdot x\right) \cdot x}{3 + x \cdot 2}} \]
    5. *-commutative93.4%

      \[\leadsto \frac{\color{blue}{\left(x \cdot \left(3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right)\right)} \cdot x}{3 + x \cdot 2} \]
    6. sub-neg93.4%

      \[\leadsto \frac{\left(x \cdot \color{blue}{\left(3 \cdot 3 + \left(-\left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right)\right)}\right) \cdot x}{3 + x \cdot 2} \]
    7. metadata-eval93.4%

      \[\leadsto \frac{\left(x \cdot \left(\color{blue}{9} + \left(-\left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right)\right)\right) \cdot x}{3 + x \cdot 2} \]
    8. swap-sqr93.4%

      \[\leadsto \frac{\left(x \cdot \left(9 + \left(-\color{blue}{\left(x \cdot x\right) \cdot \left(2 \cdot 2\right)}\right)\right)\right) \cdot x}{3 + x \cdot 2} \]
    9. distribute-rgt-neg-in93.4%

      \[\leadsto \frac{\left(x \cdot \left(9 + \color{blue}{\left(x \cdot x\right) \cdot \left(-2 \cdot 2\right)}\right)\right) \cdot x}{3 + x \cdot 2} \]
    10. pow293.4%

      \[\leadsto \frac{\left(x \cdot \left(9 + \color{blue}{{x}^{2}} \cdot \left(-2 \cdot 2\right)\right)\right) \cdot x}{3 + x \cdot 2} \]
    11. metadata-eval93.4%

      \[\leadsto \frac{\left(x \cdot \left(9 + {x}^{2} \cdot \left(-\color{blue}{4}\right)\right)\right) \cdot x}{3 + x \cdot 2} \]
    12. metadata-eval93.4%

      \[\leadsto \frac{\left(x \cdot \left(9 + {x}^{2} \cdot \color{blue}{-4}\right)\right) \cdot x}{3 + x \cdot 2} \]
  5. Applied egg-rr93.4%

    \[\leadsto \color{blue}{\frac{\left(x \cdot \left(9 + {x}^{2} \cdot -4\right)\right) \cdot x}{3 + x \cdot 2}} \]
  6. Taylor expanded in x around 0 43.2%

    \[\leadsto \frac{\color{blue}{\left(9 \cdot x\right)} \cdot x}{3 + x \cdot 2} \]
  7. Step-by-step derivation
    1. *-commutative43.2%

      \[\leadsto \frac{\color{blue}{\left(x \cdot 9\right)} \cdot x}{3 + x \cdot 2} \]
  8. Simplified43.2%

    \[\leadsto \frac{\color{blue}{\left(x \cdot 9\right)} \cdot x}{3 + x \cdot 2} \]
  9. Taylor expanded in x around inf 1.4%

    \[\leadsto \color{blue}{4.5 \cdot x - 6.75} \]
  10. Taylor expanded in x around 0 2.4%

    \[\leadsto \color{blue}{-6.75} \]
  11. Final simplification2.4%

    \[\leadsto -6.75 \]

Developer target: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \left(x \cdot \left(3 - x \cdot 2\right)\right) \end{array} \]
(FPCore (x) :precision binary64 (* x (* x (- 3.0 (* x 2.0)))))
double code(double x) {
	return x * (x * (3.0 - (x * 2.0)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = x * (x * (3.0d0 - (x * 2.0d0)))
end function
public static double code(double x) {
	return x * (x * (3.0 - (x * 2.0)));
}
def code(x):
	return x * (x * (3.0 - (x * 2.0)))
function code(x)
	return Float64(x * Float64(x * Float64(3.0 - Float64(x * 2.0))))
end
function tmp = code(x)
	tmp = x * (x * (3.0 - (x * 2.0)));
end
code[x_] := N[(x * N[(x * N[(3.0 - N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(x \cdot \left(3 - x \cdot 2\right)\right)
\end{array}

Reproduce

?
herbie shell --seed 2023336 
(FPCore (x)
  :name "Data.Spline.Key:interpolateKeys from smoothie-0.4.0.2"
  :precision binary64

  :herbie-target
  (* x (* x (- 3.0 (* x 2.0))))

  (* (* x x) (- 3.0 (* x 2.0))))