6*pow(x,5)-15*pow(x,4)+10*pow(x,3)

Percentage Accurate: 99.8% → 99.8%
Time: 2.5s
Alternatives: 7
Speedup: 3.3×

Specification

?
\[0 \leq x \land x \leq 1\]
\[\left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) + 10 \cdot {x}^{3} \]
(FPCore (x)
  :precision binary64
  (+ (- (* 6.0 (pow x 5.0)) (* 15.0 (pow x 4.0))) (* 10.0 (pow x 3.0))))
double code(double x) {
	return ((6.0 * pow(x, 5.0)) - (15.0 * pow(x, 4.0))) + (10.0 * pow(x, 3.0));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((6.0d0 * (x ** 5.0d0)) - (15.0d0 * (x ** 4.0d0))) + (10.0d0 * (x ** 3.0d0))
end function
public static double code(double x) {
	return ((6.0 * Math.pow(x, 5.0)) - (15.0 * Math.pow(x, 4.0))) + (10.0 * Math.pow(x, 3.0));
}
def code(x):
	return ((6.0 * math.pow(x, 5.0)) - (15.0 * math.pow(x, 4.0))) + (10.0 * math.pow(x, 3.0))
function code(x)
	return Float64(Float64(Float64(6.0 * (x ^ 5.0)) - Float64(15.0 * (x ^ 4.0))) + Float64(10.0 * (x ^ 3.0)))
end
function tmp = code(x)
	tmp = ((6.0 * (x ^ 5.0)) - (15.0 * (x ^ 4.0))) + (10.0 * (x ^ 3.0));
end
code[x_] := N[(N[(N[(6.0 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision] - N[(15.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(10.0 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) + 10 \cdot {x}^{3}

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 7 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?

\[\left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) + 10 \cdot {x}^{3} \]
(FPCore (x)
  :precision binary64
  (+ (- (* 6.0 (pow x 5.0)) (* 15.0 (pow x 4.0))) (* 10.0 (pow x 3.0))))
double code(double x) {
	return ((6.0 * pow(x, 5.0)) - (15.0 * pow(x, 4.0))) + (10.0 * pow(x, 3.0));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((6.0d0 * (x ** 5.0d0)) - (15.0d0 * (x ** 4.0d0))) + (10.0d0 * (x ** 3.0d0))
end function
public static double code(double x) {
	return ((6.0 * Math.pow(x, 5.0)) - (15.0 * Math.pow(x, 4.0))) + (10.0 * Math.pow(x, 3.0));
}
def code(x):
	return ((6.0 * math.pow(x, 5.0)) - (15.0 * math.pow(x, 4.0))) + (10.0 * math.pow(x, 3.0))
function code(x)
	return Float64(Float64(Float64(6.0 * (x ^ 5.0)) - Float64(15.0 * (x ^ 4.0))) + Float64(10.0 * (x ^ 3.0)))
end
function tmp = code(x)
	tmp = ((6.0 * (x ^ 5.0)) - (15.0 * (x ^ 4.0))) + (10.0 * (x ^ 3.0));
end
code[x_] := N[(N[(N[(6.0 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision] - N[(15.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(10.0 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) + 10 \cdot {x}^{3}

Alternative 1: 99.8% accurate, 1.4× speedup?

\[\mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \mathsf{fma}\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot -15, x, 6 \cdot {x}^{5}\right)\right) \]
(FPCore (x)
  :precision binary64
  (fma
 (* (* (fabs x) x) 10.0)
 (fabs x)
 (fma (* (* (* x x) x) -15.0) x (* 6.0 (pow x 5.0)))))
double code(double x) {
	return fma(((fabs(x) * x) * 10.0), fabs(x), fma((((x * x) * x) * -15.0), x, (6.0 * pow(x, 5.0))));
}
function code(x)
	return fma(Float64(Float64(abs(x) * x) * 10.0), abs(x), fma(Float64(Float64(Float64(x * x) * x) * -15.0), x, Float64(6.0 * (x ^ 5.0))))
end
code[x_] := N[(N[(N[(N[Abs[x], $MachinePrecision] * x), $MachinePrecision] * 10.0), $MachinePrecision] * N[Abs[x], $MachinePrecision] + N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * -15.0), $MachinePrecision] * x + N[(6.0 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \mathsf{fma}\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot -15, x, 6 \cdot {x}^{5}\right)\right)
Derivation
  1. Initial program 99.8%

    \[\left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) + 10 \cdot {x}^{3} \]
  2. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \color{blue}{\left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) + 10 \cdot {x}^{3}} \]
    2. +-commutativeN/A

      \[\leadsto \color{blue}{10 \cdot {x}^{3} + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right)} \]
    3. lift-*.f64N/A

      \[\leadsto \color{blue}{10 \cdot {x}^{3}} + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    4. *-commutativeN/A

      \[\leadsto \color{blue}{{x}^{3} \cdot 10} + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    5. lift-pow.f64N/A

      \[\leadsto \color{blue}{{x}^{3}} \cdot 10 + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    6. unpow3N/A

      \[\leadsto \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \cdot 10 + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    7. associate-*l*N/A

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(x \cdot 10\right)} + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    8. sqr-abs-revN/A

      \[\leadsto \color{blue}{\left(\left|x\right| \cdot \left|x\right|\right)} \cdot \left(x \cdot 10\right) + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    9. associate-*l*N/A

      \[\leadsto \color{blue}{\left|x\right| \cdot \left(\left|x\right| \cdot \left(x \cdot 10\right)\right)} + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    10. *-commutativeN/A

      \[\leadsto \color{blue}{\left(\left|x\right| \cdot \left(x \cdot 10\right)\right) \cdot \left|x\right|} + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    11. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left|x\right| \cdot \left(x \cdot 10\right), \left|x\right|, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right)} \]
    12. associate-*r*N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\left|x\right| \cdot x\right) \cdot 10}, \left|x\right|, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    13. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(x \cdot \left|x\right|\right)} \cdot 10, \left|x\right|, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    14. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(x \cdot \left|x\right|\right) \cdot 10}, \left|x\right|, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    15. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\left|x\right| \cdot x\right)} \cdot 10, \left|x\right|, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    16. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\left|x\right| \cdot x\right)} \cdot 10, \left|x\right|, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    17. lower-fabs.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(\color{blue}{\left|x\right|} \cdot x\right) \cdot 10, \left|x\right|, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    18. lower-fabs.f6499.8%

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \color{blue}{\left|x\right|}, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    19. lift--.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \color{blue}{6 \cdot {x}^{5} - 15 \cdot {x}^{4}}\right) \]
    20. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, 6 \cdot {x}^{5} - \color{blue}{15 \cdot {x}^{4}}\right) \]
    21. fp-cancel-sub-sign-invN/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \color{blue}{6 \cdot {x}^{5} + \left(\mathsf{neg}\left(15\right)\right) \cdot {x}^{4}}\right) \]
    22. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \color{blue}{\left(\mathsf{neg}\left(15\right)\right) \cdot {x}^{4} + 6 \cdot {x}^{5}}\right) \]
    23. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(15\right), {x}^{4}, 6 \cdot {x}^{5}\right)}\right) \]
  3. Applied rewrites99.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \mathsf{fma}\left(-15, \left(\left(x \cdot x\right) \cdot x\right) \cdot x, {x}^{5} \cdot 6\right)\right)} \]
  4. Step-by-step derivation
    1. lift-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \color{blue}{-15 \cdot \left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) + {x}^{5} \cdot 6}\right) \]
    2. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, -15 \cdot \color{blue}{\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right)} + {x}^{5} \cdot 6\right) \]
    3. associate-*r*N/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \color{blue}{\left(-15 \cdot \left(\left(x \cdot x\right) \cdot x\right)\right) \cdot x} + {x}^{5} \cdot 6\right) \]
    4. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \color{blue}{\mathsf{fma}\left(-15 \cdot \left(\left(x \cdot x\right) \cdot x\right), x, {x}^{5} \cdot 6\right)}\right) \]
    5. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \mathsf{fma}\left(\color{blue}{\left(\left(x \cdot x\right) \cdot x\right) \cdot -15}, x, {x}^{5} \cdot 6\right)\right) \]
    6. lower-*.f6499.8%

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \mathsf{fma}\left(\color{blue}{\left(\left(x \cdot x\right) \cdot x\right) \cdot -15}, x, {x}^{5} \cdot 6\right)\right) \]
    7. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \mathsf{fma}\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot -15, x, \color{blue}{{x}^{5} \cdot 6}\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \mathsf{fma}\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot -15, x, \color{blue}{6 \cdot {x}^{5}}\right)\right) \]
    9. lower-*.f6499.8%

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \mathsf{fma}\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot -15, x, \color{blue}{6 \cdot {x}^{5}}\right)\right) \]
  5. Applied rewrites99.8%

    \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \color{blue}{\mathsf{fma}\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot -15, x, 6 \cdot {x}^{5}\right)}\right) \]
  6. Add Preprocessing

