ENA, Section 1.4, Exercise 1

Percentage Accurate: 94.5% → 99.4%
Time: 10.1s
Alternatives: 18
Speedup: 1.0×

Specification

?
\[1.99 \leq x \land x \leq 2.01\]
\[\begin{array}{l} \\ \cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \end{array} \]
(FPCore (x) :precision binary64 (* (cos x) (exp (* 10.0 (* x x)))))
double code(double x) {
	return cos(x) * exp((10.0 * (x * x)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = cos(x) * exp((10.0d0 * (x * x)))
end function
public static double code(double x) {
	return Math.cos(x) * Math.exp((10.0 * (x * x)));
}
def code(x):
	return math.cos(x) * math.exp((10.0 * (x * x)))
function code(x)
	return Float64(cos(x) * exp(Float64(10.0 * Float64(x * x))))
end
function tmp = code(x)
	tmp = cos(x) * exp((10.0 * (x * x)));
end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\cos x \cdot e^{10 \cdot \left(x \cdot x\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 18 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: 94.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \end{array} \]
(FPCore (x) :precision binary64 (* (cos x) (exp (* 10.0 (* x x)))))
double code(double x) {
	return cos(x) * exp((10.0 * (x * x)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = cos(x) * exp((10.0d0 * (x * x)))
end function
public static double code(double x) {
	return Math.cos(x) * Math.exp((10.0 * (x * x)));
}
def code(x):
	return math.cos(x) * math.exp((10.0 * (x * x)))
function code(x)
	return Float64(cos(x) * exp(Float64(10.0 * Float64(x * x))))
end
function tmp = code(x)
	tmp = cos(x) * exp((10.0 * (x * x)));
end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\cos x \cdot e^{10 \cdot \left(x \cdot x\right)}
\end{array}

Alternative 1: 99.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ {\left({\left(e^{20}\right)}^{x}\right)}^{\left(0.5 \cdot x\right)} \cdot \cos x \end{array} \]
(FPCore (x) :precision binary64 (* (pow (pow (exp 20.0) x) (* 0.5 x)) (cos x)))
double code(double x) {
	return pow(pow(exp(20.0), x), (0.5 * x)) * cos(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((exp(20.0d0) ** x) ** (0.5d0 * x)) * cos(x)
end function
public static double code(double x) {
	return Math.pow(Math.pow(Math.exp(20.0), x), (0.5 * x)) * Math.cos(x);
}
def code(x):
	return math.pow(math.pow(math.exp(20.0), x), (0.5 * x)) * math.cos(x)
function code(x)
	return Float64(((exp(20.0) ^ x) ^ Float64(0.5 * x)) * cos(x))
end
function tmp = code(x)
	tmp = ((exp(20.0) ^ x) ^ (0.5 * x)) * cos(x);
end
code[x_] := N[(N[Power[N[Power[N[Exp[20.0], $MachinePrecision], x], $MachinePrecision], N[(0.5 * x), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left({\left(e^{20}\right)}^{x}\right)}^{\left(0.5 \cdot x\right)} \cdot \cos x
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-exp.f64N/A

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

      \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
    3. exp-prodN/A

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(x \cdot x\right)}} \]
    5. pow-unpowN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
    6. sqr-powN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}}^{x} \]
    7. unpow-prod-downN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{x} \cdot {\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{x}\right)} \]
    8. pow-prod-upN/A

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

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{\left(x + x\right)}} \]
    10. pow-to-expN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{\log \left(e^{10}\right) \cdot \frac{x}{2}}\right)}}^{\left(x + x\right)} \]
    11. rem-log-expN/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{10} \cdot \frac{x}{2}}\right)}^{\left(x + x\right)} \]
    12. associate-*r/N/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{\frac{10 \cdot x}{2}}}\right)}^{\left(x + x\right)} \]
    13. *-commutativeN/A

      \[\leadsto \cos x \cdot {\left(e^{\frac{\color{blue}{x \cdot 10}}{2}}\right)}^{\left(x + x\right)} \]
    14. associate-/l*N/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{x \cdot \frac{10}{2}}}\right)}^{\left(x + x\right)} \]
    15. pow-expN/A

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

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{x}\right)}^{\left(\frac{10}{2}\right)}\right)}}^{\left(x + x\right)} \]
    17. lower-exp.f64N/A

      \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{x}\right)}}^{\left(\frac{10}{2}\right)}\right)}^{\left(x + x\right)} \]
    18. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{\color{blue}{5}}\right)}^{\left(x + x\right)} \]
    19. count-2N/A

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{5}\right)}^{\color{blue}{\left(2 \cdot x\right)}} \]
    20. lower-*.f6496.7

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{5}\right)}^{\color{blue}{\left(2 \cdot x\right)}} \]
  4. Applied rewrites96.7%

    \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{x}\right)}^{5}\right)}^{\left(2 \cdot x\right)}} \]
  5. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{x}\right)}^{5}\right)}^{\left(2 \cdot x\right)}} \]
    2. lift-pow.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{x}\right)}^{5}\right)}}^{\left(2 \cdot x\right)} \]
    3. pow-powN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{x}\right)}^{\left(5 \cdot \left(2 \cdot x\right)\right)}} \]
    4. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{x}\right)}}^{\left(5 \cdot \left(2 \cdot x\right)\right)} \]
    5. lift-*.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\left(5 \cdot \color{blue}{\left(2 \cdot x\right)}\right)} \]
    6. associate-*r*N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\color{blue}{\left(\left(5 \cdot 2\right) \cdot x\right)}} \]
    7. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\left(\color{blue}{10} \cdot x\right)} \]
    8. rem-log-expN/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\color{blue}{\log \left(e^{10 \cdot x}\right)}} \]
    9. pow-expN/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\log \color{blue}{\left({\left(e^{10}\right)}^{x}\right)}} \]
    10. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\log \left({\color{blue}{\left(e^{10}\right)}}^{x}\right)} \]
    11. lift-pow.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\log \color{blue}{\left({\left(e^{10}\right)}^{x}\right)}} \]
    12. pow-expN/A

      \[\leadsto \cos x \cdot \color{blue}{e^{x \cdot \log \left({\left(e^{10}\right)}^{x}\right)}} \]
    13. *-commutativeN/A

      \[\leadsto \cos x \cdot e^{\color{blue}{\log \left({\left(e^{10}\right)}^{x}\right) \cdot x}} \]
    14. pow-to-expN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
    15. sqr-powN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right)} \]
    16. *-rgt-identityN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{x \cdot 1}}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    17. lift-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{x \cdot 1}}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    18. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\color{blue}{\left(\frac{x \cdot 1}{2}\right)}} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    19. *-rgt-identityN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x \cdot 1}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{x \cdot 1}}{2}\right)}\right) \]
    20. lift-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x \cdot 1}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{x \cdot 1}}{2}\right)}\right) \]
    21. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x \cdot 1}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\color{blue}{\left(\frac{x \cdot 1}{2}\right)}}\right) \]
    22. pow-prod-downN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x} \cdot {\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x \cdot 1}{2}\right)}} \]
  6. Applied rewrites99.4%

    \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(0.5 \cdot x\right)}} \]
  7. Final simplification99.4%

    \[\leadsto {\left({\left(e^{20}\right)}^{x}\right)}^{\left(0.5 \cdot x\right)} \cdot \cos x \]
  8. Add Preprocessing

