ENA, Section 1.4, Exercise 1

Percentage Accurate: 94.4% → 99.3%
Time: 12.8s
Alternatives: 19
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 19 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.4% 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.3% accurate, 0.5× speedup?

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

\\
\cos x \cdot \frac{1}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(x \cdot -0.5\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. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    2. 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)} \]
    3. pow-prod-upN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{\mathsf{neg}\left(2\right)}\right)}} \]
    19. distribute-frac-negN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\mathsf{neg}\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)\right)}} \]
    20. pow-negN/A

      \[\leadsto \cos x \cdot \color{blue}{\frac{1}{{\left(e^{10}\right)}^{\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)}}} \]
  4. Applied egg-rr95.2%

    \[\leadsto \cos x \cdot \color{blue}{\frac{1}{{\left(e^{10}\right)}^{\left(x \cdot \left(-x\right)\right)}}} \]
  5. Step-by-step derivation
    1. sqr-powN/A

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

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

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

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left({\left(e^{10} \cdot e^{10}\right)}^{x}\right)}^{\left(\frac{\mathsf{neg}\left(x\right)}{2}\right)}}} \]
    5. neg-mul-1N/A

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{\color{blue}{20}}\right)}^{x}\right)}^{\left(x \cdot \frac{-1}{2}\right)}} \]
    14. *-lowering-*.f6499.2

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{20}\right)}^{x}\right)}^{\color{blue}{\left(x \cdot -0.5\right)}}} \]
  6. Applied egg-rr99.2%

    \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(x \cdot -0.5\right)}}} \]
  7. Add Preprocessing

Alternative 2: 97.7% accurate, 0.5× speedup?

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

\\
\cos x \cdot {\left({\left(e^{x + x}\right)}^{10}\right)}^{\left(x \cdot 0.5\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. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    2. 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)} \]
    3. pow-prod-upN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{\mathsf{neg}\left(2\right)}\right)}} \]
    19. distribute-frac-negN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\mathsf{neg}\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)\right)}} \]
    20. pow-negN/A

      \[\leadsto \cos x \cdot \color{blue}{\frac{1}{{\left(e^{10}\right)}^{\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)}}} \]
  4. Applied egg-rr95.2%

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

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

      \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(\mathsf{neg}\left(x \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}} \]
    3. distribute-rgt-neg-outN/A

      \[\leadsto \cos x \cdot e^{10 \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x \cdot x\right)\right)}\right)\right)} \]
    4. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot {\left({\left(e^{x + x}\right)}^{10}\right)}^{\left(x \cdot \color{blue}{\frac{1}{2}}\right)} \]
    20. *-lowering-*.f6497.6

      \[\leadsto \cos x \cdot {\left({\left(e^{x + x}\right)}^{10}\right)}^{\color{blue}{\left(x \cdot 0.5\right)}} \]
  6. Applied egg-rr97.6%

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

Alternative 3: 97.6% accurate, 0.5× speedup?

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

\\
\cos x \cdot {\left({\left(e^{x + x}\right)}^{x}\right)}^{5}
\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. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    2. 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)} \]
    3. pow-prod-upN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{\mathsf{neg}\left(2\right)}\right)}} \]
    19. distribute-frac-negN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\mathsf{neg}\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)\right)}} \]
    20. pow-negN/A

      \[\leadsto \cos x \cdot \color{blue}{\frac{1}{{\left(e^{10}\right)}^{\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)}}} \]
  4. Applied egg-rr95.2%

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

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

      \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(\mathsf{neg}\left(x \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}} \]
    3. distribute-rgt-neg-outN/A

      \[\leadsto \cos x \cdot e^{10 \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x \cdot x\right)\right)}\right)\right)} \]
    4. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot {\left({\left(e^{\color{blue}{x + x}}\right)}^{x}\right)}^{\left(\frac{10}{2}\right)} \]
    17. metadata-eval97.6

      \[\leadsto \cos x \cdot {\left({\left(e^{x + x}\right)}^{x}\right)}^{\color{blue}{5}} \]
  6. Applied egg-rr97.6%

    \[\leadsto \cos x \cdot \color{blue}{{\left({\left(e^{x + x}\right)}^{x}\right)}^{5}} \]
  7. Add Preprocessing

Alternative 4: 95.1% accurate, 0.6× speedup?

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