Alternative 2: 99.8% accurate, 1.4× speedup?

\[\mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \mathsf{fma}\left(-15, \left(\left(x \cdot x\right) \cdot x\right) \cdot x, {x}^{5} \cdot 6\right)\right) \]
(FPCore (x)
  :precision binary64
  (fma
 (* (* (fabs x) x) 10.0)
 (fabs x)
 (fma -15.0 (* (* (* x x) x) x) (* (pow x 5.0) 6.0))))
double code(double x) {
	return fma(((fabs(x) * x) * 10.0), fabs(x), fma(-15.0, (((x * x) * x) * x), (pow(x, 5.0) * 6.0)));
}
function code(x)
	return fma(Float64(Float64(abs(x) * x) * 10.0), abs(x), fma(-15.0, Float64(Float64(Float64(x * x) * x) * x), Float64((x ^ 5.0) * 6.0)))
end
code[x_] := N[(N[(N[(N[Abs[x], $MachinePrecision] * x), $MachinePrecision] * 10.0), $MachinePrecision] * N[Abs[x], $MachinePrecision] + N[(-15.0 * N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] + N[(N[Power[x, 5.0], $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \mathsf{fma}\left(-15, \left(\left(x \cdot x\right) \cdot x\right) \cdot x, {x}^{5} \cdot 6\right)\right)
Derivation
  1. Initial program 99.8%

    \[\left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) + 10 \cdot {x}^{3} \]
  2. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \color{blue}{\left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) + 10 \cdot {x}^{3}} \]
    2. +-commutativeN/A

      \[\leadsto \color{blue}{10 \cdot {x}^{3} + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right)} \]
    3. lift-*.f64N/A

      \[\leadsto \color{blue}{10 \cdot {x}^{3}} + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    4. *-commutativeN/A

      \[\leadsto \color{blue}{{x}^{3} \cdot 10} + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    5. lift-pow.f64N/A

      \[\leadsto \color{blue}{{x}^{3}} \cdot 10 + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    6. unpow3N/A

      \[\leadsto \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \cdot 10 + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    7. associate-*l*N/A

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(x \cdot 10\right)} + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    8. sqr-abs-revN/A

      \[\leadsto \color{blue}{\left(\left|x\right| \cdot \left|x\right|\right)} \cdot \left(x \cdot 10\right) + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    9. associate-*l*N/A

      \[\leadsto \color{blue}{\left|x\right| \cdot \left(\left|x\right| \cdot \left(x \cdot 10\right)\right)} + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    10. *-commutativeN/A

      \[\leadsto \color{blue}{\left(\left|x\right| \cdot \left(x \cdot 10\right)\right) \cdot \left|x\right|} + \left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    11. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left|x\right| \cdot \left(x \cdot 10\right), \left|x\right|, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right)} \]
    12. associate-*r*N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\left|x\right| \cdot x\right) \cdot 10}, \left|x\right|, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    13. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(x \cdot \left|x\right|\right)} \cdot 10, \left|x\right|, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    14. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(x \cdot \left|x\right|\right) \cdot 10}, \left|x\right|, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    15. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\left|x\right| \cdot x\right)} \cdot 10, \left|x\right|, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    16. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\left|x\right| \cdot x\right)} \cdot 10, \left|x\right|, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    17. lower-fabs.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(\color{blue}{\left|x\right|} \cdot x\right) \cdot 10, \left|x\right|, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    18. lower-fabs.f6499.8%

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \color{blue}{\left|x\right|}, 6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) \]
    19. lift--.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \color{blue}{6 \cdot {x}^{5} - 15 \cdot {x}^{4}}\right) \]
    20. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, 6 \cdot {x}^{5} - \color{blue}{15 \cdot {x}^{4}}\right) \]
    21. fp-cancel-sub-sign-invN/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \color{blue}{6 \cdot {x}^{5} + \left(\mathsf{neg}\left(15\right)\right) \cdot {x}^{4}}\right) \]
    22. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \color{blue}{\left(\mathsf{neg}\left(15\right)\right) \cdot {x}^{4} + 6 \cdot {x}^{5}}\right) \]
    23. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(15\right), {x}^{4}, 6 \cdot {x}^{5}\right)}\right) \]
  3. Applied rewrites99.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\left|x\right| \cdot x\right) \cdot 10, \left|x\right|, \mathsf{fma}\left(-15, \left(\left(x \cdot x\right) \cdot x\right) \cdot x, {x}^{5} \cdot 6\right)\right)} \]
  4. Add Preprocessing

