ENA, Section 1.4, Exercise 1

Percentage Accurate: 94.5% → 99.2%
Time: 11.1s
Alternatives: 16
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 16 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.2% accurate, 0.5× speedup?

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \left({\left({\left(e^{10}\right)}^{x}\right)}^{\color{blue}{x}}\right)\right) \]
    3. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{x}\right), \color{blue}{x}\right)\right) \]
    4. pow-expN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left(e^{10 \cdot x}\right), x\right)\right) \]
    5. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left(e^{x \cdot 10}\right), x\right)\right) \]
    6. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{exp.f64}\left(\left(x \cdot 10\right)\right), x\right)\right) \]
    7. *-lowering-*.f6494.9%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{exp.f64}\left(\mathsf{*.f64}\left(x, 10\right)\right), x\right)\right) \]
  4. Applied egg-rr94.9%

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{x}\right), x\right)\right) \]
    3. *-rgt-identityN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(x \cdot 1\right)}\right), x\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(x \cdot \left(\frac{1}{2} \cdot 2\right)\right)}\right), x\right)\right) \]
    5. associate-*l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(x \cdot \frac{1}{2}\right) \cdot 2\right)}\right), x\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(x \cdot \frac{1}{2}\right) \cdot 2\right)}\right), x\right)\right) \]
    7. div-invN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\frac{x}{2} \cdot 2\right)}\right), x\right)\right) \]
    8. frac-2negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\frac{\mathsf{neg}\left(x\right)}{\mathsf{neg}\left(2\right)} \cdot 2\right)}\right), x\right)\right) \]
    9. div-invN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{\mathsf{neg}\left(2\right)}\right) \cdot 2\right)}\right), x\right)\right) \]
    10. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{-2}\right) \cdot 2\right)}\right), x\right)\right) \]
    11. metadata-evalN/A

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\frac{-1}{2} \cdot 2\right)\right)}\right), x\right)\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot -1\right)}\right), x\right)\right) \]
    14. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\frac{-1}{2} + \frac{-1}{2}\right)\right)}\right), x\right)\right) \]
    15. distribute-lft-outN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \frac{-1}{2} + \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{-1}{2}\right)}\right), x\right)\right) \]
    16. distribute-rgt-outN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\frac{-1}{2} \cdot \left(\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right)\right)}\right), x\right)\right) \]
    17. pow-unpowN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left({\left(e^{10}\right)}^{\frac{-1}{2}}\right)}^{\left(\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right)}\right), x\right)\right) \]
    18. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\frac{-1}{2}}\right), \left(\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right)\right), x\right)\right) \]
    19. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\left(e^{10}\right), \frac{-1}{2}\right), \left(\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right)\right), x\right)\right) \]
    20. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(10\right), \frac{-1}{2}\right), \left(\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right)\right), x\right)\right) \]
    21. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(10\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\left(\mathsf{neg}\left(x\right)\right), \left(\mathsf{neg}\left(x\right)\right)\right)\right), x\right)\right) \]
  6. Applied egg-rr98.8%

    \[\leadsto \cos x \cdot {\color{blue}{\left({\left({\left(e^{10}\right)}^{-0.5}\right)}^{\left(\left(0 - x\right) + \left(0 - x\right)\right)}\right)}}^{x} \]
  7. Step-by-step derivation
    1. unpow-prod-upN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left({\left(e^{10}\right)}^{\frac{-1}{2}}\right)}^{\left(0 - x\right)} \cdot {\left({\left(e^{10}\right)}^{\frac{-1}{2}}\right)}^{\left(0 - x\right)}\right), x\right)\right) \]
    2. pow-powN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\frac{-1}{2} \cdot \left(0 - x\right)\right)} \cdot {\left({\left(e^{10}\right)}^{\frac{-1}{2}}\right)}^{\left(0 - x\right)}\right), x\right)\right) \]
    3. pow-powN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\frac{-1}{2} \cdot \left(0 - x\right)\right)} \cdot {\left(e^{10}\right)}^{\left(\frac{-1}{2} \cdot \left(0 - x\right)\right)}\right), x\right)\right) \]
    4. pow-prod-downN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10} \cdot e^{10}\right)}^{\left(\frac{-1}{2} \cdot \left(0 - x\right)\right)}\right), x\right)\right) \]
    5. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\left(e^{10} \cdot e^{10}\right), \left(\frac{-1}{2} \cdot \left(0 - x\right)\right)\right), x\right)\right) \]
    6. prod-expN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\left(e^{10 + 10}\right), \left(\frac{-1}{2} \cdot \left(0 - x\right)\right)\right), x\right)\right) \]
    7. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(\left(10 + 10\right)\right), \left(\frac{-1}{2} \cdot \left(0 - x\right)\right)\right), x\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(20\right), \left(\frac{-1}{2} \cdot \left(0 - x\right)\right)\right), x\right)\right) \]
    9. sub0-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(20\right), \left(\frac{-1}{2} \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right), x\right)\right) \]
    10. distribute-rgt-neg-outN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(20\right), \left(\mathsf{neg}\left(\frac{-1}{2} \cdot x\right)\right)\right), x\right)\right) \]
    11. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(20\right), \left(\mathsf{neg}\left(x \cdot \frac{-1}{2}\right)\right)\right), x\right)\right) \]
    12. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(20\right), \left(x \cdot \left(\mathsf{neg}\left(\frac{-1}{2}\right)\right)\right)\right), x\right)\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(20\right), \left(x \cdot \frac{1}{2}\right)\right), x\right)\right) \]
    14. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(20\right), \left(x \cdot \frac{1}{2}\right)\right), x\right)\right) \]
    15. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(20\right), \mathsf{*.f64}\left(x, \left(\frac{1}{2}\right)\right)\right), x\right)\right) \]
    16. metadata-eval99.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(20\right), \mathsf{*.f64}\left(x, \frac{1}{2}\right)\right), x\right)\right) \]
  8. Applied egg-rr99.2%

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