\\
\frac{\cos x \cdot e^{-0.5 \cdot \left(x \cdot \left(x \cdot -10\right)\right)}}{e^{10 \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. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    2. 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)} \]
    3. pow-prod-upN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{\mathsf{neg}\left(2\right)}\right)}} \]
    19. distribute-frac-negN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\mathsf{neg}\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)\right)}} \]
    20. pow-negN/A

      \[\leadsto \cos x \cdot \color{blue}{\frac{1}{{\left(e^{10}\right)}^{\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)}}} \]
  4. Applied egg-rr95.2%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{{\left(e^{10}\right)}^{\left(\frac{x \cdot \left(\mathsf{neg}\left(x\right)\right)}{2}\right)}} \cdot \cos x}{{\left(e^{10}\right)}^{\left(\frac{x \cdot \left(\mathsf{neg}\left(x\right)\right)}{2}\right)}}} \]
  6. Applied egg-rr95.3%

    \[\leadsto \color{blue}{\frac{e^{\left(x \cdot \left(x \cdot -10\right)\right) \cdot -0.5} \cdot \cos x}{e^{10 \cdot \left(\left(x \cdot x\right) \cdot -0.5\right)}}} \]
  7. Final simplification95.3%

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

Alternative 5: 95.1% accurate, 0.6× speedup?

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

\\
\cos x \cdot \frac{e^{-0.5 \cdot \left(x \cdot \left(x \cdot -10\right)\right)}}{e^{\left(x \cdot x\right) \cdot -5}}
\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. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    2. 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)} \]
    3. pow-prod-upN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{\mathsf{neg}\left(2\right)}\right)}} \]
    19. distribute-frac-negN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\mathsf{neg}\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)\right)}} \]
    20. pow-negN/A

      \[\leadsto \cos x \cdot \color{blue}{\frac{1}{{\left(e^{10}\right)}^{\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)}}} \]
  4. Applied egg-rr95.2%

    \[\leadsto \cos x \cdot \color{blue}{\frac{1}{{\left(e^{10}\right)}^{\left(x \cdot \left(-x\right)\right)}}} \]
  5. Step-by-step derivation
    1. sqr-powN/A

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

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

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

    \[\leadsto \cos x \cdot \color{blue}{\frac{e^{\left(x \cdot \left(x \cdot -10\right)\right) \cdot -0.5}}{e^{10 \cdot \left(\left(x \cdot x\right) \cdot -0.5\right)}}} \]
  7. Step-by-step derivation
    1. associate-*r*N/A

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

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

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

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

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

      \[\leadsto \cos x \cdot \frac{e^{\left(x \cdot \left(x \cdot -10\right)\right) \cdot -0.5}}{e^{\left(x \cdot x\right) \cdot \color{blue}{-5}}} \]
  8. Applied egg-rr95.2%

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

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

Alternative 6: 95.2% accurate, 0.7× speedup?

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

\\
\cos x \cdot \frac{1}{{\left(e^{x \cdot \left(-x\right)}\right)}^{10}}
\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. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    2. 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)} \]
    3. pow-prod-upN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{\mathsf{neg}\left(2\right)}\right)}} \]
    19. distribute-frac-negN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\mathsf{neg}\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)\right)}} \]
    20. pow-negN/A

      \[\leadsto \cos x \cdot \color{blue}{\frac{1}{{\left(e^{10}\right)}^{\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)}}} \]
  4. Applied egg-rr95.2%

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

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

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

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

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

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left(e^{x \cdot \left(\mathsf{neg}\left(x\right)\right)}\right)}}^{10}} \]
    6. *-lowering-*.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left(e^{\color{blue}{x \cdot \left(\mathsf{neg}\left(x\right)\right)}}\right)}^{10}} \]
    7. neg-lowering-neg.f6495.2

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

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