Alternative 2: 98.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ {\left({\left(e^{5}\right)}^{x}\right)}^{\left(2 \cdot x\right)} \cdot \cos x \end{array} \]
(FPCore (x) :precision binary64 (* (pow (pow (exp 5.0) x) (* 2.0 x)) (cos x)))
double code(double x) {
	return pow(pow(exp(5.0), x), (2.0 * x)) * cos(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((exp(5.0d0) ** x) ** (2.0d0 * x)) * cos(x)
end function
public static double code(double x) {
	return Math.pow(Math.pow(Math.exp(5.0), x), (2.0 * x)) * Math.cos(x);
}
def code(x):
	return math.pow(math.pow(math.exp(5.0), x), (2.0 * x)) * math.cos(x)
function code(x)
	return Float64(((exp(5.0) ^ x) ^ Float64(2.0 * x)) * cos(x))
end
function tmp = code(x)
	tmp = ((exp(5.0) ^ x) ^ (2.0 * x)) * cos(x);
end
code[x_] := N[(N[Power[N[Power[N[Exp[5.0], $MachinePrecision], x], $MachinePrecision], N[(2.0 * x), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left({\left(e^{5}\right)}^{x}\right)}^{\left(2 \cdot x\right)} \cdot \cos x
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-exp.f64N/A

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

      \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
    3. exp-prodN/A

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(x \cdot x\right)}} \]
    5. pow-unpowN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
    6. sqr-powN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}}^{x} \]
    7. unpow-prod-downN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{x} \cdot {\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{x}\right)} \]
    8. pow-prod-upN/A

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

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{\left(x + x\right)}} \]
    10. pow-to-expN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{\log \left(e^{10}\right) \cdot \frac{x}{2}}\right)}}^{\left(x + x\right)} \]
    11. rem-log-expN/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{10} \cdot \frac{x}{2}}\right)}^{\left(x + x\right)} \]
    12. associate-*r/N/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{\frac{10 \cdot x}{2}}}\right)}^{\left(x + x\right)} \]
    13. *-commutativeN/A

      \[\leadsto \cos x \cdot {\left(e^{\frac{\color{blue}{x \cdot 10}}{2}}\right)}^{\left(x + x\right)} \]
    14. associate-/l*N/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{x \cdot \frac{10}{2}}}\right)}^{\left(x + x\right)} \]
    15. pow-expN/A

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

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{x}\right)}^{\left(\frac{10}{2}\right)}\right)}}^{\left(x + x\right)} \]
    17. lower-exp.f64N/A

      \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{x}\right)}}^{\left(\frac{10}{2}\right)}\right)}^{\left(x + x\right)} \]
    18. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{\color{blue}{5}}\right)}^{\left(x + x\right)} \]
    19. count-2N/A

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{5}\right)}^{\color{blue}{\left(2 \cdot x\right)}} \]
    20. lower-*.f6496.7

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{5}\right)}^{\color{blue}{\left(2 \cdot x\right)}} \]
  4. Applied rewrites96.7%

    \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{x}\right)}^{5}\right)}^{\left(2 \cdot x\right)}} \]
  5. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{x}\right)}^{5}\right)}}^{\left(2 \cdot x\right)} \]
    2. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{x}\right)}}^{5}\right)}^{\left(2 \cdot x\right)} \]
    3. pow-expN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{x \cdot 5}\right)}}^{\left(2 \cdot x\right)} \]
    4. *-commutativeN/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{5 \cdot x}}\right)}^{\left(2 \cdot x\right)} \]
    5. exp-prodN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{5}\right)}^{x}\right)}}^{\left(2 \cdot x\right)} \]
    6. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left({\left(e^{\color{blue}{10 \cdot \frac{1}{2}}}\right)}^{x}\right)}^{\left(2 \cdot x\right)} \]
    7. pow-expN/A

      \[\leadsto \cos x \cdot {\left({\color{blue}{\left({\left(e^{10}\right)}^{\frac{1}{2}}\right)}}^{x}\right)}^{\left(2 \cdot x\right)} \]
    8. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\left({\left({\color{blue}{\left(e^{10}\right)}}^{\frac{1}{2}}\right)}^{x}\right)}^{\left(2 \cdot x\right)} \]
    9. lower-pow.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left({\left(e^{10}\right)}^{\frac{1}{2}}\right)}^{x}\right)}}^{\left(2 \cdot x\right)} \]
    10. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\left({\left({\color{blue}{\left(e^{10}\right)}}^{\frac{1}{2}}\right)}^{x}\right)}^{\left(2 \cdot x\right)} \]
    11. pow-expN/A

      \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{10 \cdot \frac{1}{2}}\right)}}^{x}\right)}^{\left(2 \cdot x\right)} \]
    12. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left({\left(e^{\color{blue}{5}}\right)}^{x}\right)}^{\left(2 \cdot x\right)} \]
    13. lower-exp.f6498.2

      \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{5}\right)}}^{x}\right)}^{\left(2 \cdot x\right)} \]
  6. Applied rewrites98.2%

    \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{5}\right)}^{x}\right)}}^{\left(2 \cdot x\right)} \]
  7. Final simplification98.2%

    \[\leadsto {\left({\left(e^{5}\right)}^{x}\right)}^{\left(2 \cdot x\right)} \cdot \cos x \]
  8. Add Preprocessing

Alternative 3: 97.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ {\left({\left(e^{10}\right)}^{x}\right)}^{x} \cdot \cos x \end{array} \]
(FPCore (x) :precision binary64 (* (pow (pow (exp 10.0) x) x) (cos x)))
double code(double x) {
	return pow(pow(exp(10.0), x), x) * cos(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((exp(10.0d0) ** x) ** x) * cos(x)
end function
public static double code(double x) {
	return Math.pow(Math.pow(Math.exp(10.0), x), x) * Math.cos(x);
}
def code(x):
	return math.pow(math.pow(math.exp(10.0), x), x) * math.cos(x)
function code(x)
	return Float64(((exp(10.0) ^ x) ^ x) * cos(x))
end
function tmp = code(x)
	tmp = ((exp(10.0) ^ x) ^ x) * cos(x);
end
code[x_] := N[(N[Power[N[Power[N[Exp[10.0], $MachinePrecision], x], $MachinePrecision], x], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left({\left(e^{10}\right)}^{x}\right)}^{x} \cdot \cos x
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-exp.f64N/A

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

      \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
    3. exp-prodN/A

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(x \cdot x\right)}} \]
    5. pow-unpowN/A

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

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
    7. lower-pow.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{10}\right)}^{x}\right)}}^{x} \]
    8. lower-exp.f6497.9

      \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{10}\right)}}^{x}\right)}^{x} \]
  4. Applied rewrites97.9%

    \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
  5. Final simplification97.9%

    \[\leadsto {\left({\left(e^{10}\right)}^{x}\right)}^{x} \cdot \cos x \]
  6. Add Preprocessing

Alternative 4: 96.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ {\left({\left(e^{x}\right)}^{10}\right)}^{x} \cdot \cos x \end{array} \]
(FPCore (x) :precision binary64 (* (pow (pow (exp x) 10.0) x) (cos x)))
double code(double x) {
	return pow(pow(exp(x), 10.0), x) * cos(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((exp(x) ** 10.0d0) ** x) * cos(x)
end function
public static double code(double x) {
	return Math.pow(Math.pow(Math.exp(x), 10.0), x) * Math.cos(x);
}
def code(x):
	return math.pow(math.pow(math.exp(x), 10.0), x) * math.cos(x)
function code(x)
	return Float64(((exp(x) ^ 10.0) ^ x) * cos(x))
end
function tmp = code(x)
	tmp = ((exp(x) ^ 10.0) ^ x) * cos(x);
end
code[x_] := N[(N[Power[N[Power[N[Exp[x], $MachinePrecision], 10.0], $MachinePrecision], x], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left({\left(e^{x}\right)}^{10}\right)}^{x} \cdot \cos x
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf

    \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot {x}^{2}}} \]
  4. Step-by-step derivation
    1. unpow2N/A

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

      \[\leadsto \cos x \cdot e^{\color{blue}{\left(10 \cdot x\right) \cdot x}} \]
    3. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10 \cdot x}\right)}^{x}} \]
    4. lower-pow.f64N/A

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

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{x \cdot 10}}\right)}^{x} \]
    6. exp-prodN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{x}\right)}^{10}\right)}}^{x} \]
    7. lower-pow.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{x}\right)}^{10}\right)}}^{x} \]
    8. lower-exp.f6496.8

      \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{x}\right)}}^{10}\right)}^{x} \]
  5. Applied rewrites96.8%

    \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{x}\right)}^{10}\right)}^{x}} \]
  6. Final simplification96.8%

    \[\leadsto {\left({\left(e^{x}\right)}^{10}\right)}^{x} \cdot \cos x \]
  7. Add Preprocessing