Alternative 2: 98.4% accurate, 0.5× speedup?

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \left({\left({\left(e^{10}\right)}^{x}\right)}^{\color{blue}{x}}\right)\right) \]
    3. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{x}\right), \color{blue}{x}\right)\right) \]
    4. pow-expN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left(e^{10 \cdot x}\right), x\right)\right) \]
    5. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left(e^{x \cdot 10}\right), x\right)\right) \]
    6. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{exp.f64}\left(\left(x \cdot 10\right)\right), x\right)\right) \]
    7. *-lowering-*.f6494.9%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{exp.f64}\left(\mathsf{*.f64}\left(x, 10\right)\right), x\right)\right) \]
  4. Applied egg-rr94.9%

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{x}\right), x\right)\right) \]
    3. *-rgt-identityN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(x \cdot 1\right)}\right), x\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(x \cdot \left(\frac{1}{2} \cdot 2\right)\right)}\right), x\right)\right) \]
    5. associate-*l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(x \cdot \frac{1}{2}\right) \cdot 2\right)}\right), x\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(x \cdot \frac{1}{2}\right) \cdot 2\right)}\right), x\right)\right) \]
    7. div-invN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\frac{x}{2} \cdot 2\right)}\right), x\right)\right) \]
    8. frac-2negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\frac{\mathsf{neg}\left(x\right)}{\mathsf{neg}\left(2\right)} \cdot 2\right)}\right), x\right)\right) \]
    9. div-invN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{\mathsf{neg}\left(2\right)}\right) \cdot 2\right)}\right), x\right)\right) \]
    10. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{-2}\right) \cdot 2\right)}\right), x\right)\right) \]
    11. metadata-evalN/A

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\frac{-1}{2} \cdot 2\right)\right)}\right), x\right)\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot -1\right)}\right), x\right)\right) \]
    14. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\frac{-1}{2} + \frac{-1}{2}\right)\right)}\right), x\right)\right) \]
    15. distribute-lft-outN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \frac{-1}{2} + \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{-1}{2}\right)}\right), x\right)\right) \]
    16. distribute-rgt-outN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\left(\frac{-1}{2} \cdot \left(\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right)\right)}\right), x\right)\right) \]
    17. pow-unpowN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left({\left(e^{10}\right)}^{\frac{-1}{2}}\right)}^{\left(\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right)}\right), x\right)\right) \]
    18. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{\frac{-1}{2}}\right), \left(\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right)\right), x\right)\right) \]
    19. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\left(e^{10}\right), \frac{-1}{2}\right), \left(\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right)\right), x\right)\right) \]
    20. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(10\right), \frac{-1}{2}\right), \left(\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right)\right), x\right)\right) \]
    21. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(10\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\left(\mathsf{neg}\left(x\right)\right), \left(\mathsf{neg}\left(x\right)\right)\right)\right), x\right)\right) \]
  6. Applied egg-rr98.8%

    \[\leadsto \cos x \cdot {\color{blue}{\left({\left({\left(e^{10}\right)}^{-0.5}\right)}^{\left(\left(0 - x\right) + \left(0 - x\right)\right)}\right)}}^{x} \]
  7. Step-by-step derivation
    1. sub0-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left({\left(e^{10}\right)}^{\frac{-1}{2}}\right)}^{\left(\left(\mathsf{neg}\left(x\right)\right) + \left(0 - x\right)\right)}\right), x\right)\right) \]
    2. sub0-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left({\left(e^{10}\right)}^{\frac{-1}{2}}\right)}^{\left(\left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)\right)}\right), x\right)\right) \]
    3. distribute-neg-outN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left({\left(e^{10}\right)}^{\frac{-1}{2}}\right)}^{\left(\mathsf{neg}\left(\left(x + x\right)\right)\right)}\right), x\right)\right) \]
    4. neg-mul-1N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left({\left(e^{10}\right)}^{\frac{-1}{2}}\right)}^{\left(-1 \cdot \left(x + x\right)\right)}\right), x\right)\right) \]
    5. pow-unpowN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left({\left({\left(e^{10}\right)}^{\frac{-1}{2}}\right)}^{-1}\right)}^{\left(x + x\right)}\right), x\right)\right) \]
    6. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\left({\left({\left(e^{10}\right)}^{\frac{-1}{2}}\right)}^{-1}\right), \left(x + x\right)\right), x\right)\right) \]
    7. pow-to-expN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\left(e^{\log \left({\left(e^{10}\right)}^{\frac{-1}{2}}\right) \cdot -1}\right), \left(x + x\right)\right), x\right)\right) \]
    8. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(\left(\log \left({\left(e^{10}\right)}^{\frac{-1}{2}}\right) \cdot -1\right)\right), \left(x + x\right)\right), x\right)\right) \]
    9. pow-expN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(\left(\log \left(e^{10 \cdot \frac{-1}{2}}\right) \cdot -1\right)\right), \left(x + x\right)\right), x\right)\right) \]
    10. rem-log-expN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(\left(\left(10 \cdot \frac{-1}{2}\right) \cdot -1\right)\right), \left(x + x\right)\right), x\right)\right) \]
    11. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(\left(-5 \cdot -1\right)\right), \left(x + x\right)\right), x\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(5\right), \left(x + x\right)\right), x\right)\right) \]
    13. count-2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(5\right), \left(2 \cdot x\right)\right), x\right)\right) \]
    14. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(5\right), \left(x \cdot 2\right)\right), x\right)\right) \]
    15. *-lowering-*.f6498.3%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(5\right), \mathsf{*.f64}\left(x, 2\right)\right), x\right)\right) \]
  8. Applied egg-rr98.3%

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