Alternative 7: 95.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \cos x \cdot {\left(e^{10}\right)}^{\left(x \cdot x\right)} \end{array} \]
(FPCore (x) :precision binary64 (* (cos x) (pow (exp 10.0) (* x x))))
double code(double x) {
	return cos(x) * pow(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.pow(Math.exp(10.0), (x * x));
}
def code(x):
	return math.cos(x) * math.pow(math.exp(10.0), (x * x))
function code(x)
	return Float64(cos(x) * (exp(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[Power[N[Exp[10.0], $MachinePrecision], N[(x * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\cos x \cdot {\left(e^{10}\right)}^{\left(x \cdot x\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. exp-prodN/A

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

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

      \[\leadsto \cos x \cdot {\color{blue}{\left(e^{10}\right)}}^{\left(x \cdot x\right)} \]
    4. *-lowering-*.f6495.2

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

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

Alternative 8: 94.4% accurate, 1.0× speedup?

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

\\
\cos x \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\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. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    2. 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)} \]
    3. pow-prod-upN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{\mathsf{neg}\left(2\right)}\right)}} \]
    19. distribute-frac-negN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\mathsf{neg}\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)\right)}} \]
    20. pow-negN/A

      \[\leadsto \cos x \cdot \color{blue}{\frac{1}{{\left(e^{10}\right)}^{\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)}}} \]
  4. Applied egg-rr95.2%

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

    \[\leadsto \cos x \cdot \frac{1}{\color{blue}{e^{-10 \cdot {x}^{2}}}} \]
  6. Step-by-step derivation
    1. exp-lowering-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{e^{-10 \cdot {x}^{2}}}} \]
    2. *-commutativeN/A

      \[\leadsto \cos x \cdot \frac{1}{e^{\color{blue}{{x}^{2} \cdot -10}}} \]
    3. *-lowering-*.f64N/A

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

      \[\leadsto \cos x \cdot \frac{1}{e^{\color{blue}{\left(x \cdot x\right)} \cdot -10}} \]
    5. *-lowering-*.f6494.5

      \[\leadsto \cos x \cdot \frac{1}{e^{\color{blue}{\left(x \cdot x\right)} \cdot -10}} \]
  7. Simplified94.5%

    \[\leadsto \cos x \cdot \frac{1}{\color{blue}{e^{\left(x \cdot x\right) \cdot -10}}} \]
  8. Final simplification94.5%

    \[\leadsto \cos x \cdot \frac{1}{e^{-10 \cdot \left(x \cdot x\right)}} \]
  9. Add Preprocessing

Alternative 9: 94.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\cos x}{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}

\\
\frac{\cos x}{e^{-10 \cdot \left(x \cdot x\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. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    2. 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)} \]
    3. pow-prod-upN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{\mathsf{neg}\left(2\right)}\right)}} \]
    19. distribute-frac-negN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\mathsf{neg}\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)\right)}} \]
    20. pow-negN/A

      \[\leadsto \cos x \cdot \color{blue}{\frac{1}{{\left(e^{10}\right)}^{\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)}}} \]
  4. Applied egg-rr95.2%

    \[\leadsto \cos x \cdot \color{blue}{\frac{1}{{\left(e^{10}\right)}^{\left(x \cdot \left(-x\right)\right)}}} \]
  5. Step-by-step derivation
    1. sqr-powN/A

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

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

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

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left({\left(e^{10} \cdot e^{10}\right)}^{x}\right)}^{\left(\frac{\mathsf{neg}\left(x\right)}{2}\right)}}} \]
    5. neg-mul-1N/A

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{\color{blue}{20}}\right)}^{x}\right)}^{\left(x \cdot \frac{-1}{2}\right)}} \]
    14. *-lowering-*.f6499.2

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{20}\right)}^{x}\right)}^{\color{blue}{\left(x \cdot -0.5\right)}}} \]
  6. Applied egg-rr99.2%

    \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(x \cdot -0.5\right)}}} \]
  7. Taylor expanded in x around inf

    \[\leadsto \color{blue}{\frac{\cos x}{e^{\frac{-1}{2} \cdot \left(x \cdot \log \left({\left(e^{20}\right)}^{x}\right)\right)}}} \]
  8. Step-by-step derivation
    1. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\cos x}{e^{\color{blue}{-10 \cdot \left(x \cdot x\right)}}} \]
    14. unpow2N/A

      \[\leadsto \frac{\cos x}{e^{-10 \cdot \color{blue}{{x}^{2}}}} \]
    15. exp-lowering-exp.f64N/A

      \[\leadsto \frac{\cos x}{\color{blue}{e^{-10 \cdot {x}^{2}}}} \]
    16. *-commutativeN/A

      \[\leadsto \frac{\cos x}{e^{\color{blue}{{x}^{2} \cdot -10}}} \]
    17. *-lowering-*.f64N/A

      \[\leadsto \frac{\cos x}{e^{\color{blue}{{x}^{2} \cdot -10}}} \]
    18. unpow2N/A

      \[\leadsto \frac{\cos x}{e^{\color{blue}{\left(x \cdot x\right)} \cdot -10}} \]
    19. *-lowering-*.f6494.5

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

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

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

Alternative 10: 94.4% 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}
Derivation
  1. Initial program 94.5%

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