Alternative 5: 95.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ {\left(e^{20 \cdot x}\right)}^{\left(0.5 \cdot x\right)} \cdot \cos x \end{array} \]
(FPCore (x) :precision binary64 (* (pow (exp (* 20.0 x)) (* 0.5 x)) (cos x)))
double code(double x) {
	return pow(exp((20.0 * x)), (0.5 * x)) * cos(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (exp((20.0d0 * x)) ** (0.5d0 * x)) * cos(x)
end function
public static double code(double x) {
	return Math.pow(Math.exp((20.0 * x)), (0.5 * x)) * Math.cos(x);
}
def code(x):
	return math.pow(math.exp((20.0 * x)), (0.5 * x)) * math.cos(x)
function code(x)
	return Float64((exp(Float64(20.0 * x)) ^ Float64(0.5 * x)) * cos(x))
end
function tmp = code(x)
	tmp = (exp((20.0 * x)) ^ (0.5 * x)) * cos(x);
end
code[x_] := N[(N[Power[N[Exp[N[(20.0 * x), $MachinePrecision]], $MachinePrecision], N[(0.5 * x), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(e^{20 \cdot x}\right)}^{\left(0.5 \cdot x\right)} \cdot \cos x
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-exp.f64N/A

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

      \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
    3. exp-prodN/A

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(x \cdot x\right)}} \]
    5. pow-unpowN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
    6. sqr-powN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}}^{x} \]
    7. unpow-prod-downN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{x} \cdot {\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{x}\right)} \]
    8. pow-prod-upN/A

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

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{\left(x + x\right)}} \]
    10. pow-to-expN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{\log \left(e^{10}\right) \cdot \frac{x}{2}}\right)}}^{\left(x + x\right)} \]
    11. rem-log-expN/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{10} \cdot \frac{x}{2}}\right)}^{\left(x + x\right)} \]
    12. associate-*r/N/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{\frac{10 \cdot x}{2}}}\right)}^{\left(x + x\right)} \]
    13. *-commutativeN/A

      \[\leadsto \cos x \cdot {\left(e^{\frac{\color{blue}{x \cdot 10}}{2}}\right)}^{\left(x + x\right)} \]
    14. associate-/l*N/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{x \cdot \frac{10}{2}}}\right)}^{\left(x + x\right)} \]
    15. pow-expN/A

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

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{x}\right)}^{\left(\frac{10}{2}\right)}\right)}}^{\left(x + x\right)} \]
    17. lower-exp.f64N/A

      \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{x}\right)}}^{\left(\frac{10}{2}\right)}\right)}^{\left(x + x\right)} \]
    18. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{\color{blue}{5}}\right)}^{\left(x + x\right)} \]
    19. count-2N/A

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{5}\right)}^{\color{blue}{\left(2 \cdot x\right)}} \]
    20. lower-*.f6496.7

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{5}\right)}^{\color{blue}{\left(2 \cdot x\right)}} \]
  4. Applied rewrites96.7%

    \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{x}\right)}^{5}\right)}^{\left(2 \cdot x\right)}} \]
  5. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{x}\right)}^{5}\right)}^{\left(2 \cdot x\right)}} \]
    2. lift-pow.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{x}\right)}^{5}\right)}}^{\left(2 \cdot x\right)} \]
    3. pow-powN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{x}\right)}^{\left(5 \cdot \left(2 \cdot x\right)\right)}} \]
    4. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{x}\right)}}^{\left(5 \cdot \left(2 \cdot x\right)\right)} \]
    5. lift-*.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\left(5 \cdot \color{blue}{\left(2 \cdot x\right)}\right)} \]
    6. associate-*r*N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\color{blue}{\left(\left(5 \cdot 2\right) \cdot x\right)}} \]
    7. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\left(\color{blue}{10} \cdot x\right)} \]
    8. rem-log-expN/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\color{blue}{\log \left(e^{10 \cdot x}\right)}} \]
    9. pow-expN/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\log \color{blue}{\left({\left(e^{10}\right)}^{x}\right)}} \]
    10. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\log \left({\color{blue}{\left(e^{10}\right)}}^{x}\right)} \]
    11. lift-pow.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\log \color{blue}{\left({\left(e^{10}\right)}^{x}\right)}} \]
    12. pow-expN/A

      \[\leadsto \cos x \cdot \color{blue}{e^{x \cdot \log \left({\left(e^{10}\right)}^{x}\right)}} \]
    13. *-commutativeN/A

      \[\leadsto \cos x \cdot e^{\color{blue}{\log \left({\left(e^{10}\right)}^{x}\right) \cdot x}} \]
    14. pow-to-expN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
    15. sqr-powN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right)} \]
    16. *-rgt-identityN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{x \cdot 1}}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    17. lift-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{x \cdot 1}}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    18. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\color{blue}{\left(\frac{x \cdot 1}{2}\right)}} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    19. *-rgt-identityN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x \cdot 1}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{x \cdot 1}}{2}\right)}\right) \]
    20. lift-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x \cdot 1}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{x \cdot 1}}{2}\right)}\right) \]
    21. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x \cdot 1}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\color{blue}{\left(\frac{x \cdot 1}{2}\right)}}\right) \]
    22. pow-prod-downN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x} \cdot {\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x \cdot 1}{2}\right)}} \]
  6. Applied rewrites99.4%

    \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(0.5 \cdot x\right)}} \]
  7. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{20}\right)}^{x}\right)}}^{\left(\frac{1}{2} \cdot x\right)} \]
    2. pow-to-expN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{\log \left(e^{20}\right) \cdot x}\right)}}^{\left(\frac{1}{2} \cdot x\right)} \]
    3. rem-log-expN/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{\log \left(e^{\log \left(e^{20}\right) \cdot x}\right)}}\right)}^{\left(\frac{1}{2} \cdot x\right)} \]
    4. pow-to-expN/A

      \[\leadsto \cos x \cdot {\left(e^{\log \color{blue}{\left({\left(e^{20}\right)}^{x}\right)}}\right)}^{\left(\frac{1}{2} \cdot x\right)} \]
    5. lift-pow.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{\log \color{blue}{\left({\left(e^{20}\right)}^{x}\right)}}\right)}^{\left(\frac{1}{2} \cdot x\right)} \]
    6. lower-exp.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{\log \left({\left(e^{20}\right)}^{x}\right)}\right)}}^{\left(\frac{1}{2} \cdot x\right)} \]
    7. lift-pow.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{\log \color{blue}{\left({\left(e^{20}\right)}^{x}\right)}}\right)}^{\left(\frac{1}{2} \cdot x\right)} \]
    8. pow-to-expN/A

      \[\leadsto \cos x \cdot {\left(e^{\log \color{blue}{\left(e^{\log \left(e^{20}\right) \cdot x}\right)}}\right)}^{\left(\frac{1}{2} \cdot x\right)} \]
    9. rem-log-expN/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{\log \left(e^{20}\right) \cdot x}}\right)}^{\left(\frac{1}{2} \cdot x\right)} \]
    10. lower-*.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{\log \left(e^{20}\right) \cdot x}}\right)}^{\left(\frac{1}{2} \cdot x\right)} \]
    11. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{\log \color{blue}{\left(e^{20}\right)} \cdot x}\right)}^{\left(\frac{1}{2} \cdot x\right)} \]
    12. rem-log-exp95.3

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{20} \cdot x}\right)}^{\left(0.5 \cdot x\right)} \]
  8. Applied rewrites95.3%

    \[\leadsto \cos x \cdot {\color{blue}{\left(e^{20 \cdot x}\right)}}^{\left(0.5 \cdot x\right)} \]
  9. Final simplification95.3%

    \[\leadsto {\left(e^{20 \cdot x}\right)}^{\left(0.5 \cdot x\right)} \cdot \cos x \]
  10. Add Preprocessing