Alternative 3: 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.3%

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \left({\left({\left(e^{10}\right)}^{x}\right)}^{\color{blue}{x}}\right)\right) \]
    3. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{x}\right), \color{blue}{x}\right)\right) \]
    4. pow-expN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left(e^{10 \cdot x}\right), x\right)\right) \]
    5. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left(e^{x \cdot 10}\right), x\right)\right) \]
    6. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{exp.f64}\left(\left(x \cdot 10\right)\right), x\right)\right) \]
    7. *-lowering-*.f6494.9%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{exp.f64}\left(\mathsf{*.f64}\left(x, 10\right)\right), x\right)\right) \]
  4. Applied egg-rr94.9%

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\left({\left(e^{10}\right)}^{x}\right), x\right)\right) \]
    3. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\left(e^{10}\right), x\right), x\right)\right) \]
    4. exp-lowering-exp.f6498.0%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{pow.f64}\left(\mathsf{exp.f64}\left(10\right), x\right), x\right)\right) \]
  6. Applied egg-rr98.0%

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

Alternative 4: 95.3% 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.3%

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{exp.f64}\left(10\right), \left(\color{blue}{x} \cdot x\right)\right)\right) \]
    4. *-lowering-*.f6495.4%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{exp.f64}\left(10\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
  4. Applied egg-rr95.4%

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

Alternative 5: 94.8% accurate, 1.0× speedup?

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{exp.f64}\left(10\right), \left(\color{blue}{x} \cdot x\right)\right)\right) \]
    4. *-lowering-*.f6495.4%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{pow.f64}\left(\mathsf{exp.f64}\left(10\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
  4. Applied egg-rr95.4%

    \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
  5. Applied egg-rr94.7%

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

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

Alternative 6: 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.3%

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

Alternative 7: 27.5% accurate, 1.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({x}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {x}^{2}\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
    9. metadata-evalN/A

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\left({x}^{2}\right), \left(\frac{1}{24} + \frac{-1}{720} \cdot {x}^{2}\right)\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
    13. unpow2N/A

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{24} + \frac{-1}{720} \cdot {x}^{2}\right)\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
    15. remove-double-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{24} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{-1}{720} \cdot {x}^{2}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
    16. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{24} - \left(\mathsf{neg}\left(\frac{-1}{720} \cdot {x}^{2}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
    17. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{\_.f64}\left(\frac{1}{24}, \left(\mathsf{neg}\left(\frac{-1}{720} \cdot {x}^{2}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
    18. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{\_.f64}\left(\frac{1}{24}, \left(\mathsf{neg}\left({x}^{2} \cdot \frac{-1}{720}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
    19. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{\_.f64}\left(\frac{1}{24}, \left({x}^{2} \cdot \left(\mathsf{neg}\left(\frac{-1}{720}\right)\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
    20. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{\_.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({x}^{2}\right), \left(\mathsf{neg}\left(\frac{-1}{720}\right)\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
  5. Simplified27.6%

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

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

Alternative 8: 21.3% accurate, 1.7× speedup?

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

\\
e^{10 \cdot \left(x \cdot x\right)} \cdot \left(1 + x \cdot \left(x \cdot \left(-0.5 + \left(x \cdot x\right) \cdot 0.041666666666666664\right)\right)\right)
\end{array}
Derivation
  1. Initial program 94.3%

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{exp.f64}\left(\left(10 \cdot \left(x \cdot x\right)\right)\right)\right) \]
    4. associate-*r*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{exp.f64}\left(\left(\left(10 \cdot x\right) \cdot x\right)\right)\right) \]
    5. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{exp.f64}\left(\left(x \cdot \left(10 \cdot x\right)\right)\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(x, \left(10 \cdot x\right)\right)\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(x, \left(x \cdot 10\right)\right)\right)\right) \]
    8. *-lowering-*.f6494.3%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(x\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, 10\right)\right)\right)\right) \]
  3. Simplified94.3%

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + {x}^{2} \cdot \left(\frac{1}{24} \cdot {x}^{2} - \frac{1}{2}\right)\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, 10\right)\right)\right)\right) \]
  6. Step-by-step derivation
    1. +-lowering-+.f64N/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\left({x}^{2}\right), \frac{1}{24}\right)\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, 10\right)\right)\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\left(x \cdot x\right), \frac{1}{24}\right)\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, 10\right)\right)\right)\right) \]
    12. *-lowering-*.f6421.3%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \frac{1}{24}\right)\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, 10\right)\right)\right)\right) \]
  7. Simplified21.3%

    \[\leadsto \color{blue}{\left(1 + \left(x \cdot x\right) \cdot \left(-0.5 + \left(x \cdot x\right) \cdot 0.041666666666666664\right)\right)} \cdot e^{x \cdot \left(x \cdot 10\right)} \]
  8. Taylor expanded in x around inf

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

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