Alternative 3: 99.8% accurate, 3.3× speedup?

\[\left(\mathsf{fma}\left(\mathsf{fma}\left(x, 6, -15\right), x, 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
(FPCore (x)
  :precision binary64
  (* (* (fma (fma x 6.0 -15.0) x 10.0) (* x x)) x))
double code(double x) {
	return (fma(fma(x, 6.0, -15.0), x, 10.0) * (x * x)) * x;
}
function code(x)
	return Float64(Float64(fma(fma(x, 6.0, -15.0), x, 10.0) * Float64(x * x)) * x)
end
code[x_] := N[(N[(N[(N[(x * 6.0 + -15.0), $MachinePrecision] * x + 10.0), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]
\left(\mathsf{fma}\left(\mathsf{fma}\left(x, 6, -15\right), x, 10\right) \cdot \left(x \cdot x\right)\right) \cdot x
Derivation
  1. Initial program 99.8%

    \[\left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) + 10 \cdot {x}^{3} \]
  2. Taylor expanded in x around 0

    \[\leadsto \color{blue}{{x}^{3} \cdot \left(10 + -15 \cdot x\right)} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto {x}^{3} \cdot \color{blue}{\left(10 + -15 \cdot x\right)} \]
    2. lower-pow.f64N/A

      \[\leadsto {x}^{3} \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    3. lower-+.f64N/A

      \[\leadsto {x}^{3} \cdot \left(10 + \color{blue}{-15 \cdot x}\right) \]
    4. lower-*.f6498.7%

      \[\leadsto {x}^{3} \cdot \left(10 + -15 \cdot \color{blue}{x}\right) \]
  4. Applied rewrites98.7%

    \[\leadsto \color{blue}{{x}^{3} \cdot \left(10 + -15 \cdot x\right)} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto {x}^{3} \cdot \color{blue}{\left(10 + -15 \cdot x\right)} \]
    2. lift-pow.f64N/A

      \[\leadsto {x}^{3} \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    3. pow3N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    4. lift-*.f64N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(10 + -15 \cdot x\right) \]
    5. lift-*.f64N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    6. *-commutativeN/A

      \[\leadsto \left(10 + -15 \cdot x\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \]
    7. lift-*.f64N/A

      \[\leadsto \left(10 + -15 \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{x}\right) \]
    8. *-commutativeN/A

      \[\leadsto \left(10 + -15 \cdot x\right) \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right) \]
    9. associate-*r*N/A

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    10. lower-*.f64N/A

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    11. lower-*.f6498.7%

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{x} \cdot x\right) \]
    12. lift-+.f64N/A

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
    13. +-commutativeN/A

      \[\leadsto \left(\left(-15 \cdot x + 10\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
    14. lift-*.f64N/A

      \[\leadsto \left(\left(-15 \cdot x + 10\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
    15. lower-fma.f6498.7%

      \[\leadsto \left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
  6. Applied rewrites98.7%

    \[\leadsto \left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
  7. Taylor expanded in x around 0

    \[\leadsto \color{blue}{{x}^{3} \cdot \left(10 + x \cdot \left(6 \cdot x - 15\right)\right)} \]
  8. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto {x}^{3} \cdot \color{blue}{\left(10 + x \cdot \left(6 \cdot x - 15\right)\right)} \]
    2. lower-pow.f64N/A

      \[\leadsto {x}^{3} \cdot \left(\color{blue}{10} + x \cdot \left(6 \cdot x - 15\right)\right) \]
    3. lower-+.f64N/A

      \[\leadsto {x}^{3} \cdot \left(10 + \color{blue}{x \cdot \left(6 \cdot x - 15\right)}\right) \]
    4. lower-*.f64N/A

      \[\leadsto {x}^{3} \cdot \left(10 + x \cdot \color{blue}{\left(6 \cdot x - 15\right)}\right) \]
    5. lower--.f64N/A

      \[\leadsto {x}^{3} \cdot \left(10 + x \cdot \left(6 \cdot x - \color{blue}{15}\right)\right) \]
    6. lower-*.f6499.8%

      \[\leadsto {x}^{3} \cdot \left(10 + x \cdot \left(6 \cdot x - 15\right)\right) \]
  9. Applied rewrites99.8%

    \[\leadsto \color{blue}{{x}^{3} \cdot \left(10 + x \cdot \left(6 \cdot x - 15\right)\right)} \]
  10. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto {x}^{3} \cdot \color{blue}{\left(10 + x \cdot \left(6 \cdot x - 15\right)\right)} \]
    2. lift-pow.f64N/A

      \[\leadsto {x}^{3} \cdot \left(\color{blue}{10} + x \cdot \left(6 \cdot x - 15\right)\right) \]
    3. pow3N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{10} + x \cdot \left(6 \cdot x - 15\right)\right) \]
    4. lift-*.f64N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(10 + x \cdot \left(6 \cdot x - 15\right)\right) \]
    5. lift-*.f64N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{10} + x \cdot \left(6 \cdot x - 15\right)\right) \]
    6. *-commutativeN/A

      \[\leadsto \left(10 + x \cdot \left(6 \cdot x - 15\right)\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \]
    7. lift-*.f64N/A

      \[\leadsto \left(10 + x \cdot \left(6 \cdot x - 15\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{x}\right) \]
    8. associate-*r*N/A

      \[\leadsto \left(\left(10 + x \cdot \left(6 \cdot x - 15\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{x} \]
    9. lower-*.f64N/A

      \[\leadsto \left(\left(10 + x \cdot \left(6 \cdot x - 15\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{x} \]
    10. lower-*.f6499.8%

      \[\leadsto \left(\left(10 + x \cdot \left(6 \cdot x - 15\right)\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    11. lift-+.f64N/A

      \[\leadsto \left(\left(10 + x \cdot \left(6 \cdot x - 15\right)\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    12. +-commutativeN/A

      \[\leadsto \left(\left(x \cdot \left(6 \cdot x - 15\right) + 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    13. lift-*.f64N/A

      \[\leadsto \left(\left(x \cdot \left(6 \cdot x - 15\right) + 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    14. *-commutativeN/A

      \[\leadsto \left(\left(\left(6 \cdot x - 15\right) \cdot x + 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    15. lower-fma.f6499.8%

      \[\leadsto \left(\mathsf{fma}\left(6 \cdot x - 15, x, 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    16. lift--.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(6 \cdot x - 15, x, 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    17. sub-flipN/A

      \[\leadsto \left(\mathsf{fma}\left(6 \cdot x + \left(\mathsf{neg}\left(15\right)\right), x, 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    18. lift-*.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(6 \cdot x + \left(\mathsf{neg}\left(15\right)\right), x, 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    19. *-commutativeN/A

      \[\leadsto \left(\mathsf{fma}\left(x \cdot 6 + \left(\mathsf{neg}\left(15\right)\right), x, 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    20. metadata-evalN/A

      \[\leadsto \left(\mathsf{fma}\left(x \cdot 6 + -15, x, 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    21. lower-fma.f6499.8%

      \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(x, 6, -15\right), x, 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
  11. Applied rewrites99.8%

    \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(x, 6, -15\right), x, 10\right) \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{x} \]
  12. Add Preprocessing

Alternative 4: 98.7% accurate, 4.4× speedup?

\[\left(\mathsf{fma}\left(-15, x, 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
(FPCore (x)
  :precision binary64
  (* (* (fma -15.0 x 10.0) (* x x)) x))
double code(double x) {
	return (fma(-15.0, x, 10.0) * (x * x)) * x;
}
function code(x)
	return Float64(Float64(fma(-15.0, x, 10.0) * Float64(x * x)) * x)
end
code[x_] := N[(N[(N[(-15.0 * x + 10.0), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]
\left(\mathsf{fma}\left(-15, x, 10\right) \cdot \left(x \cdot x\right)\right) \cdot x
Derivation
  1. Initial program 99.8%

    \[\left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) + 10 \cdot {x}^{3} \]
  2. Taylor expanded in x around 0

    \[\leadsto \color{blue}{{x}^{3} \cdot \left(10 + -15 \cdot x\right)} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto {x}^{3} \cdot \color{blue}{\left(10 + -15 \cdot x\right)} \]
    2. lower-pow.f64N/A

      \[\leadsto {x}^{3} \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    3. lower-+.f64N/A

      \[\leadsto {x}^{3} \cdot \left(10 + \color{blue}{-15 \cdot x}\right) \]
    4. lower-*.f6498.7%

      \[\leadsto {x}^{3} \cdot \left(10 + -15 \cdot \color{blue}{x}\right) \]
  4. Applied rewrites98.7%

    \[\leadsto \color{blue}{{x}^{3} \cdot \left(10 + -15 \cdot x\right)} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto {x}^{3} \cdot \color{blue}{\left(10 + -15 \cdot x\right)} \]
    2. lift-pow.f64N/A

      \[\leadsto {x}^{3} \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    3. pow3N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    4. lift-*.f64N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(10 + -15 \cdot x\right) \]
    5. lift-*.f64N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    6. *-commutativeN/A

      \[\leadsto \left(10 + -15 \cdot x\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \]
    7. lift-*.f64N/A

      \[\leadsto \left(10 + -15 \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{x}\right) \]
    8. associate-*r*N/A

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{x} \]
    9. lower-*.f64N/A

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{x} \]
    10. lower-*.f6498.7%

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    11. lift-+.f64N/A

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    12. +-commutativeN/A

      \[\leadsto \left(\left(-15 \cdot x + 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    13. lift-*.f64N/A

      \[\leadsto \left(\left(-15 \cdot x + 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
    14. lower-fma.f6498.7%

      \[\leadsto \left(\mathsf{fma}\left(-15, x, 10\right) \cdot \left(x \cdot x\right)\right) \cdot x \]
  6. Applied rewrites98.7%

    \[\leadsto \left(\mathsf{fma}\left(-15, x, 10\right) \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{x} \]
  7. Add Preprocessing

Alternative 5: 98.7% accurate, 4.4× speedup?

\[\left(\left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot x\right) \cdot x \]
(FPCore (x)
  :precision binary64
  (* (* (* (fma -15.0 x 10.0) x) x) x))
double code(double x) {
	return ((fma(-15.0, x, 10.0) * x) * x) * x;
}
function code(x)
	return Float64(Float64(Float64(fma(-15.0, x, 10.0) * x) * x) * x)
end
code[x_] := N[(N[(N[(N[(-15.0 * x + 10.0), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]
\left(\left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot x\right) \cdot x
Derivation
  1. Initial program 99.8%

    \[\left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) + 10 \cdot {x}^{3} \]
  2. Taylor expanded in x around 0

    \[\leadsto \color{blue}{{x}^{3} \cdot \left(10 + -15 \cdot x\right)} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto {x}^{3} \cdot \color{blue}{\left(10 + -15 \cdot x\right)} \]
    2. lower-pow.f64N/A

      \[\leadsto {x}^{3} \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    3. lower-+.f64N/A

      \[\leadsto {x}^{3} \cdot \left(10 + \color{blue}{-15 \cdot x}\right) \]
    4. lower-*.f6498.7%

      \[\leadsto {x}^{3} \cdot \left(10 + -15 \cdot \color{blue}{x}\right) \]
  4. Applied rewrites98.7%

    \[\leadsto \color{blue}{{x}^{3} \cdot \left(10 + -15 \cdot x\right)} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto {x}^{3} \cdot \color{blue}{\left(10 + -15 \cdot x\right)} \]
    2. lift-pow.f64N/A

      \[\leadsto {x}^{3} \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    3. pow3N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    4. lift-*.f64N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(10 + -15 \cdot x\right) \]
    5. lift-*.f64N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    6. *-commutativeN/A

      \[\leadsto \left(10 + -15 \cdot x\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \]
    7. lift-*.f64N/A

      \[\leadsto \left(10 + -15 \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{x}\right) \]
    8. *-commutativeN/A

      \[\leadsto \left(10 + -15 \cdot x\right) \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right) \]
    9. associate-*r*N/A

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    10. lower-*.f64N/A

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    11. lower-*.f6498.7%

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{x} \cdot x\right) \]
    12. lift-+.f64N/A

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
    13. +-commutativeN/A

      \[\leadsto \left(\left(-15 \cdot x + 10\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
    14. lift-*.f64N/A

      \[\leadsto \left(\left(-15 \cdot x + 10\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
    15. lower-fma.f6498.7%

      \[\leadsto \left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
  6. Applied rewrites98.7%

    \[\leadsto \left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
  7. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot \left(x \cdot \color{blue}{x}\right) \]
    3. associate-*r*N/A

      \[\leadsto \left(\left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot x\right) \cdot \color{blue}{x} \]
    4. lower-*.f64N/A

      \[\leadsto \left(\left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot x\right) \cdot \color{blue}{x} \]
    5. lower-*.f6498.7%

      \[\leadsto \left(\left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot x\right) \cdot x \]
  8. Applied rewrites98.7%

    \[\leadsto \left(\left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot x\right) \cdot \color{blue}{x} \]
  9. Add Preprocessing

Alternative 6: 97.6% accurate, 6.6× speedup?

\[\left(\left(x \cdot x\right) \cdot 10\right) \cdot x \]
(FPCore (x)
  :precision binary64
  (* (* (* x x) 10.0) x))
double code(double x) {
	return ((x * x) * 10.0) * x;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((x * x) * 10.0d0) * x
end function
public static double code(double x) {
	return ((x * x) * 10.0) * x;
}
def code(x):
	return ((x * x) * 10.0) * x
function code(x)
	return Float64(Float64(Float64(x * x) * 10.0) * x)
end
function tmp = code(x)
	tmp = ((x * x) * 10.0) * x;
end
code[x_] := N[(N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision] * x), $MachinePrecision]
\left(\left(x \cdot x\right) \cdot 10\right) \cdot x
Derivation
  1. Initial program 99.8%

    \[\left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) + 10 \cdot {x}^{3} \]
  2. Taylor expanded in x around 0

    \[\leadsto \color{blue}{{x}^{3} \cdot \left(10 + -15 \cdot x\right)} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto {x}^{3} \cdot \color{blue}{\left(10 + -15 \cdot x\right)} \]
    2. lower-pow.f64N/A

      \[\leadsto {x}^{3} \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    3. lower-+.f64N/A

      \[\leadsto {x}^{3} \cdot \left(10 + \color{blue}{-15 \cdot x}\right) \]
    4. lower-*.f6498.7%

      \[\leadsto {x}^{3} \cdot \left(10 + -15 \cdot \color{blue}{x}\right) \]
  4. Applied rewrites98.7%

    \[\leadsto \color{blue}{{x}^{3} \cdot \left(10 + -15 \cdot x\right)} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto {x}^{3} \cdot \color{blue}{\left(10 + -15 \cdot x\right)} \]
    2. lift-pow.f64N/A

      \[\leadsto {x}^{3} \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    3. pow3N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    4. lift-*.f64N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(10 + -15 \cdot x\right) \]
    5. lift-*.f64N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
    6. *-commutativeN/A

      \[\leadsto \left(10 + -15 \cdot x\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \]
    7. lift-*.f64N/A

      \[\leadsto \left(10 + -15 \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{x}\right) \]
    8. *-commutativeN/A

      \[\leadsto \left(10 + -15 \cdot x\right) \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right) \]
    9. associate-*r*N/A

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    10. lower-*.f64N/A

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    11. lower-*.f6498.7%

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{x} \cdot x\right) \]
    12. lift-+.f64N/A

      \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
    13. +-commutativeN/A

      \[\leadsto \left(\left(-15 \cdot x + 10\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
    14. lift-*.f64N/A

      \[\leadsto \left(\left(-15 \cdot x + 10\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
    15. lower-fma.f6498.7%

      \[\leadsto \left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
  6. Applied rewrites98.7%

    \[\leadsto \left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
  7. Taylor expanded in x around 0

    \[\leadsto \left(10 \cdot x\right) \cdot \left(x \cdot x\right) \]
  8. Step-by-step derivation
    1. Applied rewrites97.6%

      \[\leadsto \left(10 \cdot x\right) \cdot \left(x \cdot x\right) \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(10 \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
      2. *-commutativeN/A

        \[\leadsto \left(x \cdot x\right) \cdot \color{blue}{\left(10 \cdot x\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \left(x \cdot x\right) \cdot \left(10 \cdot \color{blue}{x}\right) \]
      4. associate-*r*N/A

        \[\leadsto \left(\left(x \cdot x\right) \cdot 10\right) \cdot \color{blue}{x} \]
      5. lower-*.f64N/A

        \[\leadsto \left(\left(x \cdot x\right) \cdot 10\right) \cdot \color{blue}{x} \]
      6. lower-*.f6497.6%

        \[\leadsto \left(\left(x \cdot x\right) \cdot 10\right) \cdot x \]
    3. Applied rewrites97.6%

      \[\leadsto \left(\left(x \cdot x\right) \cdot 10\right) \cdot \color{blue}{x} \]
    4. Add Preprocessing

    Alternative 7: 97.6% accurate, 6.6× speedup?

    \[\left(10 \cdot x\right) \cdot \left(x \cdot x\right) \]
    (FPCore (x)
      :precision binary64
      (* (* 10.0 x) (* x x)))
    double code(double x) {
    	return (10.0 * x) * (x * x);
    }
    
    real(8) function code(x)
        real(8), intent (in) :: x
        code = (10.0d0 * x) * (x * x)
    end function
    
    public static double code(double x) {
    	return (10.0 * x) * (x * x);
    }
    
    def code(x):
    	return (10.0 * x) * (x * x)
    
    function code(x)
    	return Float64(Float64(10.0 * x) * Float64(x * x))
    end
    
    function tmp = code(x)
    	tmp = (10.0 * x) * (x * x);
    end
    
    code[x_] := N[(N[(10.0 * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]
    
    \left(10 \cdot x\right) \cdot \left(x \cdot x\right)
    
    Derivation
    1. Initial program 99.8%

      \[\left(6 \cdot {x}^{5} - 15 \cdot {x}^{4}\right) + 10 \cdot {x}^{3} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{{x}^{3} \cdot \left(10 + -15 \cdot x\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {x}^{3} \cdot \color{blue}{\left(10 + -15 \cdot x\right)} \]
      2. lower-pow.f64N/A

        \[\leadsto {x}^{3} \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
      3. lower-+.f64N/A

        \[\leadsto {x}^{3} \cdot \left(10 + \color{blue}{-15 \cdot x}\right) \]
      4. lower-*.f6498.7%

        \[\leadsto {x}^{3} \cdot \left(10 + -15 \cdot \color{blue}{x}\right) \]
    4. Applied rewrites98.7%

      \[\leadsto \color{blue}{{x}^{3} \cdot \left(10 + -15 \cdot x\right)} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto {x}^{3} \cdot \color{blue}{\left(10 + -15 \cdot x\right)} \]
      2. lift-pow.f64N/A

        \[\leadsto {x}^{3} \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
      3. pow3N/A

        \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
      4. lift-*.f64N/A

        \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(10 + -15 \cdot x\right) \]
      5. lift-*.f64N/A

        \[\leadsto \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{10} + -15 \cdot x\right) \]
      6. *-commutativeN/A

        \[\leadsto \left(10 + -15 \cdot x\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \]
      7. lift-*.f64N/A

        \[\leadsto \left(10 + -15 \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{x}\right) \]
      8. *-commutativeN/A

        \[\leadsto \left(10 + -15 \cdot x\right) \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right) \]
      9. associate-*r*N/A

        \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
      11. lower-*.f6498.7%

        \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \left(\color{blue}{x} \cdot x\right) \]
      12. lift-+.f64N/A

        \[\leadsto \left(\left(10 + -15 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
      13. +-commutativeN/A

        \[\leadsto \left(\left(-15 \cdot x + 10\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
      14. lift-*.f64N/A

        \[\leadsto \left(\left(-15 \cdot x + 10\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
      15. lower-fma.f6498.7%

        \[\leadsto \left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot \left(x \cdot x\right) \]
    6. Applied rewrites98.7%

      \[\leadsto \left(\mathsf{fma}\left(-15, x, 10\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    7. Taylor expanded in x around 0

      \[\leadsto \left(10 \cdot x\right) \cdot \left(x \cdot x\right) \]
    8. Step-by-step derivation
      1. Applied rewrites97.6%

        \[\leadsto \left(10 \cdot x\right) \cdot \left(x \cdot x\right) \]
      2. Add Preprocessing

      Reproduce

      ?
      herbie shell --seed 1 
      (FPCore (x)
        :name "6*pow(x,5)-15*pow(x,4)+10*pow(x,3)"
        :precision binary64
        :pre (and (<= 0.0 x) (<= x 1.0))
        (+ (- (* 6.0 (pow x 5.0)) (* 15.0 (pow x 4.0))) (* 10.0 (pow x 3.0))))