Alternative 6: 95.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ {\left(e^{20}\right)}^{\left(\left(x \cdot x\right) \cdot 0.5\right)} \cdot \cos x \end{array} \]
(FPCore (x) :precision binary64 (* (pow (exp 20.0) (* (* x x) 0.5)) (cos x)))
double code(double x) {
	return pow(exp(20.0), ((x * x) * 0.5)) * cos(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (exp(20.0d0) ** ((x * x) * 0.5d0)) * cos(x)
end function
public static double code(double x) {
	return Math.pow(Math.exp(20.0), ((x * x) * 0.5)) * Math.cos(x);
}
def code(x):
	return math.pow(math.exp(20.0), ((x * x) * 0.5)) * math.cos(x)
function code(x)
	return Float64((exp(20.0) ^ Float64(Float64(x * x) * 0.5)) * cos(x))
end
function tmp = code(x)
	tmp = (exp(20.0) ^ ((x * x) * 0.5)) * cos(x);
end
code[x_] := N[(N[Power[N[Exp[20.0], $MachinePrecision], N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(e^{20}\right)}^{\left(\left(x \cdot x\right) \cdot 0.5\right)} \cdot \cos x
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-exp.f64N/A

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

      \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
    3. exp-prodN/A

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(x \cdot x\right)}} \]
    5. pow-unpowN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
    6. sqr-powN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}}^{x} \]
    7. unpow-prod-downN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{x} \cdot {\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{x}\right)} \]
    8. pow-prod-upN/A

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

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{\left(x + x\right)}} \]
    10. pow-to-expN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{\log \left(e^{10}\right) \cdot \frac{x}{2}}\right)}}^{\left(x + x\right)} \]
    11. rem-log-expN/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{10} \cdot \frac{x}{2}}\right)}^{\left(x + x\right)} \]
    12. associate-*r/N/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{\frac{10 \cdot x}{2}}}\right)}^{\left(x + x\right)} \]
    13. *-commutativeN/A

      \[\leadsto \cos x \cdot {\left(e^{\frac{\color{blue}{x \cdot 10}}{2}}\right)}^{\left(x + x\right)} \]
    14. associate-/l*N/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{x \cdot \frac{10}{2}}}\right)}^{\left(x + x\right)} \]
    15. pow-expN/A

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

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{x}\right)}^{\left(\frac{10}{2}\right)}\right)}}^{\left(x + x\right)} \]
    17. lower-exp.f64N/A

      \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{x}\right)}}^{\left(\frac{10}{2}\right)}\right)}^{\left(x + x\right)} \]
    18. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{\color{blue}{5}}\right)}^{\left(x + x\right)} \]
    19. count-2N/A

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{5}\right)}^{\color{blue}{\left(2 \cdot x\right)}} \]
    20. lower-*.f6496.7

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{5}\right)}^{\color{blue}{\left(2 \cdot x\right)}} \]
  4. Applied rewrites96.7%

    \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{x}\right)}^{5}\right)}^{\left(2 \cdot x\right)}} \]
  5. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{x}\right)}^{5}\right)}^{\left(2 \cdot x\right)}} \]
    2. lift-pow.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{x}\right)}^{5}\right)}}^{\left(2 \cdot x\right)} \]
    3. pow-powN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{x}\right)}^{\left(5 \cdot \left(2 \cdot x\right)\right)}} \]
    4. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{x}\right)}}^{\left(5 \cdot \left(2 \cdot x\right)\right)} \]
    5. lift-*.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\left(5 \cdot \color{blue}{\left(2 \cdot x\right)}\right)} \]
    6. associate-*r*N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\color{blue}{\left(\left(5 \cdot 2\right) \cdot x\right)}} \]
    7. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\left(\color{blue}{10} \cdot x\right)} \]
    8. rem-log-expN/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\color{blue}{\log \left(e^{10 \cdot x}\right)}} \]
    9. pow-expN/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\log \color{blue}{\left({\left(e^{10}\right)}^{x}\right)}} \]
    10. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\log \left({\color{blue}{\left(e^{10}\right)}}^{x}\right)} \]
    11. lift-pow.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\log \color{blue}{\left({\left(e^{10}\right)}^{x}\right)}} \]
    12. pow-expN/A

      \[\leadsto \cos x \cdot \color{blue}{e^{x \cdot \log \left({\left(e^{10}\right)}^{x}\right)}} \]
    13. *-commutativeN/A

      \[\leadsto \cos x \cdot e^{\color{blue}{\log \left({\left(e^{10}\right)}^{x}\right) \cdot x}} \]
    14. pow-to-expN/A

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

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{10}\right)}^{x}\right)}}^{x} \]
    16. pow-powN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    17. sqr-powN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left(e^{10}\right)}^{\left(\frac{x \cdot x}{2}\right)} \cdot {\left(e^{10}\right)}^{\left(\frac{x \cdot x}{2}\right)}\right)} \]
    18. associate-*r/N/A

      \[\leadsto \cos x \cdot \left({\left(e^{10}\right)}^{\color{blue}{\left(x \cdot \frac{x}{2}\right)}} \cdot {\left(e^{10}\right)}^{\left(\frac{x \cdot x}{2}\right)}\right) \]
    19. *-rgt-identityN/A

      \[\leadsto \cos x \cdot \left({\left(e^{10}\right)}^{\left(x \cdot \frac{\color{blue}{x \cdot 1}}{2}\right)} \cdot {\left(e^{10}\right)}^{\left(\frac{x \cdot x}{2}\right)}\right) \]
    20. lift-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{10}\right)}^{\left(x \cdot \frac{\color{blue}{x \cdot 1}}{2}\right)} \cdot {\left(e^{10}\right)}^{\left(\frac{x \cdot x}{2}\right)}\right) \]
    21. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{10}\right)}^{\left(x \cdot \color{blue}{\frac{x \cdot 1}{2}}\right)} \cdot {\left(e^{10}\right)}^{\left(\frac{x \cdot x}{2}\right)}\right) \]
    22. associate-*r/N/A

      \[\leadsto \cos x \cdot \left({\left(e^{10}\right)}^{\left(x \cdot \frac{x \cdot 1}{2}\right)} \cdot {\left(e^{10}\right)}^{\color{blue}{\left(x \cdot \frac{x}{2}\right)}}\right) \]
    23. *-rgt-identityN/A

      \[\leadsto \cos x \cdot \left({\left(e^{10}\right)}^{\left(x \cdot \frac{x \cdot 1}{2}\right)} \cdot {\left(e^{10}\right)}^{\left(x \cdot \frac{\color{blue}{x \cdot 1}}{2}\right)}\right) \]
    24. lift-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left(e^{10}\right)}^{\left(x \cdot \frac{x \cdot 1}{2}\right)} \cdot {\left(e^{10}\right)}^{\left(x \cdot \frac{\color{blue}{x \cdot 1}}{2}\right)}\right) \]
  6. Applied rewrites95.2%

    \[\leadsto \cos x \cdot \color{blue}{{\left(e^{20}\right)}^{\left(\left(x \cdot x\right) \cdot 0.5\right)}} \]
  7. Final simplification95.2%

    \[\leadsto {\left(e^{20}\right)}^{\left(\left(x \cdot x\right) \cdot 0.5\right)} \cdot \cos x \]
  8. Add Preprocessing