Alternative 9: 18.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \left(1 + x \cdot \left(x \cdot -0.5\right)\right) \cdot {e}^{\left(10 \cdot \left(x \cdot x\right)\right)} \end{array} \]
(FPCore (x)
 :precision binary64
 (* (+ 1.0 (* x (* x -0.5))) (pow E (* 10.0 (* x x)))))
double code(double x) {
	return (1.0 + (x * (x * -0.5))) * pow(((double) M_E), (10.0 * (x * x)));
}
public static double code(double x) {
	return (1.0 + (x * (x * -0.5))) * Math.pow(Math.E, (10.0 * (x * x)));
}
def code(x):
	return (1.0 + (x * (x * -0.5))) * math.pow(math.e, (10.0 * (x * x)))
function code(x)
	return Float64(Float64(1.0 + Float64(x * Float64(x * -0.5))) * (exp(1) ^ Float64(10.0 * Float64(x * x))))
end
function tmp = code(x)
	tmp = (1.0 + (x * (x * -0.5))) * (2.71828182845904523536 ^ (10.0 * (x * x)));
end
code[x_] := N[(N[(1.0 + N[(x * N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[E, N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(1 + x \cdot \left(x \cdot -0.5\right)\right) \cdot {e}^{\left(10 \cdot \left(x \cdot x\right)\right)}
\end{array}
Derivation
  1. Initial program 94.3%

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-lowering-+.f64N/A

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \frac{-1}{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
    7. *-lowering-*.f6418.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
  5. Simplified18.2%

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \left({\left(e^{\log \left(e^{10}\right)}\right)}^{\left(x \cdot x\right)}\right)\right) \]
    3. rem-log-expN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \left({\left(e^{10}\right)}^{\left(x \cdot x\right)}\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \left({\left(e^{1 \cdot 10}\right)}^{\left(x \cdot x\right)}\right)\right) \]
    5. pow-expN/A

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{pow.f64}\left(\left(e^{1}\right), \color{blue}{\left(10 \cdot \left(x \cdot x\right)\right)}\right)\right) \]
    8. exp-1-eN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{E}\left(\right), \left(\color{blue}{10} \cdot \left(x \cdot x\right)\right)\right)\right) \]
    9. E-lowering-E.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{E.f64}\left(\right), \left(\color{blue}{10} \cdot \left(x \cdot x\right)\right)\right)\right) \]
    10. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{E.f64}\left(\right), \mathsf{*.f64}\left(10, \color{blue}{\left(x \cdot x\right)}\right)\right)\right) \]
    11. *-lowering-*.f6418.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{E.f64}\left(\right), \mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
  7. Applied egg-rr18.2%

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