Alternative 11: 27.5% accurate, 1.4× speedup?

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

\\
e^{10 \cdot \left(x \cdot x\right)} \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, -0.001388888888888889, 0.041666666666666664\right), -0.5\right), 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. 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. accelerator-lowering-fma.f64N/A

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

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

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

      \[\leadsto \mathsf{fma}\left(x \cdot x, \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)}, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    6. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 27.5% accurate, 1.4× speedup?

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

\\
e^{x \cdot \left(x \cdot 10\right)} \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, -0.001388888888888889, 0.041666666666666664\right), -0.5\right), 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. Taylor expanded in x around inf

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

      \[\leadsto \color{blue}{e^{10 \cdot {x}^{2}} \cdot \cos x} \]
    2. *-lft-identityN/A

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

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

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

      \[\leadsto e^{\color{blue}{{x}^{2} \cdot 10}} \cdot \left(1 \cdot \cos x\right) \]
    6. unpow2N/A

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

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

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

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

      \[\leadsto e^{x \cdot \left(x \cdot 10\right)} \cdot \color{blue}{\cos x} \]
    11. cos-lowering-cos.f6494.3

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

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

    \[\leadsto e^{x \cdot \left(x \cdot 10\right)} \cdot \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)} \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto e^{x \cdot \left(x \cdot 10\right)} \cdot \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)} \]
    2. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 21.3% accurate, 1.6× speedup?

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

\\
e^{x \cdot \left(x \cdot 10\right)} \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.041666666666666664, -0.5\right), 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. Taylor expanded in x around inf

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

      \[\leadsto \color{blue}{e^{10 \cdot {x}^{2}} \cdot \cos x} \]
    2. *-lft-identityN/A

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

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

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

      \[\leadsto e^{\color{blue}{{x}^{2} \cdot 10}} \cdot \left(1 \cdot \cos x\right) \]
    6. unpow2N/A

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

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

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

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

      \[\leadsto e^{x \cdot \left(x \cdot 10\right)} \cdot \color{blue}{\cos x} \]
    11. cos-lowering-cos.f6494.3

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 18.2% accurate, 1.7× speedup?

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

\\
e^{x \cdot \left(x \cdot 10\right)} \cdot \mathsf{fma}\left(x, x \cdot -0.5, 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. Taylor expanded in x around inf

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

      \[\leadsto \color{blue}{e^{10 \cdot {x}^{2}} \cdot \cos x} \]
    2. *-lft-identityN/A

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

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

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

      \[\leadsto e^{\color{blue}{{x}^{2} \cdot 10}} \cdot \left(1 \cdot \cos x\right) \]
    6. unpow2N/A

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

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

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

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

      \[\leadsto e^{x \cdot \left(x \cdot 10\right)} \cdot \color{blue}{\cos x} \]
    11. cos-lowering-cos.f6494.3

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

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

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

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

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

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

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

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

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

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

Alternative 15: 10.2% accurate, 3.5× speedup?

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

\\
\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.041666666666666664, -0.5\right), 1\right) \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 166.66666666666666, 50\right), 10\right), 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. 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. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \frac{1}{24}, \frac{-1}{2}\right), 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)} \]
  7. Simplified10.2%

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

Alternative 16: 10.0% accurate, 4.3× speedup?

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

\\
\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.041666666666666664, -0.5\right), 1\right) \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 50, 10\right), 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. 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. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 9.8% accurate, 5.5× speedup?

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

\\
\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.041666666666666664, -0.5\right), 1\right) \cdot \mathsf{fma}\left(x, x \cdot 10, 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. 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. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \frac{1}{24}, \frac{-1}{2}\right), 1\right) \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot 10 + 1\right) \]
    4. associate-*r*N/A

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

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

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

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

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

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

Alternative 18: 9.7% accurate, 19.6× speedup?

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

\\
-0.5 \cdot \left(x \cdot x\right)
\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 \cos x \cdot \color{blue}{1} \]
  4. Step-by-step derivation
    1. Simplified9.6%

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

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

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot {x}^{2} + 1} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{-1}{2}} + 1 \]
      3. unpow2N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot {x}^{2}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{-1}{2}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{{x}^{2} \cdot \frac{-1}{2}} \]
      3. unpow2N/A

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

        \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot -0.5 \]
    7. Simplified9.7%

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

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

    Alternative 19: 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. Simplified1.5%

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

      Reproduce

      ?
      herbie shell --seed 2024204 
      (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)))))