Alternative 7: 95.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ {\left(e^{5}\right)}^{\left(\left(2 \cdot x\right) \cdot x\right)} \cdot \cos x \end{array} \]
(FPCore (x) :precision binary64 (* (pow (exp 5.0) (* (* 2.0 x) x)) (cos x)))
double code(double x) {
	return pow(exp(5.0), ((2.0 * x) * x)) * cos(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (exp(5.0d0) ** ((2.0d0 * x) * x)) * cos(x)
end function
public static double code(double x) {
	return Math.pow(Math.exp(5.0), ((2.0 * x) * x)) * Math.cos(x);
}
def code(x):
	return math.pow(math.exp(5.0), ((2.0 * x) * x)) * math.cos(x)
function code(x)
	return Float64((exp(5.0) ^ Float64(Float64(2.0 * x) * x)) * cos(x))
end
function tmp = code(x)
	tmp = (exp(5.0) ^ ((2.0 * x) * x)) * cos(x);
end
code[x_] := N[(N[Power[N[Exp[5.0], $MachinePrecision], N[(N[(2.0 * x), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(e^{5}\right)}^{\left(\left(2 \cdot x\right) \cdot x\right)} \cdot \cos x
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-exp.f64N/A

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

      \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
    3. exp-prodN/A

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(x \cdot x\right)}} \]
    5. pow-unpowN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
    6. sqr-powN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}}^{x} \]
    7. unpow-prod-downN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{x} \cdot {\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{x}\right)} \]
    8. pow-prod-upN/A

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

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{\left(x + x\right)}} \]
    10. pow-to-expN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{\log \left(e^{10}\right) \cdot \frac{x}{2}}\right)}}^{\left(x + x\right)} \]
    11. rem-log-expN/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{10} \cdot \frac{x}{2}}\right)}^{\left(x + x\right)} \]
    12. associate-*r/N/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{\frac{10 \cdot x}{2}}}\right)}^{\left(x + x\right)} \]
    13. *-commutativeN/A

      \[\leadsto \cos x \cdot {\left(e^{\frac{\color{blue}{x \cdot 10}}{2}}\right)}^{\left(x + x\right)} \]
    14. associate-/l*N/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{x \cdot \frac{10}{2}}}\right)}^{\left(x + x\right)} \]
    15. pow-expN/A

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

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{x}\right)}^{\left(\frac{10}{2}\right)}\right)}}^{\left(x + x\right)} \]
    17. lower-exp.f64N/A

      \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{x}\right)}}^{\left(\frac{10}{2}\right)}\right)}^{\left(x + x\right)} \]
    18. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{\color{blue}{5}}\right)}^{\left(x + x\right)} \]
    19. count-2N/A

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{5}\right)}^{\color{blue}{\left(2 \cdot x\right)}} \]
    20. lower-*.f6496.7

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{5}\right)}^{\color{blue}{\left(2 \cdot x\right)}} \]
  4. Applied rewrites96.7%

    \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{x}\right)}^{5}\right)}^{\left(2 \cdot x\right)}} \]
  5. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{x}\right)}^{5}\right)}^{\left(2 \cdot x\right)}} \]
    2. lift-pow.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{x}\right)}^{5}\right)}}^{\left(2 \cdot x\right)} \]
    3. pow-powN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{x}\right)}^{\left(5 \cdot \left(2 \cdot x\right)\right)}} \]
    4. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{x}\right)}}^{\left(5 \cdot \left(2 \cdot x\right)\right)} \]
    5. lift-*.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\left(5 \cdot \color{blue}{\left(2 \cdot x\right)}\right)} \]
    6. associate-*r*N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\color{blue}{\left(\left(5 \cdot 2\right) \cdot x\right)}} \]
    7. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\left(\color{blue}{10} \cdot x\right)} \]
    8. rem-log-expN/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\color{blue}{\log \left(e^{10 \cdot x}\right)}} \]
    9. pow-expN/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\log \color{blue}{\left({\left(e^{10}\right)}^{x}\right)}} \]
    10. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\log \left({\color{blue}{\left(e^{10}\right)}}^{x}\right)} \]
    11. lift-pow.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{x}\right)}^{\log \color{blue}{\left({\left(e^{10}\right)}^{x}\right)}} \]
    12. pow-expN/A

      \[\leadsto \cos x \cdot \color{blue}{e^{x \cdot \log \left({\left(e^{10}\right)}^{x}\right)}} \]
    13. *-commutativeN/A

      \[\leadsto \cos x \cdot e^{\color{blue}{\log \left({\left(e^{10}\right)}^{x}\right) \cdot x}} \]
    14. pow-to-expN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
    15. sqr-powN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right)} \]
    16. *-rgt-identityN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{x \cdot 1}}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    17. lift-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{x \cdot 1}}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    18. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\color{blue}{\left(\frac{x \cdot 1}{2}\right)}} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}\right) \]
    19. *-rgt-identityN/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x \cdot 1}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{x \cdot 1}}{2}\right)}\right) \]
    20. lift-*.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x \cdot 1}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{x \cdot 1}}{2}\right)}\right) \]
    21. lift-/.f64N/A

      \[\leadsto \cos x \cdot \left({\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x \cdot 1}{2}\right)} \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{\color{blue}{\left(\frac{x \cdot 1}{2}\right)}}\right) \]
    22. pow-prod-downN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x} \cdot {\left(e^{10}\right)}^{x}\right)}^{\left(\frac{x \cdot 1}{2}\right)}} \]
  6. Applied rewrites99.4%

    \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(0.5 \cdot x\right)}} \]
  7. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(\frac{1}{2} \cdot x\right)}} \]
    2. lift-pow.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{20}\right)}^{x}\right)}}^{\left(\frac{1}{2} \cdot x\right)} \]
    3. pow-powN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{20}\right)}^{\left(x \cdot \left(\frac{1}{2} \cdot x\right)\right)}} \]
    4. pow-to-expN/A

      \[\leadsto \cos x \cdot \color{blue}{e^{\log \left(e^{20}\right) \cdot \left(x \cdot \left(\frac{1}{2} \cdot x\right)\right)}} \]
    5. pow-expN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{\log \left(e^{20}\right)}\right)}^{\left(x \cdot \left(\frac{1}{2} \cdot x\right)\right)}} \]
    6. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{\log \color{blue}{\left(e^{20}\right)}}\right)}^{\left(x \cdot \left(\frac{1}{2} \cdot x\right)\right)} \]
    7. rem-log-expN/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{20}}\right)}^{\left(x \cdot \left(\frac{1}{2} \cdot x\right)\right)} \]
    8. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{10 + 10}}\right)}^{\left(x \cdot \left(\frac{1}{2} \cdot x\right)\right)} \]
    9. prod-expN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{10} \cdot e^{10}\right)}}^{\left(x \cdot \left(\frac{1}{2} \cdot x\right)\right)} \]
    10. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\left(\color{blue}{e^{10}} \cdot e^{10}\right)}^{\left(x \cdot \left(\frac{1}{2} \cdot x\right)\right)} \]
    11. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{10} \cdot \color{blue}{e^{10}}\right)}^{\left(x \cdot \left(\frac{1}{2} \cdot x\right)\right)} \]
    12. pow-prod-downN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left(e^{10}\right)}^{\left(x \cdot \left(\frac{1}{2} \cdot x\right)\right)} \cdot {\left(e^{10}\right)}^{\left(x \cdot \left(\frac{1}{2} \cdot x\right)\right)}\right)} \]
    13. pow-prod-upN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot \left(\frac{1}{2} \cdot x\right) + x \cdot \left(\frac{1}{2} \cdot x\right)\right)}} \]
    14. distribute-lft-outN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(x \cdot \left(\frac{1}{2} \cdot x + \frac{1}{2} \cdot x\right)\right)}} \]
    15. pow-powN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{\left(\frac{1}{2} \cdot x + \frac{1}{2} \cdot x\right)}} \]
    16. lift-exp.f64N/A

      \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{10}\right)}}^{x}\right)}^{\left(\frac{1}{2} \cdot x + \frac{1}{2} \cdot x\right)} \]
    17. pow-expN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{10 \cdot x}\right)}}^{\left(\frac{1}{2} \cdot x + \frac{1}{2} \cdot x\right)} \]
    18. lift-*.f64N/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{10 \cdot x}}\right)}^{\left(\frac{1}{2} \cdot x + \frac{1}{2} \cdot x\right)} \]
    19. pow-expN/A

      \[\leadsto \cos x \cdot \color{blue}{e^{\left(10 \cdot x\right) \cdot \left(\frac{1}{2} \cdot x + \frac{1}{2} \cdot x\right)}} \]
    20. distribute-lft-outN/A

      \[\leadsto \cos x \cdot e^{\color{blue}{\left(10 \cdot x\right) \cdot \left(\frac{1}{2} \cdot x\right) + \left(10 \cdot x\right) \cdot \left(\frac{1}{2} \cdot x\right)}} \]
    21. prod-expN/A

      \[\leadsto \cos x \cdot \color{blue}{\left(e^{\left(10 \cdot x\right) \cdot \left(\frac{1}{2} \cdot x\right)} \cdot e^{\left(10 \cdot x\right) \cdot \left(\frac{1}{2} \cdot x\right)}\right)} \]
    22. exp-lft-sqrN/A

      \[\leadsto \cos x \cdot \color{blue}{e^{\left(\left(10 \cdot x\right) \cdot \left(\frac{1}{2} \cdot x\right)\right) \cdot 2}} \]
  8. Applied rewrites95.2%

    \[\leadsto \cos x \cdot \color{blue}{{\left(e^{5}\right)}^{\left(\left(2 \cdot x\right) \cdot x\right)}} \]
  9. Final simplification95.2%

    \[\leadsto {\left(e^{5}\right)}^{\left(\left(2 \cdot x\right) \cdot x\right)} \cdot \cos x \]
  10. Add Preprocessing

Alternative 8: 95.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ {\left(e^{10}\right)}^{\left(x \cdot x\right)} \cdot \cos x \end{array} \]
(FPCore (x) :precision binary64 (* (pow (exp 10.0) (* x x)) (cos x)))
double code(double x) {
	return pow(exp(10.0), (x * x)) * cos(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (exp(10.0d0) ** (x * x)) * cos(x)
end function
public static double code(double x) {
	return Math.pow(Math.exp(10.0), (x * x)) * Math.cos(x);
}
def code(x):
	return math.pow(math.exp(10.0), (x * x)) * math.cos(x)
function code(x)
	return Float64((exp(10.0) ^ Float64(x * x)) * cos(x))
end
function tmp = code(x)
	tmp = (exp(10.0) ^ (x * x)) * cos(x);
end
code[x_] := N[(N[Power[N[Exp[10.0], $MachinePrecision], N[(x * x), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(e^{10}\right)}^{\left(x \cdot x\right)} \cdot \cos x
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-exp.f64N/A

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

      \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
    3. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    4. lower-pow.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    5. lower-exp.f6495.2

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{10}\right)}}^{\left(x \cdot x\right)} \]
  4. Applied rewrites95.2%

    \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
  5. Final simplification95.2%

    \[\leadsto {\left(e^{10}\right)}^{\left(x \cdot x\right)} \cdot \cos x \]
  6. Add Preprocessing

Alternative 9: 94.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ e^{\mathsf{fma}\left(2.5 \cdot x, x, \mathsf{fma}\left(x \cdot x, 5, \left(2.5 \cdot x\right) \cdot x\right)\right)} \cdot \cos x \end{array} \]
(FPCore (x)
 :precision binary64
 (* (exp (fma (* 2.5 x) x (fma (* x x) 5.0 (* (* 2.5 x) x)))) (cos x)))
double code(double x) {
	return exp(fma((2.5 * x), x, fma((x * x), 5.0, ((2.5 * x) * x)))) * cos(x);
}
function code(x)
	return Float64(exp(fma(Float64(2.5 * x), x, fma(Float64(x * x), 5.0, Float64(Float64(2.5 * x) * x)))) * cos(x))
end
code[x_] := N[(N[Exp[N[(N[(2.5 * x), $MachinePrecision] * x + N[(N[(x * x), $MachinePrecision] * 5.0 + N[(N[(2.5 * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
e^{\mathsf{fma}\left(2.5 \cdot x, x, \mathsf{fma}\left(x \cdot x, 5, \left(2.5 \cdot x\right) \cdot x\right)\right)} \cdot \cos x
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-exp.f64N/A

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

      \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
    3. exp-prodN/A

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(x \cdot x\right)}} \]
    5. pow-unpowN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
    6. sqr-powN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)} \cdot {\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}}^{x} \]
    7. unpow-prod-downN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{x} \cdot {\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{x}\right)} \]
    8. pow-prod-upN/A

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

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{\left(\frac{x}{2}\right)}\right)}^{\left(x + x\right)}} \]
    10. pow-to-expN/A

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{\log \left(e^{10}\right) \cdot \frac{x}{2}}\right)}}^{\left(x + x\right)} \]
    11. rem-log-expN/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{10} \cdot \frac{x}{2}}\right)}^{\left(x + x\right)} \]
    12. associate-*r/N/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{\frac{10 \cdot x}{2}}}\right)}^{\left(x + x\right)} \]
    13. *-commutativeN/A

      \[\leadsto \cos x \cdot {\left(e^{\frac{\color{blue}{x \cdot 10}}{2}}\right)}^{\left(x + x\right)} \]
    14. associate-/l*N/A

      \[\leadsto \cos x \cdot {\left(e^{\color{blue}{x \cdot \frac{10}{2}}}\right)}^{\left(x + x\right)} \]
    15. pow-expN/A

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

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{x}\right)}^{\left(\frac{10}{2}\right)}\right)}}^{\left(x + x\right)} \]
    17. lower-exp.f64N/A

      \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{x}\right)}}^{\left(\frac{10}{2}\right)}\right)}^{\left(x + x\right)} \]
    18. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{\color{blue}{5}}\right)}^{\left(x + x\right)} \]
    19. count-2N/A

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{5}\right)}^{\color{blue}{\left(2 \cdot x\right)}} \]
    20. lower-*.f6496.7

      \[\leadsto \cos x \cdot {\left({\left(e^{x}\right)}^{5}\right)}^{\color{blue}{\left(2 \cdot x\right)}} \]
  4. Applied rewrites96.7%

    \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{x}\right)}^{5}\right)}^{\left(2 \cdot x\right)}} \]
  5. Applied rewrites94.6%

    \[\leadsto \cos x \cdot \color{blue}{e^{\mathsf{fma}\left(2.5 \cdot x, x, \mathsf{fma}\left(x \cdot x, 5, \left(2.5 \cdot x\right) \cdot x\right)\right)}} \]
  6. Final simplification94.6%

    \[\leadsto e^{\mathsf{fma}\left(2.5 \cdot x, x, \mathsf{fma}\left(x \cdot x, 5, \left(2.5 \cdot x\right) \cdot x\right)\right)} \cdot \cos x \]
  7. Add Preprocessing