Alternative 10: 18.2% accurate, 1.8× speedup?

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

\\
e^{10 \cdot \left(x \cdot x\right)} \cdot \left(1 + x \cdot \left(x \cdot -0.5\right)\right)
\end{array}
Derivation
  1. Initial program 94.3%

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-lowering-+.f64N/A

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \frac{-1}{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
    7. *-lowering-*.f6418.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
  5. Simplified18.2%

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

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

Alternative 11: 16.9% accurate, 1.9× speedup?

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

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

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-lowering-+.f64N/A

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \frac{-1}{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
    7. *-lowering-*.f6418.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
  5. Simplified18.2%

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{-1}{2} \cdot {x}^{2}\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
  7. Step-by-step derivation
    1. unpow2N/A

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \left(x \cdot \frac{-1}{2}\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \color{blue}{\mathsf{*.f64}\left(x, x\right)}\right)\right)\right) \]
    6. *-lowering-*.f6416.9%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \color{blue}{\mathsf{*.f64}\left(x, x\right)}\right)\right)\right) \]
  8. Simplified16.9%

    \[\leadsto \color{blue}{\left(x \cdot \left(x \cdot -0.5\right)\right)} \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  9. Final simplification16.9%

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

Alternative 12: 10.3% accurate, 7.7× speedup?

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

\\
\left(1 + x \cdot \left(x \cdot -0.5\right)\right) \cdot \left(1 + \left(x \cdot x\right) \cdot \left(10 + \left(x \cdot x\right) \cdot \left(50 + \left(x \cdot x\right) \cdot 166.66666666666666\right)\right)\right)
\end{array}
Derivation
  1. Initial program 94.3%

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-lowering-+.f64N/A

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \frac{-1}{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
    7. *-lowering-*.f6418.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
  5. Simplified18.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(10, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(50, \mathsf{*.f64}\left(\left(x \cdot x\right), \frac{500}{3}\right)\right)\right)\right)\right)\right)\right) \]
    13. *-lowering-*.f6410.3%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(10, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(50, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \frac{500}{3}\right)\right)\right)\right)\right)\right)\right) \]
  8. Simplified10.3%

    \[\leadsto \left(1 + x \cdot \left(x \cdot -0.5\right)\right) \cdot \color{blue}{\left(1 + \left(x \cdot x\right) \cdot \left(10 + \left(x \cdot x\right) \cdot \left(50 + \left(x \cdot x\right) \cdot 166.66666666666666\right)\right)\right)} \]
  9. Add Preprocessing

