ENA, Section 1.4, Exercise 1

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 18 alternatives:

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

Initial Program: 94.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.4% accurate, 0.5× speedup?

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

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

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

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

      \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(x \cdot x\right)}} \]
    3. sinh-+-cosh-revN/A

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

      \[\leadsto \cos x \cdot \color{blue}{\frac{\cosh \left(10 \cdot \left(x \cdot x\right)\right) \cdot \cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right) \cdot \sinh \left(10 \cdot \left(x \cdot x\right)\right)}{\cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right)}} \]
    5. sinh-coshN/A

      \[\leadsto \cos x \cdot \frac{\color{blue}{1}}{\cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right)} \]
    6. sinh---cosh-revN/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1 \cdot \cos x}{e^{\mathsf{neg}\left(\color{blue}{10 \cdot \left(x \cdot x\right)}\right)}} \]
    17. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\cos x}}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(\frac{x}{-2}\right)}} \]
  8. Applied rewrites99.5%

    \[\leadsto \frac{\color{blue}{\cos x}}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(\frac{x}{-2}\right)}} \]
  9. Add Preprocessing

Alternative 2: 95.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \sin \left(\left(-\left(\frac{\mathsf{PI}\left(\right)}{2} + x\right)\right) + \mathsf{PI}\left(\right)\right) \cdot {\left({\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}\right)}^{-1} \end{array} \]
(FPCore (x)
 :precision binary64
 (*
  (sin (+ (- (+ (/ (PI) 2.0) x)) (PI)))
  (pow (pow (exp 10.0) (* (- x) x)) -1.0)))
\begin{array}{l}

\\
\sin \left(\left(-\left(\frac{\mathsf{PI}\left(\right)}{2} + x\right)\right) + \mathsf{PI}\left(\right)\right) \cdot {\left({\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}\right)}^{-1}
\end{array}
Derivation
  1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin \left(x + \frac{\mathsf{PI}\left(\right)}{2}\right)}\right)\right)\right)\right) \cdot \frac{1}{{\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}} \]
    4. sin-neg-revN/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\sin \left(\mathsf{neg}\left(\left(x + \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right)}\right)\right) \cdot \frac{1}{{\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}} \]
    5. sin-+PI-revN/A

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\left(-\left(\frac{\color{blue}{\mathsf{PI}\left(\right)}}{2} + x\right)\right) + \mathsf{PI}\left(\right)\right) \cdot \frac{1}{{\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}} \]
    13. lower-PI.f6495.4

      \[\leadsto \sin \left(\left(-\left(\frac{\mathsf{PI}\left(\right)}{2} + x\right)\right) + \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot \frac{1}{{\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}} \]
  6. Applied rewrites95.4%

    \[\leadsto \color{blue}{\sin \left(\left(-\left(\frac{\mathsf{PI}\left(\right)}{2} + x\right)\right) + \mathsf{PI}\left(\right)\right)} \cdot \frac{1}{{\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}} \]
  7. Final simplification95.4%

    \[\leadsto \sin \left(\left(-\left(\frac{\mathsf{PI}\left(\right)}{2} + x\right)\right) + \mathsf{PI}\left(\right)\right) \cdot {\left({\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}\right)}^{-1} \]
  8. Add Preprocessing

Alternative 3: 95.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \sin \left(\frac{\mathsf{PI}\left(\right)}{2} - x\right) \cdot {\left({\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}\right)}^{-1} \end{array} \]
(FPCore (x)
 :precision binary64
 (* (sin (- (/ (PI) 2.0) x)) (pow (pow (exp 10.0) (* (- x) x)) -1.0)))
\begin{array}{l}

\\
\sin \left(\frac{\mathsf{PI}\left(\right)}{2} - x\right) \cdot {\left({\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}\right)}^{-1}
\end{array}
Derivation
  1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{2}} + \left(-x\right)\right) \cdot \frac{1}{{\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}} \]
    9. lower-PI.f6495.4

      \[\leadsto \sin \left(\frac{\color{blue}{\mathsf{PI}\left(\right)}}{2} + \left(-x\right)\right) \cdot \frac{1}{{\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}} \]
  6. Applied rewrites95.4%

    \[\leadsto \color{blue}{\sin \left(\frac{\mathsf{PI}\left(\right)}{2} + \left(-x\right)\right)} \cdot \frac{1}{{\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}} \]
  7. Final simplification95.4%

    \[\leadsto \sin \left(\frac{\mathsf{PI}\left(\right)}{2} - x\right) \cdot {\left({\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}\right)}^{-1} \]
  8. Add Preprocessing