Alternative 10: 94.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ e^{\left(x \cdot x\right) \cdot 10} \cdot \cos x \end{array} \]
(FPCore (x) :precision binary64 (* (exp (* (* x x) 10.0)) (cos x)))
double code(double x) {
	return exp(((x * x) * 10.0)) * cos(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = exp(((x * x) * 10.0d0)) * cos(x)
end function
public static double code(double x) {
	return Math.exp(((x * x) * 10.0)) * Math.cos(x);
}
def code(x):
	return math.exp(((x * x) * 10.0)) * math.cos(x)
function code(x)
	return Float64(exp(Float64(Float64(x * x) * 10.0)) * cos(x))
end
function tmp = code(x)
	tmp = exp(((x * x) * 10.0)) * cos(x);
end
code[x_] := N[(N[Exp[N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
e^{\left(x \cdot x\right) \cdot 10} \cdot \cos x
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Final simplification94.5%

    \[\leadsto e^{\left(x \cdot x\right) \cdot 10} \cdot \cos x \]
  4. Add Preprocessing

Alternative 11: 27.5% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.001388888888888889, x \cdot x, 0.041666666666666664\right), x \cdot x, -0.5\right), x \cdot x, 1\right) \cdot e^{\left(x \cdot x\right) \cdot 10} \end{array} \]
(FPCore (x)
 :precision binary64
 (*
  (fma
   (fma (fma -0.001388888888888889 (* x x) 0.041666666666666664) (* x x) -0.5)
   (* x x)
   1.0)
  (exp (* (* x x) 10.0))))
double code(double x) {
	return fma(fma(fma(-0.001388888888888889, (x * x), 0.041666666666666664), (x * x), -0.5), (x * x), 1.0) * exp(((x * x) * 10.0));
}
function code(x)
	return Float64(fma(fma(fma(-0.001388888888888889, Float64(x * x), 0.041666666666666664), Float64(x * x), -0.5), Float64(x * x), 1.0) * exp(Float64(Float64(x * x) * 10.0)))
end
code[x_] := N[(N[(N[(N[(-0.001388888888888889 * N[(x * x), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] * N[(x * x), $MachinePrecision] + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * N[Exp[N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.001388888888888889, x \cdot x, 0.041666666666666664\right), x \cdot x, -0.5\right), x \cdot x, 1\right) \cdot e^{\left(x \cdot x\right) \cdot 10}
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {x}^{2}\right) - \frac{1}{2}\right)\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{\left({x}^{2} \cdot \left({x}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {x}^{2}\right) - \frac{1}{2}\right) + 1\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    2. *-commutativeN/A

      \[\leadsto \left(\color{blue}{\left({x}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {x}^{2}\right) - \frac{1}{2}\right) \cdot {x}^{2}} + 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    3. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {x}^{2}\right) - \frac{1}{2}, {x}^{2}, 1\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    4. sub-negN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {x}^{2}\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left({x}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {x}^{2}\right) + \color{blue}{\frac{-1}{2}}, {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    6. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\frac{1}{24} + \frac{-1}{720} \cdot {x}^{2}\right) \cdot {x}^{2}} + \frac{-1}{2}, {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    7. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\frac{1}{24} + \frac{-1}{720} \cdot {x}^{2}, {x}^{2}, \frac{-1}{2}\right)}, {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    8. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\frac{-1}{720} \cdot {x}^{2} + \frac{1}{24}}, {x}^{2}, \frac{-1}{2}\right), {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    9. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\frac{-1}{720}, {x}^{2}, \frac{1}{24}\right)}, {x}^{2}, \frac{-1}{2}\right), {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    10. unpow2N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{720}, \color{blue}{x \cdot x}, \frac{1}{24}\right), {x}^{2}, \frac{-1}{2}\right), {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    11. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{720}, \color{blue}{x \cdot x}, \frac{1}{24}\right), {x}^{2}, \frac{-1}{2}\right), {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    12. unpow2N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{720}, x \cdot x, \frac{1}{24}\right), \color{blue}{x \cdot x}, \frac{-1}{2}\right), {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    13. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{720}, x \cdot x, \frac{1}{24}\right), \color{blue}{x \cdot x}, \frac{-1}{2}\right), {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    14. unpow2N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{720}, x \cdot x, \frac{1}{24}\right), x \cdot x, \frac{-1}{2}\right), \color{blue}{x \cdot x}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    15. lower-*.f6427.6

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.001388888888888889, x \cdot x, 0.041666666666666664\right), x \cdot x, -0.5\right), \color{blue}{x \cdot x}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  5. Applied rewrites27.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.001388888888888889, x \cdot x, 0.041666666666666664\right), x \cdot x, -0.5\right), x \cdot x, 1\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  6. Final simplification27.6%

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.001388888888888889, x \cdot x, 0.041666666666666664\right), x \cdot x, -0.5\right), x \cdot x, 1\right) \cdot e^{\left(x \cdot x\right) \cdot 10} \]
  7. Add Preprocessing

Alternative 12: 21.3% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x \cdot x, -0.5\right), x \cdot x, 1\right) \cdot e^{\left(x \cdot x\right) \cdot 10} \end{array} \]
(FPCore (x)
 :precision binary64
 (*
  (fma (fma 0.041666666666666664 (* x x) -0.5) (* x x) 1.0)
  (exp (* (* x x) 10.0))))
double code(double x) {
	return fma(fma(0.041666666666666664, (x * x), -0.5), (x * x), 1.0) * exp(((x * x) * 10.0));
}
function code(x)
	return Float64(fma(fma(0.041666666666666664, Float64(x * x), -0.5), Float64(x * x), 1.0) * exp(Float64(Float64(x * x) * 10.0)))