Alternative 13: 10.1% accurate, 9.9× speedup?

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

\\
\left(1 + x \cdot \left(x \cdot -0.5\right)\right) \cdot \left(1 + \left(x \cdot x\right) \cdot \left(10 + \left(x \cdot x\right) \cdot 50\right)\right)
\end{array}
Derivation
  1. Initial program 94.3%

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-lowering-+.f64N/A

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \frac{-1}{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
    7. *-lowering-*.f6418.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
  5. Simplified18.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(10, \mathsf{*.f64}\left(\left(x \cdot x\right), 50\right)\right)\right)\right)\right) \]
    9. *-lowering-*.f6410.1%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(10, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), 50\right)\right)\right)\right)\right) \]
  8. Simplified10.1%

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

Alternative 14: 9.9% accurate, 13.8× speedup?

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

\\
\left(1 + x \cdot \left(x \cdot -0.5\right)\right) \cdot \left(10 \cdot \left(x \cdot x\right) + 1\right)
\end{array}
Derivation
  1. Initial program 94.3%

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-lowering-+.f64N/A

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \frac{-1}{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
    7. *-lowering-*.f6418.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
  5. Simplified18.2%

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
  8. Simplified9.9%

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

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

Alternative 15: 9.7% accurate, 41.4× speedup?

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

\\
\left(x \cdot x\right) \cdot -0.5
\end{array}
Derivation
  1. Initial program 94.3%

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, x\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. +-lowering-+.f64N/A

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \frac{-1}{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
    7. *-lowering-*.f6418.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(10, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right) \]
  5. Simplified18.2%

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

    \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{-1}{2}\right)\right)\right), \color{blue}{1}\right) \]
  7. Step-by-step derivation
    1. Simplified9.7%

      \[\leadsto \left(1 + x \cdot \left(x \cdot -0.5\right)\right) \cdot \color{blue}{1} \]
    2. Taylor expanded in x around inf

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(x \cdot x\right), \frac{-1}{2}\right) \]
      4. *-lowering-*.f649.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \frac{-1}{2}\right) \]
    4. Simplified9.7%

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot -0.5} \]
    5. Add Preprocessing

    Alternative 16: 1.5% accurate, 207.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.3%

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

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

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

      Reproduce

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