Alternative 4: 99.4% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot \frac{1}{{\left({\color{blue}{\left(e^{10}\right)}}^{\left(\mathsf{neg}\left(x\right)\right)}\right)}^{x}} \]
    12. lower-neg.f6498.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot {\left({\left(e^{\color{blue}{20}}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)} \]
    23. lower-/.f6499.3

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

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

Alternative 5: 98.1% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos x \cdot \frac{1}{{\left({\color{blue}{\left(e^{10}\right)}}^{\left(\mathsf{neg}\left(x\right)\right)}\right)}^{x}} \]
    12. lower-neg.f6498.1

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

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

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

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

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

      \[\leadsto \cos x \cdot {\left({\left(e^{10}\right)}^{\left(-x\right)}\right)}^{\color{blue}{\left(-x\right)}} \]
    5. lower-pow.f6498.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 97.9% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 96.8% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 95.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \frac{\sin \left(\mathsf{fma}\left(-1.5, \mathsf{PI}\left(\right), x\right)\right)}{{\left(e^{-10}\right)}^{\left(x \cdot x\right)}} \end{array} \]
(FPCore (x)
 :precision binary64
 (/ (sin (fma -1.5 (PI) x)) (pow (exp -10.0) (* x x))))
\begin{array}{l}

\\
\frac{\sin \left(\mathsf{fma}\left(-1.5, \mathsf{PI}\left(\right), x\right)\right)}{{\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. lift-*.f64N/A

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

      \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(x \cdot x\right)}} \]
    3. sinh-+-cosh-revN/A

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

      \[\leadsto \cos x \cdot \color{blue}{\frac{\cosh \left(10 \cdot \left(x \cdot x\right)\right) \cdot \cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right) \cdot \sinh \left(10 \cdot \left(x \cdot x\right)\right)}{\cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right)}} \]
    5. sinh-coshN/A

      \[\leadsto \cos x \cdot \frac{\color{blue}{1}}{\cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right)} \]
    6. sinh---cosh-revN/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1 \cdot \cos x}{e^{\mathsf{neg}\left(\color{blue}{10 \cdot \left(x \cdot x\right)}\right)}} \]
    17. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1 \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \color{blue}{\left(-x\right)}\right)\right)\right)\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    9. sin-+PI/2-revN/A

      \[\leadsto \frac{1 \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin \left(\left(-x\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}\right)\right)\right)\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    10. sin-+PI-revN/A

      \[\leadsto \frac{1 \cdot \left(\mathsf{neg}\left(\color{blue}{\sin \left(\left(\left(-x\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \mathsf{PI}\left(\right)\right)}\right)\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    11. sin-neg-revN/A

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

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

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

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

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

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

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

      \[\leadsto \frac{1 \cdot \sin \left(-\left(\left(\frac{\color{blue}{\mathsf{PI}\left(\right)}}{2} + \left(-x\right)\right) + \mathsf{PI}\left(\right)\right)\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    19. lower-PI.f6494.4

      \[\leadsto \frac{1 \cdot \sin \left(-\left(\left(\frac{\mathsf{PI}\left(\right)}{2} + \left(-x\right)\right) + \color{blue}{\mathsf{PI}\left(\right)}\right)\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \]
  6. Applied rewrites94.4%

    \[\leadsto \frac{1 \cdot \color{blue}{\sin \left(-\left(\left(\frac{\mathsf{PI}\left(\right)}{2} + \left(-x\right)\right) + \mathsf{PI}\left(\right)\right)\right)}}{e^{-10 \cdot \left(x \cdot x\right)}} \]
  7. Taylor expanded in x around inf

    \[\leadsto \color{blue}{\frac{\sin \left(x - \left(\mathsf{PI}\left(\right) + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{e^{-10 \cdot {x}^{2}}}} \]
  8. Step-by-step derivation
    1. Applied rewrites95.3%

      \[\leadsto \color{blue}{\frac{\sin \left(\mathsf{fma}\left(-1.5, \mathsf{PI}\left(\right), x\right)\right)}{{\left(e^{-10}\right)}^{\left(x \cdot x\right)}}} \]
    2. Add Preprocessing

    Alternative 9: 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. lift-exp.f64N/A

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

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

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

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

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

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

    Alternative 10: 94.3% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \frac{\sin \left(\left(\left(\mathsf{PI}\left(\right) + x\right) + \mathsf{PI}\left(\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \end{array} \]
    (FPCore (x)
     :precision binary64
     (/ (sin (+ (+ (+ (PI) x) (PI)) (/ (PI) 2.0))) (exp (* -10.0 (* x x)))))
    \begin{array}{l}
    
    \\
    \frac{\sin \left(\left(\left(\mathsf{PI}\left(\right) + x\right) + \mathsf{PI}\left(\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}{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. lift-*.f64N/A

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

        \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(x \cdot x\right)}} \]
      3. sinh-+-cosh-revN/A

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

        \[\leadsto \cos x \cdot \color{blue}{\frac{\cosh \left(10 \cdot \left(x \cdot x\right)\right) \cdot \cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right) \cdot \sinh \left(10 \cdot \left(x \cdot x\right)\right)}{\cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right)}} \]
      5. sinh-coshN/A

        \[\leadsto \cos x \cdot \frac{\color{blue}{1}}{\cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right)} \]
      6. sinh---cosh-revN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \cos x}{e^{\mathsf{neg}\left(\color{blue}{10 \cdot \left(x \cdot x\right)}\right)}} \]
      17. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos x}\right)\right)\right)\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \]
      7. cos-+PI-revN/A

        \[\leadsto \frac{1 \cdot \left(\mathsf{neg}\left(\color{blue}{\cos \left(x + \mathsf{PI}\left(\right)\right)}\right)\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \]
      8. cos-+PI-revN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \sin \left(\left(\left(\mathsf{PI}\left(\right) + x\right) + \mathsf{PI}\left(\right)\right) + \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}}\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \]
      18. lower-PI.f6494.6

        \[\leadsto \frac{1 \cdot \sin \left(\left(\left(\mathsf{PI}\left(\right) + x\right) + \mathsf{PI}\left(\right)\right) + \frac{\color{blue}{\mathsf{PI}\left(\right)}}{2}\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    6. Applied rewrites94.6%

      \[\leadsto \frac{1 \cdot \color{blue}{\sin \left(\left(\left(\mathsf{PI}\left(\right) + x\right) + \mathsf{PI}\left(\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    7. Final simplification94.6%

      \[\leadsto \frac{\sin \left(\left(\left(\mathsf{PI}\left(\right) + x\right) + \mathsf{PI}\left(\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    8. Add Preprocessing

    Alternative 11: 94.5% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \sin \left(\left(-x\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \end{array} \]
    (FPCore (x)
     :precision binary64
     (* (sin (+ (- x) (/ (PI) 2.0))) (exp (* 10.0 (* x x)))))
    \begin{array}{l}
    
    \\
    \sin \left(\left(-x\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \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. Step-by-step derivation
      1. lift-cos.f64N/A

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

        \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(x\right)\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
      3. sin-+PI/2-revN/A

        \[\leadsto \color{blue}{\sin \left(\left(\mathsf{neg}\left(x\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
      4. lower-sin.f64N/A

        \[\leadsto \color{blue}{\sin \left(\left(\mathsf{neg}\left(x\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
      5. lower-+.f64N/A

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

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

        \[\leadsto \sin \left(\left(-x\right) + \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}}\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
      8. lower-PI.f6494.5

        \[\leadsto \sin \left(\left(-x\right) + \frac{\color{blue}{\mathsf{PI}\left(\right)}}{2}\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    4. Applied rewrites94.5%

      \[\leadsto \color{blue}{\sin \left(\left(-x\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
    5. Add Preprocessing

    Alternative 12: 94.3% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \frac{\cos \left(\left(\mathsf{PI}\left(\right) + x\right) + \mathsf{PI}\left(\right)\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \end{array} \]
    (FPCore (x)
     :precision binary64
     (/ (cos (+ (+ (PI) x) (PI))) (exp (* -10.0 (* x x)))))
    \begin{array}{l}
    
    \\
    \frac{\cos \left(\left(\mathsf{PI}\left(\right) + x\right) + \mathsf{PI}\left(\right)\right)}{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. lift-*.f64N/A

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

        \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(x \cdot x\right)}} \]
      3. sinh-+-cosh-revN/A

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

        \[\leadsto \cos x \cdot \color{blue}{\frac{\cosh \left(10 \cdot \left(x \cdot x\right)\right) \cdot \cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right) \cdot \sinh \left(10 \cdot \left(x \cdot x\right)\right)}{\cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right)}} \]
      5. sinh-coshN/A

        \[\leadsto \cos x \cdot \frac{\color{blue}{1}}{\cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right)} \]
      6. sinh---cosh-revN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \cos x}{e^{\mathsf{neg}\left(\color{blue}{10 \cdot \left(x \cdot x\right)}\right)}} \]
      17. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos x}\right)\right)\right)\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \]
      7. cos-+PI-revN/A

        \[\leadsto \frac{1 \cdot \left(\mathsf{neg}\left(\color{blue}{\cos \left(x + \mathsf{PI}\left(\right)\right)}\right)\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \]
      8. cos-+PI-revN/A

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \cos \left(\left(\color{blue}{\mathsf{PI}\left(\right)} + x\right) + \mathsf{PI}\left(\right)\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \]
      14. lower-PI.f6494.6

        \[\leadsto \frac{1 \cdot \cos \left(\left(\mathsf{PI}\left(\right) + x\right) + \color{blue}{\mathsf{PI}\left(\right)}\right)}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    6. Applied rewrites94.6%

      \[\leadsto \frac{1 \cdot \color{blue}{\cos \left(\left(\mathsf{PI}\left(\right) + x\right) + \mathsf{PI}\left(\right)\right)}}{e^{-10 \cdot \left(x \cdot x\right)}} \]
    7. Final simplification94.6%

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

    Alternative 13: 94.5% 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. lift-*.f64N/A

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

        \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(x \cdot x\right)}} \]
      3. sinh-+-cosh-revN/A

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

        \[\leadsto \cos x \cdot \color{blue}{\frac{\cosh \left(10 \cdot \left(x \cdot x\right)\right) \cdot \cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right) \cdot \sinh \left(10 \cdot \left(x \cdot x\right)\right)}{\cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right)}} \]
      5. sinh-coshN/A

        \[\leadsto \cos x \cdot \frac{\color{blue}{1}}{\cosh \left(10 \cdot \left(x \cdot x\right)\right) - \sinh \left(10 \cdot \left(x \cdot x\right)\right)} \]
      6. sinh---cosh-revN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \cos x}{e^{\mathsf{neg}\left(\color{blue}{10 \cdot \left(x \cdot x\right)}\right)}} \]
      17. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\cos x}}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(\frac{x}{-2}\right)}} \]
    8. Applied rewrites99.5%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\cos x}{\frac{1}{e^{\color{blue}{\frac{x \cdot x}{2} \cdot 20}}}} \]
      13. exp-prodN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 14: 94.5% accurate, 1.0× speedup?

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

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

    Alternative 15: 21.3% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(0.041666666666666664 \cdot \left(x \cdot x\right) - 0.5, x \cdot x, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \end{array} \]
    (FPCore (x)
     :precision binary64
     (*
      (fma (- (* 0.041666666666666664 (* x x)) 0.5) (* x x) 1.0)
      (exp (* 10.0 (* x x)))))
    double code(double x) {
    	return fma(((0.041666666666666664 * (x * x)) - 0.5), (x * x), 1.0) * exp((10.0 * (x * x)));
    }
    
    function code(x)
    	return Float64(fma(Float64(Float64(0.041666666666666664 * Float64(x * x)) - 0.5), Float64(x * x), 1.0) * exp(Float64(10.0 * Float64(x * x))))
    end
    
    code[x_] := N[(N[(N[(N[(0.041666666666666664 * N[(x * x), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(0.041666666666666664 \cdot \left(x \cdot x\right) - 0.5, x \cdot x, 1\right) \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. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

    Alternative 16: 18.2% accurate, 1.7× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(-0.5, x \cdot x, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)} \end{array} \]
    (FPCore (x)
     :precision binary64
     (* (fma -0.5 (* x x) 1.0) (exp (* 10.0 (* x x)))))
    double code(double x) {
    	return fma(-0.5, (x * x), 1.0) * exp((10.0 * (x * x)));
    }
    
    function code(x)
    	return Float64(fma(-0.5, Float64(x * x), 1.0) * exp(Float64(10.0 * Float64(x * x))))
    end
    
    code[x_] := N[(N[(-0.5 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(-0.5, x \cdot x, 1\right) \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. Taylor expanded in x around 0

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

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

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

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

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

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

    Alternative 17: 9.9% accurate, 7.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos x \cdot \mathsf{fma}\left(\frac{1}{2} \cdot \log \color{blue}{\left(e^{10} \cdot e^{10}\right)}, {x}^{2}, 1\right) \]
      6. exp-lft-sqr-revN/A

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

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

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

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

        \[\leadsto \cos x \cdot \mathsf{fma}\left(10, \color{blue}{x \cdot x}, 1\right) \]
      11. lower-*.f649.8

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

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

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

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

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

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

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

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

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

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

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

    Alternative 18: 1.5% accurate, 216.0× speedup?

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

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

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

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

      Reproduce

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