end
code[x_] := N[(N[(N[(0.041666666666666664 * N[(x * x), $MachinePrecision] + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * N[Exp[N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x \cdot x, -0.5\right), x \cdot x, 1\right) \cdot e^{\left(x \cdot x\right) \cdot 10}
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\left(1 + {x}^{2} \cdot \left(\frac{1}{24} \cdot {x}^{2} - \frac{1}{2}\right)\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{\left({x}^{2} \cdot \left(\frac{1}{24} \cdot {x}^{2} - \frac{1}{2}\right) + 1\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    2. *-commutativeN/A

      \[\leadsto \left(\color{blue}{\left(\frac{1}{24} \cdot {x}^{2} - \frac{1}{2}\right) \cdot {x}^{2}} + 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    3. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{24} \cdot {x}^{2} - \frac{1}{2}, {x}^{2}, 1\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    4. sub-negN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{24} \cdot {x}^{2} + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(\frac{1}{24} \cdot {x}^{2} + \color{blue}{\frac{-1}{2}}, {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    6. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\frac{1}{24}, {x}^{2}, \frac{-1}{2}\right)}, {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    7. unpow2N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{24}, \color{blue}{x \cdot x}, \frac{-1}{2}\right), {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    8. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{24}, \color{blue}{x \cdot x}, \frac{-1}{2}\right), {x}^{2}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    9. unpow2N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{24}, x \cdot x, \frac{-1}{2}\right), \color{blue}{x \cdot x}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    10. lower-*.f6421.3

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x \cdot x, -0.5\right), \color{blue}{x \cdot x}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  5. Applied rewrites21.3%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x \cdot x, -0.5\right), x \cdot x, 1\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  6. Final simplification21.3%

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x \cdot x, -0.5\right), x \cdot x, 1\right) \cdot e^{\left(x \cdot x\right) \cdot 10} \]
  7. Add Preprocessing

Alternative 13: 18.2% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(-0.5, x \cdot x, 1\right) \cdot e^{\left(x \cdot x\right) \cdot 10} \end{array} \]
(FPCore (x)
 :precision binary64
 (* (fma -0.5 (* x x) 1.0) (exp (* (* x x) 10.0))))
double code(double x) {
	return fma(-0.5, (x * x), 1.0) * exp(((x * x) * 10.0));
}
function code(x)
	return Float64(fma(-0.5, Float64(x * x), 1.0) * exp(Float64(Float64(x * x) * 10.0)))
end
code[x_] := N[(N[(-0.5 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * N[Exp[N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(-0.5, x \cdot x, 1\right) \cdot e^{\left(x \cdot x\right) \cdot 10}
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot {x}^{2} + 1\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    2. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{2}, {x}^{2}, 1\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    3. unpow2N/A

      \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, \color{blue}{x \cdot x}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    4. lower-*.f6418.2

      \[\leadsto \mathsf{fma}\left(-0.5, \color{blue}{x \cdot x}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  5. Applied rewrites18.2%

    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5, x \cdot x, 1\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  6. Final simplification18.2%

    \[\leadsto \mathsf{fma}\left(-0.5, x \cdot x, 1\right) \cdot e^{\left(x \cdot x\right) \cdot 10} \]
  7. Add Preprocessing

Alternative 14: 10.3% accurate, 4.3× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(166.66666666666666, x \cdot x, 50\right), x \cdot x, 10\right) \cdot x, x, 1\right) \cdot \mathsf{fma}\left(-0.5, x \cdot x, 1\right) \end{array} \]
(FPCore (x)
 :precision binary64
 (*
  (fma (* (fma (fma 166.66666666666666 (* x x) 50.0) (* x x) 10.0) x) x 1.0)
  (fma -0.5 (* x x) 1.0)))
double code(double x) {
	return fma((fma(fma(166.66666666666666, (x * x), 50.0), (x * x), 10.0) * x), x, 1.0) * fma(-0.5, (x * x), 1.0);
}
function code(x)
	return Float64(fma(Float64(fma(fma(166.66666666666666, Float64(x * x), 50.0), Float64(x * x), 10.0) * x), x, 1.0) * fma(-0.5, Float64(x * x), 1.0))
end
code[x_] := N[(N[(N[(N[(N[(166.66666666666666 * N[(x * x), $MachinePrecision] + 50.0), $MachinePrecision] * N[(x * x), $MachinePrecision] + 10.0), $MachinePrecision] * x), $MachinePrecision] * x + 1.0), $MachinePrecision] * N[(-0.5 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(166.66666666666666, x \cdot x, 50\right), x \cdot x, 10\right) \cdot x, x, 1\right) \cdot \mathsf{fma}\left(-0.5, x \cdot x, 1\right)
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-exp.f64N/A

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

      \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
    3. exp-prodN/A

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(x \cdot x\right)}} \]
    5. pow-unpowN/A

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

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
    7. lower-pow.f64N/A

      \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{10}\right)}^{x}\right)}}^{x} \]
    8. lower-exp.f6497.9

      \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{10}\right)}}^{x}\right)}^{x} \]
  4. Applied rewrites97.9%

    \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
  5. Taylor expanded in x around 0

    \[\leadsto \cos x \cdot \color{blue}{1} \]
  6. Step-by-step derivation
    1. Applied rewrites9.6%

      \[\leadsto \cos x \cdot \color{blue}{1} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \cdot 1 \]
    3. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot {x}^{2} + 1\right)} \cdot 1 \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{2}, {x}^{2}, 1\right)} \cdot 1 \]
      3. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, \color{blue}{x \cdot x}, 1\right) \cdot 1 \]
      4. lower-*.f649.7

        \[\leadsto \mathsf{fma}\left(-0.5, \color{blue}{x \cdot x}, 1\right) \cdot 1 \]
    4. Applied rewrites9.7%

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

      \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \color{blue}{\left(1 + {x}^{2} \cdot \left(10 + {x}^{2} \cdot \left(50 + \frac{500}{3} \cdot {x}^{2}\right)\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \color{blue}{\left({x}^{2} \cdot \left(10 + {x}^{2} \cdot \left(50 + \frac{500}{3} \cdot {x}^{2}\right)\right) + 1\right)} \]
      2. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot \left(10 + {x}^{2} \cdot \left(50 + \frac{500}{3} \cdot {x}^{2}\right)\right) + 1\right) \]
      3. associate-*l*N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \left(\color{blue}{x \cdot \left(x \cdot \left(10 + {x}^{2} \cdot \left(50 + \frac{500}{3} \cdot {x}^{2}\right)\right)\right)} + 1\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \left(\color{blue}{\left(x \cdot \left(10 + {x}^{2} \cdot \left(50 + \frac{500}{3} \cdot {x}^{2}\right)\right)\right) \cdot x} + 1\right) \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \color{blue}{\mathsf{fma}\left(x \cdot \left(10 + {x}^{2} \cdot \left(50 + \frac{500}{3} \cdot {x}^{2}\right)\right), x, 1\right)} \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\color{blue}{\left(10 + {x}^{2} \cdot \left(50 + \frac{500}{3} \cdot {x}^{2}\right)\right) \cdot x}, x, 1\right) \]
      7. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\color{blue}{\left(10 + {x}^{2} \cdot \left(50 + \frac{500}{3} \cdot {x}^{2}\right)\right) \cdot x}, x, 1\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\color{blue}{\left({x}^{2} \cdot \left(50 + \frac{500}{3} \cdot {x}^{2}\right) + 10\right)} \cdot x, x, 1\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\left(\color{blue}{\left(50 + \frac{500}{3} \cdot {x}^{2}\right) \cdot {x}^{2}} + 10\right) \cdot x, x, 1\right) \]
      10. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(50 + \frac{500}{3} \cdot {x}^{2}, {x}^{2}, 10\right)} \cdot x, x, 1\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\frac{500}{3} \cdot {x}^{2} + 50}, {x}^{2}, 10\right) \cdot x, x, 1\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\frac{500}{3}, {x}^{2}, 50\right)}, {x}^{2}, 10\right) \cdot x, x, 1\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{500}{3}, \color{blue}{x \cdot x}, 50\right), {x}^{2}, 10\right) \cdot x, x, 1\right) \]
      14. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{500}{3}, \color{blue}{x \cdot x}, 50\right), {x}^{2}, 10\right) \cdot x, x, 1\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{500}{3}, x \cdot x, 50\right), \color{blue}{x \cdot x}, 10\right) \cdot x, x, 1\right) \]
      16. lower-*.f6410.3

        \[\leadsto \mathsf{fma}\left(-0.5, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(166.66666666666666, x \cdot x, 50\right), \color{blue}{x \cdot x}, 10\right) \cdot x, x, 1\right) \]
    7. Applied rewrites10.3%

      \[\leadsto \mathsf{fma}\left(-0.5, x \cdot x, 1\right) \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(166.66666666666666, x \cdot x, 50\right), x \cdot x, 10\right) \cdot x, x, 1\right)} \]
    8. Final simplification10.3%

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(166.66666666666666, x \cdot x, 50\right), x \cdot x, 10\right) \cdot x, x, 1\right) \cdot \mathsf{fma}\left(-0.5, x \cdot x, 1\right) \]
    9. Add Preprocessing

    Alternative 15: 10.1% accurate, 5.5× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(\mathsf{fma}\left(50, x \cdot x, 10\right), x \cdot x, 1\right) \cdot \mathsf{fma}\left(-0.5, x \cdot x, 1\right) \end{array} \]
    (FPCore (x)
     :precision binary64
     (* (fma (fma 50.0 (* x x) 10.0) (* x x) 1.0) (fma -0.5 (* x x) 1.0)))
    double code(double x) {
    	return fma(fma(50.0, (x * x), 10.0), (x * x), 1.0) * fma(-0.5, (x * x), 1.0);
    }
    
    function code(x)
    	return Float64(fma(fma(50.0, Float64(x * x), 10.0), Float64(x * x), 1.0) * fma(-0.5, Float64(x * x), 1.0))
    end
    
    code[x_] := N[(N[(N[(50.0 * N[(x * x), $MachinePrecision] + 10.0), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * N[(-0.5 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(\mathsf{fma}\left(50, x \cdot x, 10\right), x \cdot x, 1\right) \cdot \mathsf{fma}\left(-0.5, x \cdot x, 1\right)
    \end{array}
    
    Derivation
    1. Initial program 94.5%

      \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-exp.f64N/A

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

        \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
      3. exp-prodN/A

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

        \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(x \cdot x\right)}} \]
      5. pow-unpowN/A

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

        \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
      7. lower-pow.f64N/A

        \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{10}\right)}^{x}\right)}}^{x} \]
      8. lower-exp.f6497.9

        \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{10}\right)}}^{x}\right)}^{x} \]
    4. Applied rewrites97.9%

      \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
    5. Taylor expanded in x around 0

      \[\leadsto \cos x \cdot \color{blue}{1} \]
    6. Step-by-step derivation
      1. Applied rewrites9.6%

        \[\leadsto \cos x \cdot \color{blue}{1} \]
      2. Taylor expanded in x around 0

        \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \cdot 1 \]
      3. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot {x}^{2} + 1\right)} \cdot 1 \]
        2. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{2}, {x}^{2}, 1\right)} \cdot 1 \]
        3. unpow2N/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, \color{blue}{x \cdot x}, 1\right) \cdot 1 \]
        4. lower-*.f649.7

          \[\leadsto \mathsf{fma}\left(-0.5, \color{blue}{x \cdot x}, 1\right) \cdot 1 \]
      4. Applied rewrites9.7%

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \color{blue}{\left(1 + {x}^{2} \cdot \left(10 + 50 \cdot {x}^{2}\right)\right)} \]
      6. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \color{blue}{\left({x}^{2} \cdot \left(10 + 50 \cdot {x}^{2}\right) + 1\right)} \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \left(\color{blue}{\left(10 + 50 \cdot {x}^{2}\right) \cdot {x}^{2}} + 1\right) \]
        3. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \color{blue}{\mathsf{fma}\left(10 + 50 \cdot {x}^{2}, {x}^{2}, 1\right)} \]
        4. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\color{blue}{50 \cdot {x}^{2} + 10}, {x}^{2}, 1\right) \]
        5. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(50, {x}^{2}, 10\right)}, {x}^{2}, 1\right) \]
        6. unpow2N/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(50, \color{blue}{x \cdot x}, 10\right), {x}^{2}, 1\right) \]
        7. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(50, \color{blue}{x \cdot x}, 10\right), {x}^{2}, 1\right) \]
        8. unpow2N/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(50, x \cdot x, 10\right), \color{blue}{x \cdot x}, 1\right) \]
        9. lower-*.f6410.1

          \[\leadsto \mathsf{fma}\left(-0.5, x \cdot x, 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(50, x \cdot x, 10\right), \color{blue}{x \cdot x}, 1\right) \]
      7. Applied rewrites10.1%

        \[\leadsto \mathsf{fma}\left(-0.5, x \cdot x, 1\right) \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(50, x \cdot x, 10\right), x \cdot x, 1\right)} \]
      8. Final simplification10.1%

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(50, x \cdot x, 10\right), x \cdot x, 1\right) \cdot \mathsf{fma}\left(-0.5, x \cdot x, 1\right) \]
      9. Add Preprocessing

      Alternative 16: 9.9% accurate, 7.7× speedup?

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

        \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-exp.f64N/A

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

          \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
        3. exp-prodN/A

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

          \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(x \cdot x\right)}} \]
        5. pow-unpowN/A

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

          \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
        7. lower-pow.f64N/A

          \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{10}\right)}^{x}\right)}}^{x} \]
        8. lower-exp.f6497.9

          \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{10}\right)}}^{x}\right)}^{x} \]
      4. Applied rewrites97.9%

        \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
      5. Taylor expanded in x around 0

        \[\leadsto \cos x \cdot \color{blue}{1} \]
      6. Step-by-step derivation
        1. Applied rewrites9.6%

          \[\leadsto \cos x \cdot \color{blue}{1} \]
        2. Taylor expanded in x around 0

          \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \cdot 1 \]
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot {x}^{2} + 1\right)} \cdot 1 \]
          2. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{2}, {x}^{2}, 1\right)} \cdot 1 \]
          3. unpow2N/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, \color{blue}{x \cdot x}, 1\right) \cdot 1 \]
          4. lower-*.f649.7

            \[\leadsto \mathsf{fma}\left(-0.5, \color{blue}{x \cdot x}, 1\right) \cdot 1 \]
        4. Applied rewrites9.7%

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

          \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \color{blue}{\left(1 + 10 \cdot {x}^{2}\right)} \]
        6. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \color{blue}{\left(10 \cdot {x}^{2} + 1\right)} \]
          2. lower-fma.f64N/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \color{blue}{\mathsf{fma}\left(10, {x}^{2}, 1\right)} \]
          3. unpow2N/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, x \cdot x, 1\right) \cdot \mathsf{fma}\left(10, \color{blue}{x \cdot x}, 1\right) \]
          4. lower-*.f649.9

            \[\leadsto \mathsf{fma}\left(-0.5, x \cdot x, 1\right) \cdot \mathsf{fma}\left(10, \color{blue}{x \cdot x}, 1\right) \]
        7. Applied rewrites9.9%

          \[\leadsto \mathsf{fma}\left(-0.5, x \cdot x, 1\right) \cdot \color{blue}{\mathsf{fma}\left(10, x \cdot x, 1\right)} \]
        8. Final simplification9.9%

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

        Alternative 17: 9.7% accurate, 13.5× speedup?

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

          \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-exp.f64N/A

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

            \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
          3. exp-prodN/A

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

            \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(x \cdot x\right)}} \]
          5. pow-unpowN/A

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

            \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
          7. lower-pow.f64N/A

            \[\leadsto \cos x \cdot {\color{blue}{\left({\left(e^{10}\right)}^{x}\right)}}^{x} \]
          8. lower-exp.f6497.9

            \[\leadsto \cos x \cdot {\left({\color{blue}{\left(e^{10}\right)}}^{x}\right)}^{x} \]
        4. Applied rewrites97.9%

          \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{x}} \]
        5. Taylor expanded in x around 0

          \[\leadsto \cos x \cdot \color{blue}{1} \]
        6. Step-by-step derivation
          1. Applied rewrites9.6%

            \[\leadsto \cos x \cdot \color{blue}{1} \]
          2. Taylor expanded in x around 0

            \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \cdot 1 \]
          3. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot {x}^{2} + 1\right)} \cdot 1 \]
            2. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{2}, {x}^{2}, 1\right)} \cdot 1 \]
            3. unpow2N/A

              \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, \color{blue}{x \cdot x}, 1\right) \cdot 1 \]
            4. lower-*.f649.7

              \[\leadsto \mathsf{fma}\left(-0.5, \color{blue}{x \cdot x}, 1\right) \cdot 1 \]
          4. Applied rewrites9.7%

            \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5, x \cdot x, 1\right)} \cdot 1 \]
          5. Taylor expanded in x around inf

            \[\leadsto \left(\frac{-1}{2} \cdot \color{blue}{{x}^{2}}\right) \cdot 1 \]
          6. Step-by-step derivation
            1. Applied rewrites9.7%

              \[\leadsto \left(-0.5 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot 1 \]
            2. Final simplification9.7%

              \[\leadsto 1 \cdot \left(-0.5 \cdot \left(x \cdot x\right)\right) \]
            3. Add Preprocessing

            Alternative 18: 1.5% accurate, 216.0× speedup?

            \[\begin{array}{l} \\ 1 \end{array} \]
            (FPCore (x) :precision binary64 1.0)
            double code(double x) {
            	return 1.0;
            }
            
            real(8) function code(x)
                real(8), intent (in) :: x
                code = 1.0d0
            end function
            
            public static double code(double x) {
            	return 1.0;
            }
            
            def code(x):
            	return 1.0
            
            function code(x)
            	return 1.0
            end
            
            function tmp = code(x)
            	tmp = 1.0;
            end
            
            code[x_] := 1.0
            
            \begin{array}{l}
            
            \\
            1
            \end{array}
            
            Derivation
            1. Initial program 94.5%

              \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in x around 0

              \[\leadsto \color{blue}{1} \]
            4. Step-by-step derivation
              1. Applied rewrites1.5%

                \[\leadsto \color{blue}{1} \]
              2. Add Preprocessing

              Reproduce

              ?
              herbie shell --seed 2024249 
              (FPCore (x)
                :name "ENA, Section 1.4, Exercise 1"
                :precision binary64
                :pre (and (<= 1.99 x) (<= x 2.01))
                (* (cos x) (exp (* 10.0 (* x x)))))