mixedcos

Percentage Accurate: 67.3% → 97.4%
Time: 14.1s
Alternatives: 21
Speedup: 24.1×

Specification

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

\\
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \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 21 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: 67.3% accurate, 1.0× speedup?

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

\\
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\end{array}

Alternative 1: 97.4% accurate, 2.7× speedup?

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

\\
\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}
\end{array}
Derivation
  1. Initial program 65.0%

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
    4. associate-*r*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
    5. *-commutativeN/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
    8. associate-*r*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
    9. *-commutativeN/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
    12. associate-*r*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
    13. *-commutativeN/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
    15. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
    16. associate-*l*N/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
    18. *-lowering-*.f6482.3%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
  3. Simplified82.3%

    \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-/r*N/A

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

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
    3. associate-*r*N/A

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
    4. *-commutativeN/A

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
    5. associate-*l*N/A

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

      \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
    7. *-commutativeN/A

      \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
    8. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
    9. /-lowering-/.f64N/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
    11. count-2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
    12. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
    13. count-2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
    14. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
    15. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
    16. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
    17. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
    18. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
    19. *-lowering-*.f6497.8%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
  6. Applied egg-rr97.8%

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

Alternative 2: 71.7% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(s \cdot c\right)\\ \mathbf{if}\;x \leq 9.5 \cdot 10^{-6}:\\ \;\;\;\;\frac{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}{t\_0}\\ \mathbf{elif}\;x \leq 3.9 \cdot 10^{+130}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{c \cdot \left(c \cdot \left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{s \cdot t\_0}}{x \cdot c}\\ \end{array} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* x (* s c))))
   (if (<= x 9.5e-6)
     (/ (/ (* (+ 1.0 (* (* x x) -2.0)) (/ (/ 1.0 c) s)) x) t_0)
     (if (<= x 3.9e+130)
       (/ (cos (* 2.0 x)) (* c (* c (* s (* s (* x x))))))
       (/ (/ 1.0 (* s t_0)) (* x c))))))
double code(double x, double c, double s) {
	double t_0 = x * (s * c);
	double tmp;
	if (x <= 9.5e-6) {
		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0;
	} else if (x <= 3.9e+130) {
		tmp = cos((2.0 * x)) / (c * (c * (s * (s * (x * x)))));
	} else {
		tmp = (1.0 / (s * t_0)) / (x * c);
	}
	return tmp;
}
real(8) function code(x, c, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c
    real(8), intent (in) :: s
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x * (s * c)
    if (x <= 9.5d-6) then
        tmp = (((1.0d0 + ((x * x) * (-2.0d0))) * ((1.0d0 / c) / s)) / x) / t_0
    else if (x <= 3.9d+130) then
        tmp = cos((2.0d0 * x)) / (c * (c * (s * (s * (x * x)))))
    else
        tmp = (1.0d0 / (s * t_0)) / (x * c)
    end if
    code = tmp
end function
public static double code(double x, double c, double s) {
	double t_0 = x * (s * c);
	double tmp;
	if (x <= 9.5e-6) {
		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0;
	} else if (x <= 3.9e+130) {
		tmp = Math.cos((2.0 * x)) / (c * (c * (s * (s * (x * x)))));
	} else {
		tmp = (1.0 / (s * t_0)) / (x * c);
	}
	return tmp;
}
def code(x, c, s):
	t_0 = x * (s * c)
	tmp = 0
	if x <= 9.5e-6:
		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0
	elif x <= 3.9e+130:
		tmp = math.cos((2.0 * x)) / (c * (c * (s * (s * (x * x)))))
	else:
		tmp = (1.0 / (s * t_0)) / (x * c)
	return tmp
function code(x, c, s)
	t_0 = Float64(x * Float64(s * c))
	tmp = 0.0
	if (x <= 9.5e-6)
		tmp = Float64(Float64(Float64(Float64(1.0 + Float64(Float64(x * x) * -2.0)) * Float64(Float64(1.0 / c) / s)) / x) / t_0);
	elseif (x <= 3.9e+130)
		tmp = Float64(cos(Float64(2.0 * x)) / Float64(c * Float64(c * Float64(s * Float64(s * Float64(x * x))))));
	else
		tmp = Float64(Float64(1.0 / Float64(s * t_0)) / Float64(x * c));
	end
	return tmp
end
function tmp_2 = code(x, c, s)
	t_0 = x * (s * c);
	tmp = 0.0;
	if (x <= 9.5e-6)
		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0;
	elseif (x <= 3.9e+130)
		tmp = cos((2.0 * x)) / (c * (c * (s * (s * (x * x)))));
	else
		tmp = (1.0 / (s * t_0)) / (x * c);
	end
	tmp_2 = tmp;
end
code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 9.5e-6], N[(N[(N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] / s), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[x, 3.9e+130], N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(c * N[(c * N[(s * N[(s * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(s * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x * c), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(s \cdot c\right)\\
\mathbf{if}\;x \leq 9.5 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}{t\_0}\\

\mathbf{elif}\;x \leq 3.9 \cdot 10^{+130}:\\
\;\;\;\;\frac{\cos \left(2 \cdot x\right)}{c \cdot \left(c \cdot \left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{s \cdot t\_0}}{x \cdot c}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 9.5000000000000005e-6

    1. Initial program 62.9%

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
      4. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
      5. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
      9. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
      13. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
      16. associate-*l*N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
      18. *-lowering-*.f6481.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
    3. Simplified81.4%

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/r*N/A

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

        \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
      3. associate-*r*N/A

        \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
      5. associate-*l*N/A

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

        \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
      9. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
      11. count-2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
      12. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
      13. count-2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
      19. *-lowering-*.f6498.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
    6. Applied egg-rr98.1%

      \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
    7. Taylor expanded in x around 0

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{x}^{2}}{c \cdot s} + \frac{1}{c \cdot s}\right), x\right), \mathsf{*.f64}\left(\color{blue}{x}, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
    9. Simplified67.8%

      \[\leadsto \frac{\color{blue}{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}}{x \cdot \left(s \cdot c\right)} \]

    if 9.5000000000000005e-6 < x < 3.9000000000000002e130

    1. Initial program 79.1%

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
      4. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
      5. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
      9. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
      13. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
      16. associate-*l*N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
      18. *-lowering-*.f6489.9%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
    3. Simplified89.9%

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left(c \cdot c\right) \cdot \left(\color{blue}{{s}^{2}} \cdot {x}^{2}\right)\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(c \cdot \color{blue}{\left(c \cdot \left({s}^{2} \cdot {x}^{2}\right)\right)}\right)\right) \]
      6. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(c, \color{blue}{\left(\left({s}^{2} \cdot {x}^{2}\right) \cdot c\right)}\right)\right) \]
      8. *-commutativeN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(\left(s \cdot s\right) \cdot {\color{blue}{x}}^{2}\right)\right)\right)\right) \]
      11. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(s \cdot \color{blue}{\left(s \cdot {x}^{2}\right)}\right)\right)\right)\right) \]
      12. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \color{blue}{\left({x}^{2} \cdot s\right)}\right)\right)\right)\right) \]
      14. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \color{blue}{\left({x}^{2}\right)}\right)\right)\right)\right)\right) \]
      16. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \left(x \cdot \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f6483.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
    7. Simplified83.7%

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{c \cdot \left(c \cdot \left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right)\right)}} \]

    if 3.9000000000000002e130 < x

    1. Initial program 61.1%

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
      4. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
      5. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
      9. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
      13. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
      16. associate-*l*N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
      18. *-lowering-*.f6479.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
    3. Simplified79.5%

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, s\right)\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. Simplified76.2%

        \[\leadsto \frac{\color{blue}{1}}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)} \]
      2. Step-by-step derivation
        1. associate-*r*N/A

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

          \[\leadsto \frac{1}{x \cdot \left(x \cdot \left(\left(s \cdot c\right) \cdot \left(s \cdot \color{blue}{c}\right)\right)\right)} \]
        3. associate-*r*N/A

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

          \[\leadsto \frac{1}{x \cdot \left(\left(\left(x \cdot \left(s \cdot c\right)\right) \cdot s\right) \cdot \color{blue}{c}\right)} \]
        5. *-commutativeN/A

          \[\leadsto \frac{1}{x \cdot \left(\left(s \cdot \left(x \cdot \left(s \cdot c\right)\right)\right) \cdot c\right)} \]
        6. associate-*l*N/A

          \[\leadsto \frac{1}{\left(x \cdot \left(s \cdot \left(x \cdot \left(s \cdot c\right)\right)\right)\right) \cdot \color{blue}{c}} \]
        7. associate-/r*N/A

          \[\leadsto \frac{\frac{1}{x \cdot \left(s \cdot \left(x \cdot \left(s \cdot c\right)\right)\right)}}{\color{blue}{c}} \]
        8. associate-/l/N/A

          \[\leadsto \frac{\frac{\frac{1}{s \cdot \left(x \cdot \left(s \cdot c\right)\right)}}{x}}{c} \]
        9. associate-/l/N/A

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

          \[\leadsto \frac{\frac{1}{s \cdot \left(x \cdot \left(s \cdot c\right)\right)}}{x \cdot \color{blue}{c}} \]
        11. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{s \cdot \left(x \cdot \left(s \cdot c\right)\right)}\right), \color{blue}{\left(x \cdot c\right)}\right) \]
        12. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(s \cdot \left(x \cdot \left(s \cdot c\right)\right)\right)\right), \left(\color{blue}{x} \cdot c\right)\right) \]
        13. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(s, \left(x \cdot \left(s \cdot c\right)\right)\right)\right), \left(x \cdot c\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \left(s \cdot c\right)\right)\right)\right), \left(x \cdot c\right)\right) \]
        15. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right)\right), \left(x \cdot c\right)\right) \]
        16. *-lowering-*.f6479.9%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right)\right), \mathsf{*.f64}\left(x, \color{blue}{c}\right)\right) \]
      3. Applied egg-rr79.9%

        \[\leadsto \color{blue}{\frac{\frac{1}{s \cdot \left(x \cdot \left(s \cdot c\right)\right)}}{x \cdot c}} \]
    7. Recombined 3 regimes into one program.
    8. Add Preprocessing

    Alternative 3: 76.2% accurate, 2.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(s \cdot c\right)\\ \mathbf{if}\;x \leq 0.00041:\\ \;\;\;\;\frac{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\cos \left(2 \cdot x\right)}{s}}{x \cdot \left(c \cdot t\_0\right)}\\ \end{array} \end{array} \]
    (FPCore (x c s)
     :precision binary64
     (let* ((t_0 (* x (* s c))))
       (if (<= x 0.00041)
         (/ (/ (* (+ 1.0 (* (* x x) -2.0)) (/ (/ 1.0 c) s)) x) t_0)
         (/ (/ (cos (* 2.0 x)) s) (* x (* c t_0))))))
    double code(double x, double c, double s) {
    	double t_0 = x * (s * c);
    	double tmp;
    	if (x <= 0.00041) {
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0;
    	} else {
    		tmp = (cos((2.0 * x)) / s) / (x * (c * t_0));
    	}
    	return tmp;
    }
    
    real(8) function code(x, c, s)
        real(8), intent (in) :: x
        real(8), intent (in) :: c
        real(8), intent (in) :: s
        real(8) :: t_0
        real(8) :: tmp
        t_0 = x * (s * c)
        if (x <= 0.00041d0) then
            tmp = (((1.0d0 + ((x * x) * (-2.0d0))) * ((1.0d0 / c) / s)) / x) / t_0
        else
            tmp = (cos((2.0d0 * x)) / s) / (x * (c * t_0))
        end if
        code = tmp
    end function
    
    public static double code(double x, double c, double s) {
    	double t_0 = x * (s * c);
    	double tmp;
    	if (x <= 0.00041) {
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0;
    	} else {
    		tmp = (Math.cos((2.0 * x)) / s) / (x * (c * t_0));
    	}
    	return tmp;
    }
    
    def code(x, c, s):
    	t_0 = x * (s * c)
    	tmp = 0
    	if x <= 0.00041:
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0
    	else:
    		tmp = (math.cos((2.0 * x)) / s) / (x * (c * t_0))
    	return tmp
    
    function code(x, c, s)
    	t_0 = Float64(x * Float64(s * c))
    	tmp = 0.0
    	if (x <= 0.00041)
    		tmp = Float64(Float64(Float64(Float64(1.0 + Float64(Float64(x * x) * -2.0)) * Float64(Float64(1.0 / c) / s)) / x) / t_0);
    	else
    		tmp = Float64(Float64(cos(Float64(2.0 * x)) / s) / Float64(x * Float64(c * t_0)));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, c, s)
    	t_0 = x * (s * c);
    	tmp = 0.0;
    	if (x <= 0.00041)
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0;
    	else
    		tmp = (cos((2.0 * x)) / s) / (x * (c * t_0));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 0.00041], N[(N[(N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] / s), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / s), $MachinePrecision] / N[(x * N[(c * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := x \cdot \left(s \cdot c\right)\\
    \mathbf{if}\;x \leq 0.00041:\\
    \;\;\;\;\frac{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}{t\_0}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{\cos \left(2 \cdot x\right)}{s}}{x \cdot \left(c \cdot t\_0\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 4.0999999999999999e-4

      1. Initial program 62.6%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6481.4%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified81.4%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-/r*N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
        3. associate-*r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        4. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        5. associate-*l*N/A

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

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
        7. *-commutativeN/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
        8. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
        9. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        11. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        12. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        13. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
        19. *-lowering-*.f6498.2%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
      6. Applied egg-rr98.2%

        \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
      7. Taylor expanded in x around 0

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{x}^{2}}{c \cdot s} + \frac{1}{c \cdot s}\right), x\right), \mathsf{*.f64}\left(\color{blue}{x}, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
      9. Simplified67.9%

        \[\leadsto \frac{\color{blue}{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}}{x \cdot \left(s \cdot c\right)} \]

      if 4.0999999999999999e-4 < x

      1. Initial program 71.4%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6484.8%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified84.8%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-/r*N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
        3. associate-*r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        4. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        5. associate-*l*N/A

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

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
        7. *-commutativeN/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
        8. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
        9. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        11. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        12. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        13. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
        19. *-lowering-*.f6496.9%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
      6. Applied egg-rr96.9%

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

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{\left(x \cdot s\right) \cdot \color{blue}{c}} \]
        2. div-invN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x} \cdot \frac{1}{s \cdot c}}{\color{blue}{\left(x \cdot s\right)} \cdot c} \]
        3. times-fracN/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x} \cdot \frac{\frac{1}{s \cdot c}}{c}}{\color{blue}{x \cdot s}} \]
        5. associate-/r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x} \cdot \frac{\frac{\frac{1}{s}}{c}}{c}}{x \cdot s} \]
        6. associate-/l/N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x} \cdot \frac{\frac{1}{s}}{c \cdot c}}{x \cdot s} \]
        7. associate-/l*N/A

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

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot c\right)} \cdot \frac{1}{s}}{x \cdot s} \]
        10. associate-*l/N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right) \cdot \frac{1}{s}}{x \cdot \left(c \cdot c\right)}}{\color{blue}{x} \cdot s} \]
        11. div-invN/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{s}}{x \cdot \left(c \cdot c\right)}}{x \cdot s} \]
        12. associate-/l/N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{s}}{x \cdot \color{blue}{\left(s \cdot \left(x \cdot \left(c \cdot c\right)\right)\right)}} \]
      8. Applied egg-rr94.2%

        \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{s}}{x \cdot \left(c \cdot \left(x \cdot \left(s \cdot c\right)\right)\right)}} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 4: 76.1% accurate, 2.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(s \cdot c\right)\\ \mathbf{if}\;x \leq 0.00038:\\ \;\;\;\;\frac{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{s \cdot \left(x \cdot \left(c \cdot t\_0\right)\right)}\\ \end{array} \end{array} \]
    (FPCore (x c s)
     :precision binary64
     (let* ((t_0 (* x (* s c))))
       (if (<= x 0.00038)
         (/ (/ (* (+ 1.0 (* (* x x) -2.0)) (/ (/ 1.0 c) s)) x) t_0)
         (/ (cos (* 2.0 x)) (* s (* x (* c t_0)))))))
    double code(double x, double c, double s) {
    	double t_0 = x * (s * c);
    	double tmp;
    	if (x <= 0.00038) {
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0;
    	} else {
    		tmp = cos((2.0 * x)) / (s * (x * (c * t_0)));
    	}
    	return tmp;
    }
    
    real(8) function code(x, c, s)
        real(8), intent (in) :: x
        real(8), intent (in) :: c
        real(8), intent (in) :: s
        real(8) :: t_0
        real(8) :: tmp
        t_0 = x * (s * c)
        if (x <= 0.00038d0) then
            tmp = (((1.0d0 + ((x * x) * (-2.0d0))) * ((1.0d0 / c) / s)) / x) / t_0
        else
            tmp = cos((2.0d0 * x)) / (s * (x * (c * t_0)))
        end if
        code = tmp
    end function
    
    public static double code(double x, double c, double s) {
    	double t_0 = x * (s * c);
    	double tmp;
    	if (x <= 0.00038) {
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0;
    	} else {
    		tmp = Math.cos((2.0 * x)) / (s * (x * (c * t_0)));
    	}
    	return tmp;
    }
    
    def code(x, c, s):
    	t_0 = x * (s * c)
    	tmp = 0
    	if x <= 0.00038:
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0
    	else:
    		tmp = math.cos((2.0 * x)) / (s * (x * (c * t_0)))
    	return tmp
    
    function code(x, c, s)
    	t_0 = Float64(x * Float64(s * c))
    	tmp = 0.0
    	if (x <= 0.00038)
    		tmp = Float64(Float64(Float64(Float64(1.0 + Float64(Float64(x * x) * -2.0)) * Float64(Float64(1.0 / c) / s)) / x) / t_0);
    	else
    		tmp = Float64(cos(Float64(2.0 * x)) / Float64(s * Float64(x * Float64(c * t_0))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, c, s)
    	t_0 = x * (s * c);
    	tmp = 0.0;
    	if (x <= 0.00038)
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0;
    	else
    		tmp = cos((2.0 * x)) / (s * (x * (c * t_0)));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 0.00038], N[(N[(N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] / s), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(s * N[(x * N[(c * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := x \cdot \left(s \cdot c\right)\\
    \mathbf{if}\;x \leq 0.00038:\\
    \;\;\;\;\frac{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}{t\_0}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{s \cdot \left(x \cdot \left(c \cdot t\_0\right)\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 3.8000000000000002e-4

      1. Initial program 62.6%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6481.4%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified81.4%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-/r*N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
        3. associate-*r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        4. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        5. associate-*l*N/A

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

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
        7. *-commutativeN/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
        8. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
        9. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        11. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        12. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        13. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
        19. *-lowering-*.f6498.2%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
      6. Applied egg-rr98.2%

        \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
      7. Taylor expanded in x around 0

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{x}^{2}}{c \cdot s} + \frac{1}{c \cdot s}\right), x\right), \mathsf{*.f64}\left(\color{blue}{x}, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
      9. Simplified67.9%

        \[\leadsto \frac{\color{blue}{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}}{x \cdot \left(s \cdot c\right)} \]

      if 3.8000000000000002e-4 < x

      1. Initial program 71.4%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6484.8%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified84.8%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Taylor expanded in x around inf

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)\right)\right) \]
        4. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left(c \cdot c\right) \cdot \left(\color{blue}{{s}^{2}} \cdot {x}^{2}\right)\right)\right) \]
        5. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(c \cdot \color{blue}{\left(c \cdot \left({s}^{2} \cdot {x}^{2}\right)\right)}\right)\right) \]
        6. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(c, \color{blue}{\left(\left({s}^{2} \cdot {x}^{2}\right) \cdot c\right)}\right)\right) \]
        8. *-commutativeN/A

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(\left(s \cdot s\right) \cdot {\color{blue}{x}}^{2}\right)\right)\right)\right) \]
        11. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(s \cdot \color{blue}{\left(s \cdot {x}^{2}\right)}\right)\right)\right)\right) \]
        12. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \color{blue}{\left({x}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        14. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \color{blue}{\left({x}^{2}\right)}\right)\right)\right)\right)\right) \]
        16. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \left(x \cdot \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
        17. *-lowering-*.f6479.8%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
      7. Simplified79.8%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{c \cdot \left(c \cdot \left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right)\right)}} \]
      8. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left(c \cdot c\right) \cdot \color{blue}{\left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right)}\right)\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right) \cdot \color{blue}{\left(c \cdot c\right)}\right)\right) \]
        3. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(s \cdot \color{blue}{\left(\left(s \cdot \left(x \cdot x\right)\right) \cdot \left(c \cdot c\right)\right)}\right)\right) \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(s \cdot \left(\left(\left(x \cdot x\right) \cdot s\right) \cdot \left(\color{blue}{c} \cdot c\right)\right)\right)\right) \]
        5. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(s \cdot \left(\left(x \cdot \left(x \cdot s\right)\right) \cdot \left(\color{blue}{c} \cdot c\right)\right)\right)\right) \]
        6. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(s \cdot \left(x \cdot \color{blue}{\left(\left(x \cdot s\right) \cdot \left(c \cdot c\right)\right)}\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(s \cdot \left(x \cdot \left(\left(s \cdot x\right) \cdot \left(\color{blue}{c} \cdot c\right)\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(s \cdot \left(x \cdot \left(s \cdot \color{blue}{\left(x \cdot \left(c \cdot c\right)\right)}\right)\right)\right)\right) \]
        9. *-commutativeN/A

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \left(s \cdot \left(x \cdot \left(c \cdot c\right)\right)\right)\right), s\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \left(\left(s \cdot x\right) \cdot \left(c \cdot c\right)\right)\right), s\right)\right) \]
        13. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \left(\left(x \cdot s\right) \cdot \left(c \cdot c\right)\right)\right), s\right)\right) \]
        14. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \left(\left(\left(x \cdot s\right) \cdot c\right) \cdot c\right)\right), s\right)\right) \]
        15. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \left(\left(x \cdot \left(s \cdot c\right)\right) \cdot c\right)\right), s\right)\right) \]
        16. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \left(c \cdot \left(x \cdot \left(s \cdot c\right)\right)\right)\right), s\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, \left(x \cdot \left(s \cdot c\right)\right)\right)\right), s\right)\right) \]
        18. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(x, \left(s \cdot c\right)\right)\right)\right), s\right)\right) \]
        19. *-lowering-*.f6493.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right)\right), s\right)\right) \]
      9. Applied egg-rr93.1%

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(x \cdot \left(c \cdot \left(x \cdot \left(s \cdot c\right)\right)\right)\right) \cdot s}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification74.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.00038:\\ \;\;\;\;\frac{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}{x \cdot \left(s \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{s \cdot \left(x \cdot \left(c \cdot \left(x \cdot \left(s \cdot c\right)\right)\right)\right)}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 5: 76.7% accurate, 2.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.6 \cdot 10^{-47}:\\ \;\;\;\;\frac{\frac{1}{x \cdot s}}{\left(x \cdot s\right) \cdot \left(c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(x \cdot c\right) \cdot \left(s \cdot \left(s \cdot c\right)\right)\right)}\\ \end{array} \end{array} \]
    (FPCore (x c s)
     :precision binary64
     (if (<= x 4.6e-47)
       (/ (/ 1.0 (* x s)) (* (* x s) (* c c)))
       (/ (cos (* 2.0 x)) (* x (* (* x c) (* s (* s c)))))))
    double code(double x, double c, double s) {
    	double tmp;
    	if (x <= 4.6e-47) {
    		tmp = (1.0 / (x * s)) / ((x * s) * (c * c));
    	} else {
    		tmp = cos((2.0 * x)) / (x * ((x * c) * (s * (s * c))));
    	}
    	return tmp;
    }
    
    real(8) function code(x, c, s)
        real(8), intent (in) :: x
        real(8), intent (in) :: c
        real(8), intent (in) :: s
        real(8) :: tmp
        if (x <= 4.6d-47) then
            tmp = (1.0d0 / (x * s)) / ((x * s) * (c * c))
        else
            tmp = cos((2.0d0 * x)) / (x * ((x * c) * (s * (s * c))))
        end if
        code = tmp
    end function
    
    public static double code(double x, double c, double s) {
    	double tmp;
    	if (x <= 4.6e-47) {
    		tmp = (1.0 / (x * s)) / ((x * s) * (c * c));
    	} else {
    		tmp = Math.cos((2.0 * x)) / (x * ((x * c) * (s * (s * c))));
    	}
    	return tmp;
    }
    
    def code(x, c, s):
    	tmp = 0
    	if x <= 4.6e-47:
    		tmp = (1.0 / (x * s)) / ((x * s) * (c * c))
    	else:
    		tmp = math.cos((2.0 * x)) / (x * ((x * c) * (s * (s * c))))
    	return tmp
    
    function code(x, c, s)
    	tmp = 0.0
    	if (x <= 4.6e-47)
    		tmp = Float64(Float64(1.0 / Float64(x * s)) / Float64(Float64(x * s) * Float64(c * c)));
    	else
    		tmp = Float64(cos(Float64(2.0 * x)) / Float64(x * Float64(Float64(x * c) * Float64(s * Float64(s * c)))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, c, s)
    	tmp = 0.0;
    	if (x <= 4.6e-47)
    		tmp = (1.0 / (x * s)) / ((x * s) * (c * c));
    	else
    		tmp = cos((2.0 * x)) / (x * ((x * c) * (s * (s * c))));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, c_, s_] := If[LessEqual[x, 4.6e-47], N[(N[(1.0 / N[(x * s), $MachinePrecision]), $MachinePrecision] / N[(N[(x * s), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(x * N[(N[(x * c), $MachinePrecision] * N[(s * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 4.6 \cdot 10^{-47}:\\
    \;\;\;\;\frac{\frac{1}{x \cdot s}}{\left(x \cdot s\right) \cdot \left(c \cdot c\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(x \cdot c\right) \cdot \left(s \cdot \left(s \cdot c\right)\right)\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 4.59999999999999964e-47

      1. Initial program 62.5%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6480.9%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified80.9%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-/r*N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
        3. associate-*r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        4. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        5. associate-*l*N/A

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

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
        7. *-commutativeN/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
        8. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
        9. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        11. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        12. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        13. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
        19. *-lowering-*.f6498.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
      6. Applied egg-rr98.1%

        \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
      7. Taylor expanded in x around 0

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

          \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left({c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)\right)}\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(1, \left(\left(c \cdot c\right) \cdot \left(\color{blue}{{s}^{2}} \cdot {x}^{2}\right)\right)\right) \]
        3. associate-*l*N/A

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

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

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{\left({s}^{2} \cdot {x}^{2}\right)}\right)\right)\right) \]
        6. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(\left(s \cdot s\right) \cdot {\color{blue}{x}}^{2}\right)\right)\right)\right) \]
        7. associate-*l*N/A

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

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

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

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \left(x \cdot \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f6466.1%

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
      9. Simplified66.1%

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

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

          \[\leadsto \frac{1}{\left(\left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right) \cdot c\right) \cdot c} \]
        3. associate-*l*N/A

          \[\leadsto \frac{1}{\left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right) \cdot \color{blue}{\left(c \cdot c\right)}} \]
        4. *-commutativeN/A

          \[\leadsto \frac{1}{\left(s \cdot \left(\left(x \cdot x\right) \cdot s\right)\right) \cdot \left(c \cdot c\right)} \]
        5. associate-*r*N/A

          \[\leadsto \frac{1}{\left(s \cdot \left(x \cdot \left(x \cdot s\right)\right)\right) \cdot \left(c \cdot c\right)} \]
        6. *-commutativeN/A

          \[\leadsto \frac{1}{\left(\left(x \cdot \left(x \cdot s\right)\right) \cdot s\right) \cdot \left(\color{blue}{c} \cdot c\right)} \]
        7. associate-*r*N/A

          \[\leadsto \frac{1}{\left(x \cdot \left(x \cdot s\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot c\right)\right)}} \]
        8. associate-/l/N/A

          \[\leadsto \frac{\frac{1}{s \cdot \left(c \cdot c\right)}}{\color{blue}{x \cdot \left(x \cdot s\right)}} \]
        9. div-invN/A

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

          \[\leadsto \frac{\frac{1}{s}}{c \cdot c} \cdot \frac{\color{blue}{1}}{x \cdot \left(x \cdot s\right)} \]
        11. associate-/r*N/A

          \[\leadsto \frac{\frac{1}{s}}{c \cdot c} \cdot \frac{\frac{1}{x}}{\color{blue}{x \cdot s}} \]
        12. frac-timesN/A

          \[\leadsto \frac{\frac{1}{s} \cdot \frac{1}{x}}{\color{blue}{\left(c \cdot c\right) \cdot \left(x \cdot s\right)}} \]
        13. div-invN/A

          \[\leadsto \frac{\frac{\frac{1}{s}}{x}}{\color{blue}{\left(c \cdot c\right)} \cdot \left(x \cdot s\right)} \]
        14. associate-/l/N/A

          \[\leadsto \frac{\frac{1}{x \cdot s}}{\color{blue}{\left(c \cdot c\right)} \cdot \left(x \cdot s\right)} \]
        15. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{x \cdot s}\right), \color{blue}{\left(\left(c \cdot c\right) \cdot \left(x \cdot s\right)\right)}\right) \]
        16. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(x \cdot s\right)\right), \left(\color{blue}{\left(c \cdot c\right)} \cdot \left(x \cdot s\right)\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, s\right)\right), \left(\left(c \cdot \color{blue}{c}\right) \cdot \left(x \cdot s\right)\right)\right) \]
        18. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, s\right)\right), \mathsf{*.f64}\left(\left(c \cdot c\right), \color{blue}{\left(x \cdot s\right)}\right)\right) \]
        19. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, s\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(c, c\right), \left(\color{blue}{x} \cdot s\right)\right)\right) \]
        20. *-lowering-*.f6470.8%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, s\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(c, c\right), \mathsf{*.f64}\left(x, \color{blue}{s}\right)\right)\right) \]
      11. Applied egg-rr70.8%

        \[\leadsto \color{blue}{\frac{\frac{1}{x \cdot s}}{\left(c \cdot c\right) \cdot \left(x \cdot s\right)}} \]

      if 4.59999999999999964e-47 < x

      1. Initial program 71.1%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6485.9%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified85.9%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(x \cdot \left(\left(s \cdot c\right) \cdot \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(x \cdot \left(\left(c \cdot s\right) \cdot \left(\color{blue}{c} \cdot s\right)\right)\right)\right)\right) \]
        3. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(x \cdot \left(c \cdot \color{blue}{\left(s \cdot \left(c \cdot s\right)\right)}\right)\right)\right)\right) \]
        4. associate-*r*N/A

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, c\right), \mathsf{*.f64}\left(s, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, c\right), \mathsf{*.f64}\left(s, \left(s \cdot \color{blue}{c}\right)\right)\right)\right)\right) \]
        9. *-lowering-*.f6488.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, c\right), \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right)\right)\right) \]
      6. Applied egg-rr88.1%

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{x \cdot \color{blue}{\left(\left(x \cdot c\right) \cdot \left(s \cdot \left(s \cdot c\right)\right)\right)}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification75.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4.6 \cdot 10^{-47}:\\ \;\;\;\;\frac{\frac{1}{x \cdot s}}{\left(x \cdot s\right) \cdot \left(c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(x \cdot c\right) \cdot \left(s \cdot \left(s \cdot c\right)\right)\right)}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 6: 78.0% accurate, 2.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 7.5 \cdot 10^{-48}:\\ \;\;\;\;\frac{\frac{1}{x \cdot s}}{\left(x \cdot s\right) \cdot \left(c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot \left(s \cdot \left(x \cdot \left(s \cdot c\right)\right)\right)\right)}\\ \end{array} \end{array} \]
    (FPCore (x c s)
     :precision binary64
     (if (<= x 7.5e-48)
       (/ (/ 1.0 (* x s)) (* (* x s) (* c c)))
       (/ (cos (* 2.0 x)) (* x (* c (* s (* x (* s c))))))))
    double code(double x, double c, double s) {
    	double tmp;
    	if (x <= 7.5e-48) {
    		tmp = (1.0 / (x * s)) / ((x * s) * (c * c));
    	} else {
    		tmp = cos((2.0 * x)) / (x * (c * (s * (x * (s * c)))));
    	}
    	return tmp;
    }
    
    real(8) function code(x, c, s)
        real(8), intent (in) :: x
        real(8), intent (in) :: c
        real(8), intent (in) :: s
        real(8) :: tmp
        if (x <= 7.5d-48) then
            tmp = (1.0d0 / (x * s)) / ((x * s) * (c * c))
        else
            tmp = cos((2.0d0 * x)) / (x * (c * (s * (x * (s * c)))))
        end if
        code = tmp
    end function
    
    public static double code(double x, double c, double s) {
    	double tmp;
    	if (x <= 7.5e-48) {
    		tmp = (1.0 / (x * s)) / ((x * s) * (c * c));
    	} else {
    		tmp = Math.cos((2.0 * x)) / (x * (c * (s * (x * (s * c)))));
    	}
    	return tmp;
    }
    
    def code(x, c, s):
    	tmp = 0
    	if x <= 7.5e-48:
    		tmp = (1.0 / (x * s)) / ((x * s) * (c * c))
    	else:
    		tmp = math.cos((2.0 * x)) / (x * (c * (s * (x * (s * c)))))
    	return tmp
    
    function code(x, c, s)
    	tmp = 0.0
    	if (x <= 7.5e-48)
    		tmp = Float64(Float64(1.0 / Float64(x * s)) / Float64(Float64(x * s) * Float64(c * c)));
    	else
    		tmp = Float64(cos(Float64(2.0 * x)) / Float64(x * Float64(c * Float64(s * Float64(x * Float64(s * c))))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, c, s)
    	tmp = 0.0;
    	if (x <= 7.5e-48)
    		tmp = (1.0 / (x * s)) / ((x * s) * (c * c));
    	else
    		tmp = cos((2.0 * x)) / (x * (c * (s * (x * (s * c)))));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, c_, s_] := If[LessEqual[x, 7.5e-48], N[(N[(1.0 / N[(x * s), $MachinePrecision]), $MachinePrecision] / N[(N[(x * s), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(x * N[(c * N[(s * N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 7.5 \cdot 10^{-48}:\\
    \;\;\;\;\frac{\frac{1}{x \cdot s}}{\left(x \cdot s\right) \cdot \left(c \cdot c\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot \left(s \cdot \left(x \cdot \left(s \cdot c\right)\right)\right)\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 7.50000000000000042e-48

      1. Initial program 62.5%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6480.9%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified80.9%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-/r*N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
        3. associate-*r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        4. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        5. associate-*l*N/A

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

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
        7. *-commutativeN/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
        8. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
        9. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        11. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        12. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        13. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
        19. *-lowering-*.f6498.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
      6. Applied egg-rr98.1%

        \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
      7. Taylor expanded in x around 0

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

          \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left({c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)\right)}\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(1, \left(\left(c \cdot c\right) \cdot \left(\color{blue}{{s}^{2}} \cdot {x}^{2}\right)\right)\right) \]
        3. associate-*l*N/A

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

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

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{\left({s}^{2} \cdot {x}^{2}\right)}\right)\right)\right) \]
        6. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(\left(s \cdot s\right) \cdot {\color{blue}{x}}^{2}\right)\right)\right)\right) \]
        7. associate-*l*N/A

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

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

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

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \left(x \cdot \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f6466.1%

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
      9. Simplified66.1%

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

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

          \[\leadsto \frac{1}{\left(\left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right) \cdot c\right) \cdot c} \]
        3. associate-*l*N/A

          \[\leadsto \frac{1}{\left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right) \cdot \color{blue}{\left(c \cdot c\right)}} \]
        4. *-commutativeN/A

          \[\leadsto \frac{1}{\left(s \cdot \left(\left(x \cdot x\right) \cdot s\right)\right) \cdot \left(c \cdot c\right)} \]
        5. associate-*r*N/A

          \[\leadsto \frac{1}{\left(s \cdot \left(x \cdot \left(x \cdot s\right)\right)\right) \cdot \left(c \cdot c\right)} \]
        6. *-commutativeN/A

          \[\leadsto \frac{1}{\left(\left(x \cdot \left(x \cdot s\right)\right) \cdot s\right) \cdot \left(\color{blue}{c} \cdot c\right)} \]
        7. associate-*r*N/A

          \[\leadsto \frac{1}{\left(x \cdot \left(x \cdot s\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot c\right)\right)}} \]
        8. associate-/l/N/A

          \[\leadsto \frac{\frac{1}{s \cdot \left(c \cdot c\right)}}{\color{blue}{x \cdot \left(x \cdot s\right)}} \]
        9. div-invN/A

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

          \[\leadsto \frac{\frac{1}{s}}{c \cdot c} \cdot \frac{\color{blue}{1}}{x \cdot \left(x \cdot s\right)} \]
        11. associate-/r*N/A

          \[\leadsto \frac{\frac{1}{s}}{c \cdot c} \cdot \frac{\frac{1}{x}}{\color{blue}{x \cdot s}} \]
        12. frac-timesN/A

          \[\leadsto \frac{\frac{1}{s} \cdot \frac{1}{x}}{\color{blue}{\left(c \cdot c\right) \cdot \left(x \cdot s\right)}} \]
        13. div-invN/A

          \[\leadsto \frac{\frac{\frac{1}{s}}{x}}{\color{blue}{\left(c \cdot c\right)} \cdot \left(x \cdot s\right)} \]
        14. associate-/l/N/A

          \[\leadsto \frac{\frac{1}{x \cdot s}}{\color{blue}{\left(c \cdot c\right)} \cdot \left(x \cdot s\right)} \]
        15. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{x \cdot s}\right), \color{blue}{\left(\left(c \cdot c\right) \cdot \left(x \cdot s\right)\right)}\right) \]
        16. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(x \cdot s\right)\right), \left(\color{blue}{\left(c \cdot c\right)} \cdot \left(x \cdot s\right)\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, s\right)\right), \left(\left(c \cdot \color{blue}{c}\right) \cdot \left(x \cdot s\right)\right)\right) \]
        18. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, s\right)\right), \mathsf{*.f64}\left(\left(c \cdot c\right), \color{blue}{\left(x \cdot s\right)}\right)\right) \]
        19. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, s\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(c, c\right), \left(\color{blue}{x} \cdot s\right)\right)\right) \]
        20. *-lowering-*.f6470.8%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, s\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(c, c\right), \mathsf{*.f64}\left(x, \color{blue}{s}\right)\right)\right) \]
      11. Applied egg-rr70.8%

        \[\leadsto \color{blue}{\frac{\frac{1}{x \cdot s}}{\left(c \cdot c\right) \cdot \left(x \cdot s\right)}} \]

      if 7.50000000000000042e-48 < x

      1. Initial program 71.1%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6485.9%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified85.9%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left(x \cdot s\right) \cdot \color{blue}{\left(c \cdot \left(c \cdot s\right)\right)}\right)\right)\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left(x \cdot s\right) \cdot \left(\left(c \cdot s\right) \cdot \color{blue}{c}\right)\right)\right)\right) \]
        3. associate-*r*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\left(\left(x \cdot s\right) \cdot \left(c \cdot s\right)\right), \color{blue}{c}\right)\right)\right) \]
        5. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\left(\left(s \cdot x\right) \cdot \left(c \cdot s\right)\right), c\right)\right)\right) \]
        6. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\left(s \cdot \left(x \cdot \left(c \cdot s\right)\right)\right), c\right)\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\mathsf{*.f64}\left(s, \left(x \cdot \left(c \cdot s\right)\right)\right), c\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \left(c \cdot s\right)\right)\right), c\right)\right)\right) \]
        9. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \left(s \cdot c\right)\right)\right), c\right)\right)\right) \]
        10. *-lowering-*.f6492.8%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right), c\right)\right)\right) \]
      6. Applied egg-rr92.8%

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{x \cdot \color{blue}{\left(\left(s \cdot \left(x \cdot \left(s \cdot c\right)\right)\right) \cdot c\right)}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification77.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 7.5 \cdot 10^{-48}:\\ \;\;\;\;\frac{\frac{1}{x \cdot s}}{\left(x \cdot s\right) \cdot \left(c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot \left(s \cdot \left(x \cdot \left(s \cdot c\right)\right)\right)\right)}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 7: 74.4% accurate, 2.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 7 \cdot 10^{-5}:\\ \;\;\;\;\frac{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}{x \cdot \left(s \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(s \cdot c\right)\right)\right)\right)}\\ \end{array} \end{array} \]
    (FPCore (x c s)
     :precision binary64
     (if (<= x 7e-5)
       (/ (/ (* (+ 1.0 (* (* x x) -2.0)) (/ (/ 1.0 c) s)) x) (* x (* s c)))
       (/ (cos (* 2.0 x)) (* x (* x (* s (* c (* s c))))))))
    double code(double x, double c, double s) {
    	double tmp;
    	if (x <= 7e-5) {
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / (x * (s * c));
    	} else {
    		tmp = cos((2.0 * x)) / (x * (x * (s * (c * (s * c)))));
    	}
    	return tmp;
    }
    
    real(8) function code(x, c, s)
        real(8), intent (in) :: x
        real(8), intent (in) :: c
        real(8), intent (in) :: s
        real(8) :: tmp
        if (x <= 7d-5) then
            tmp = (((1.0d0 + ((x * x) * (-2.0d0))) * ((1.0d0 / c) / s)) / x) / (x * (s * c))
        else
            tmp = cos((2.0d0 * x)) / (x * (x * (s * (c * (s * c)))))
        end if
        code = tmp
    end function
    
    public static double code(double x, double c, double s) {
    	double tmp;
    	if (x <= 7e-5) {
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / (x * (s * c));
    	} else {
    		tmp = Math.cos((2.0 * x)) / (x * (x * (s * (c * (s * c)))));
    	}
    	return tmp;
    }
    
    def code(x, c, s):
    	tmp = 0
    	if x <= 7e-5:
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / (x * (s * c))
    	else:
    		tmp = math.cos((2.0 * x)) / (x * (x * (s * (c * (s * c)))))
    	return tmp
    
    function code(x, c, s)
    	tmp = 0.0
    	if (x <= 7e-5)
    		tmp = Float64(Float64(Float64(Float64(1.0 + Float64(Float64(x * x) * -2.0)) * Float64(Float64(1.0 / c) / s)) / x) / Float64(x * Float64(s * c)));
    	else
    		tmp = Float64(cos(Float64(2.0 * x)) / Float64(x * Float64(x * Float64(s * Float64(c * Float64(s * c))))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, c, s)
    	tmp = 0.0;
    	if (x <= 7e-5)
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / (x * (s * c));
    	else
    		tmp = cos((2.0 * x)) / (x * (x * (s * (c * (s * c)))));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, c_, s_] := If[LessEqual[x, 7e-5], N[(N[(N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] / s), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(x * N[(x * N[(s * N[(c * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 7 \cdot 10^{-5}:\\
    \;\;\;\;\frac{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}{x \cdot \left(s \cdot c\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(s \cdot c\right)\right)\right)\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 6.9999999999999994e-5

      1. Initial program 62.6%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6481.4%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified81.4%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-/r*N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
        3. associate-*r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        4. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        5. associate-*l*N/A

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

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
        7. *-commutativeN/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
        8. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
        9. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        11. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        12. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        13. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
        19. *-lowering-*.f6498.2%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
      6. Applied egg-rr98.2%

        \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
      7. Taylor expanded in x around 0

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{x}^{2}}{c \cdot s} + \frac{1}{c \cdot s}\right), x\right), \mathsf{*.f64}\left(\color{blue}{x}, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
      9. Simplified67.9%

        \[\leadsto \frac{\color{blue}{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}}{x \cdot \left(s \cdot c\right)} \]

      if 6.9999999999999994e-5 < x

      1. Initial program 71.4%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6484.8%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified84.8%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
    3. Recombined 2 regimes into one program.
    4. Final simplification72.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 7 \cdot 10^{-5}:\\ \;\;\;\;\frac{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}{x \cdot \left(s \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(s \cdot c\right)\right)\right)\right)}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 8: 97.3% accurate, 2.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(s \cdot c\right)\\ \frac{\frac{\cos \left(2 \cdot x\right)}{t\_0}}{t\_0} \end{array} \end{array} \]
    (FPCore (x c s)
     :precision binary64
     (let* ((t_0 (* x (* s c)))) (/ (/ (cos (* 2.0 x)) t_0) t_0)))
    double code(double x, double c, double s) {
    	double t_0 = x * (s * c);
    	return (cos((2.0 * x)) / t_0) / t_0;
    }
    
    real(8) function code(x, c, s)
        real(8), intent (in) :: x
        real(8), intent (in) :: c
        real(8), intent (in) :: s
        real(8) :: t_0
        t_0 = x * (s * c)
        code = (cos((2.0d0 * x)) / t_0) / t_0
    end function
    
    public static double code(double x, double c, double s) {
    	double t_0 = x * (s * c);
    	return (Math.cos((2.0 * x)) / t_0) / t_0;
    }
    
    def code(x, c, s):
    	t_0 = x * (s * c)
    	return (math.cos((2.0 * x)) / t_0) / t_0
    
    function code(x, c, s)
    	t_0 = Float64(x * Float64(s * c))
    	return Float64(Float64(cos(Float64(2.0 * x)) / t_0) / t_0)
    end
    
    function tmp = code(x, c, s)
    	t_0 = x * (s * c);
    	tmp = (cos((2.0 * x)) / t_0) / t_0;
    end
    
    code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := x \cdot \left(s \cdot c\right)\\
    \frac{\frac{\cos \left(2 \cdot x\right)}{t\_0}}{t\_0}
    \end{array}
    \end{array}
    
    Derivation
    1. Initial program 65.0%

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
      4. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
      5. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
      9. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
      13. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
      16. associate-*l*N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
      18. *-lowering-*.f6482.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
    3. Simplified82.3%

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(x \cdot x\right) \cdot \left(\left(s \cdot c\right) \cdot \color{blue}{\left(c \cdot s\right)}\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(x \cdot x\right) \cdot \left(\left(c \cdot s\right) \cdot \left(\color{blue}{c} \cdot s\right)\right)} \]
      4. unswap-sqrN/A

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

        \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot s\right)}}{\color{blue}{x \cdot \left(c \cdot s\right)}} \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot s\right)}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), \left(x \cdot \left(c \cdot s\right)\right)\right), \left(\color{blue}{x} \cdot \left(c \cdot s\right)\right)\right) \]
      8. count-2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), \left(x \cdot \left(c \cdot s\right)\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
      10. count-2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(c \cdot s\right)\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot c\right)\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
      17. *-lowering-*.f6497.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
    6. Applied egg-rr97.8%

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

    Alternative 9: 68.0% accurate, 12.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(s \cdot c\right)\\ \mathbf{if}\;x \leq 1.85 \cdot 10^{+77}:\\ \;\;\;\;\frac{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{s \cdot \left(x \cdot c\right)}}{t\_0}\\ \end{array} \end{array} \]
    (FPCore (x c s)
     :precision binary64
     (let* ((t_0 (* x (* s c))))
       (if (<= x 1.85e+77)
         (/ (/ (* (+ 1.0 (* (* x x) -2.0)) (/ (/ 1.0 c) s)) x) t_0)
         (/ (/ 1.0 (* s (* x c))) t_0))))
    double code(double x, double c, double s) {
    	double t_0 = x * (s * c);
    	double tmp;
    	if (x <= 1.85e+77) {
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0;
    	} else {
    		tmp = (1.0 / (s * (x * c))) / t_0;
    	}
    	return tmp;
    }
    
    real(8) function code(x, c, s)
        real(8), intent (in) :: x
        real(8), intent (in) :: c
        real(8), intent (in) :: s
        real(8) :: t_0
        real(8) :: tmp
        t_0 = x * (s * c)
        if (x <= 1.85d+77) then
            tmp = (((1.0d0 + ((x * x) * (-2.0d0))) * ((1.0d0 / c) / s)) / x) / t_0
        else
            tmp = (1.0d0 / (s * (x * c))) / t_0
        end if
        code = tmp
    end function
    
    public static double code(double x, double c, double s) {
    	double t_0 = x * (s * c);
    	double tmp;
    	if (x <= 1.85e+77) {
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0;
    	} else {
    		tmp = (1.0 / (s * (x * c))) / t_0;
    	}
    	return tmp;
    }
    
    def code(x, c, s):
    	t_0 = x * (s * c)
    	tmp = 0
    	if x <= 1.85e+77:
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0
    	else:
    		tmp = (1.0 / (s * (x * c))) / t_0
    	return tmp
    
    function code(x, c, s)
    	t_0 = Float64(x * Float64(s * c))
    	tmp = 0.0
    	if (x <= 1.85e+77)
    		tmp = Float64(Float64(Float64(Float64(1.0 + Float64(Float64(x * x) * -2.0)) * Float64(Float64(1.0 / c) / s)) / x) / t_0);
    	else
    		tmp = Float64(Float64(1.0 / Float64(s * Float64(x * c))) / t_0);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, c, s)
    	t_0 = x * (s * c);
    	tmp = 0.0;
    	if (x <= 1.85e+77)
    		tmp = (((1.0 + ((x * x) * -2.0)) * ((1.0 / c) / s)) / x) / t_0;
    	else
    		tmp = (1.0 / (s * (x * c))) / t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.85e+77], N[(N[(N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] / s), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(1.0 / N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := x \cdot \left(s \cdot c\right)\\
    \mathbf{if}\;x \leq 1.85 \cdot 10^{+77}:\\
    \;\;\;\;\frac{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}{t\_0}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{1}{s \cdot \left(x \cdot c\right)}}{t\_0}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 1.84999999999999997e77

      1. Initial program 64.9%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6482.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified82.1%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-/r*N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
        3. associate-*r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        4. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        5. associate-*l*N/A

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

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
        7. *-commutativeN/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
        8. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
        9. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        11. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        12. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        13. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
        19. *-lowering-*.f6498.3%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
      6. Applied egg-rr98.3%

        \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
      7. Taylor expanded in x around 0

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{x}^{2}}{c \cdot s} + \frac{1}{c \cdot s}\right), x\right), \mathsf{*.f64}\left(\color{blue}{x}, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
      9. Simplified67.9%

        \[\leadsto \frac{\color{blue}{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}}{x \cdot \left(s \cdot c\right)} \]

      if 1.84999999999999997e77 < x

      1. Initial program 65.1%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6483.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified83.1%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-/r*N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
        3. associate-*r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        4. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        5. associate-*l*N/A

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

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
        7. *-commutativeN/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
        8. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
        9. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        11. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        12. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        13. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
        19. *-lowering-*.f6496.0%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
      6. Applied egg-rr96.0%

        \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
      7. Taylor expanded in x around 0

        \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{1}{c \cdot \left(s \cdot x\right)}\right)}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
      8. Step-by-step derivation
        1. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\left(c \cdot s\right) \cdot x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
        3. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\left(s \cdot c\right) \cdot x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
        4. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(s \cdot \left(c \cdot x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(s, \left(c \cdot x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
        6. *-lowering-*.f6475.8%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
      9. Simplified75.8%

        \[\leadsto \frac{\color{blue}{\frac{1}{s \cdot \left(c \cdot x\right)}}}{x \cdot \left(s \cdot c\right)} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification69.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.85 \cdot 10^{+77}:\\ \;\;\;\;\frac{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{\frac{1}{c}}{s}}{x}}{x \cdot \left(s \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{s \cdot \left(x \cdot c\right)}}{x \cdot \left(s \cdot c\right)}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 10: 60.9% accurate, 12.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1.2 \cdot 10^{+76}:\\ \;\;\;\;\frac{\frac{1}{\frac{x \cdot s}{\frac{1 + \left(x \cdot x\right) \cdot -2}{c \cdot c}}}}{x \cdot s}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{s \cdot \left(x \cdot c\right)}}{x \cdot \left(s \cdot c\right)}\\ \end{array} \end{array} \]
    (FPCore (x c s)
     :precision binary64
     (if (<= x 1.2e+76)
       (/ (/ 1.0 (/ (* x s) (/ (+ 1.0 (* (* x x) -2.0)) (* c c)))) (* x s))
       (/ (/ 1.0 (* s (* x c))) (* x (* s c)))))
    double code(double x, double c, double s) {
    	double tmp;
    	if (x <= 1.2e+76) {
    		tmp = (1.0 / ((x * s) / ((1.0 + ((x * x) * -2.0)) / (c * c)))) / (x * s);
    	} else {
    		tmp = (1.0 / (s * (x * c))) / (x * (s * c));
    	}
    	return tmp;
    }
    
    real(8) function code(x, c, s)
        real(8), intent (in) :: x
        real(8), intent (in) :: c
        real(8), intent (in) :: s
        real(8) :: tmp
        if (x <= 1.2d+76) then
            tmp = (1.0d0 / ((x * s) / ((1.0d0 + ((x * x) * (-2.0d0))) / (c * c)))) / (x * s)
        else
            tmp = (1.0d0 / (s * (x * c))) / (x * (s * c))
        end if
        code = tmp
    end function
    
    public static double code(double x, double c, double s) {
    	double tmp;
    	if (x <= 1.2e+76) {
    		tmp = (1.0 / ((x * s) / ((1.0 + ((x * x) * -2.0)) / (c * c)))) / (x * s);
    	} else {
    		tmp = (1.0 / (s * (x * c))) / (x * (s * c));
    	}
    	return tmp;
    }
    
    def code(x, c, s):
    	tmp = 0
    	if x <= 1.2e+76:
    		tmp = (1.0 / ((x * s) / ((1.0 + ((x * x) * -2.0)) / (c * c)))) / (x * s)
    	else:
    		tmp = (1.0 / (s * (x * c))) / (x * (s * c))
    	return tmp
    
    function code(x, c, s)
    	tmp = 0.0
    	if (x <= 1.2e+76)
    		tmp = Float64(Float64(1.0 / Float64(Float64(x * s) / Float64(Float64(1.0 + Float64(Float64(x * x) * -2.0)) / Float64(c * c)))) / Float64(x * s));
    	else
    		tmp = Float64(Float64(1.0 / Float64(s * Float64(x * c))) / Float64(x * Float64(s * c)));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, c, s)
    	tmp = 0.0;
    	if (x <= 1.2e+76)
    		tmp = (1.0 / ((x * s) / ((1.0 + ((x * x) * -2.0)) / (c * c)))) / (x * s);
    	else
    		tmp = (1.0 / (s * (x * c))) / (x * (s * c));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, c_, s_] := If[LessEqual[x, 1.2e+76], N[(N[(1.0 / N[(N[(x * s), $MachinePrecision] / N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 1.2 \cdot 10^{+76}:\\
    \;\;\;\;\frac{\frac{1}{\frac{x \cdot s}{\frac{1 + \left(x \cdot x\right) \cdot -2}{c \cdot c}}}}{x \cdot s}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{1}{s \cdot \left(x \cdot c\right)}}{x \cdot \left(s \cdot c\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 1.2e76

      1. Initial program 64.9%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6482.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified82.1%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-/l/N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right)}}{x} \]
        3. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right)}}{x} \]
        4. swap-sqrN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot s\right) \cdot \left(c \cdot c\right)\right)}}{x} \]
        5. unpow2N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot \left(c \cdot c\right)\right)}}{x} \]
        6. unpow2N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot {c}^{2}\right)}}{x} \]
        7. associate-*r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot {c}^{2}}}{x} \]
        8. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot {s}^{2}\right)}}{x} \]
        9. associate-/r*N/A

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

          \[\leadsto \frac{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{{s}^{2}}}{x} \]
        11. associate-/r*N/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\color{blue}{{s}^{2} \cdot x}} \]
        12. unpow2N/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\left(s \cdot s\right) \cdot x} \]
        13. associate-*l*N/A

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{s}\right), \color{blue}{\left(x \cdot s\right)}\right) \]
      6. Applied egg-rr77.3%

        \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot c\right)}}{s}}{x \cdot s}} \]
      7. Taylor expanded in x around 0

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{x}^{2}}{{c}^{2} \cdot s} + \frac{1}{{c}^{2} \cdot s}\right), x\right), \mathsf{*.f64}\left(\color{blue}{x}, s\right)\right) \]
      9. Simplified55.7%

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

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{\left(c \cdot c\right) \cdot s} \cdot \left(1 + \left(x \cdot x\right) \cdot -2\right)}{x}\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        2. associate-/l/N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{1}{s}}{c \cdot c} \cdot \left(1 + \left(x \cdot x\right) \cdot -2\right)}{x}\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        3. associate-*l/N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{1}{s} \cdot \left(1 + \left(x \cdot x\right) \cdot -2\right)}{c \cdot c}}{x}\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        4. associate-/l/N/A

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{s}\right), \left(1 + \left(x \cdot x\right) \cdot -2\right)\right), \left(x \cdot \left(c \cdot c\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, s\right), \left(1 + \left(x \cdot x\right) \cdot -2\right)\right), \left(x \cdot \left(c \cdot c\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        8. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, s\right), \mathsf{+.f64}\left(1, \left(\left(x \cdot x\right) \cdot -2\right)\right)\right), \left(x \cdot \left(c \cdot c\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        9. *-lowering-*.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, s\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), -2\right)\right)\right), \left(x \cdot \left(c \cdot c\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        11. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, s\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), -2\right)\right)\right), \mathsf{*.f64}\left(x, \left(c \cdot c\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        12. *-lowering-*.f6455.4%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, s\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), -2\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, c\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
      11. Applied egg-rr55.4%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{s} \cdot \left(1 + \left(x \cdot x\right) \cdot -2\right)}{x \cdot \left(c \cdot c\right)}}}{x \cdot s} \]
      12. Step-by-step derivation
        1. times-fracN/A

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

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

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{1 + \left(x \cdot x\right) \cdot -2}{c \cdot c} \cdot \frac{1}{x \cdot s}\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        4. div-invN/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1 + \left(x \cdot x\right) \cdot -2}{c \cdot c}}{x \cdot s}\right), \mathsf{*.f64}\left(\color{blue}{x}, s\right)\right) \]
        5. clear-numN/A

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(x \cdot s\right), \left(\frac{1 + \left(x \cdot x\right) \cdot -2}{c \cdot c}\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, s\right), \left(\frac{1 + \left(x \cdot x\right) \cdot -2}{c \cdot c}\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        9. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, s\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\left(x \cdot x\right) \cdot -2\right)\right), \left(c \cdot c\right)\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, s\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(-2 \cdot \left(x \cdot x\right)\right)\right), \left(c \cdot c\right)\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        12. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, s\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(-2, \left(x \cdot x\right)\right)\right), \left(c \cdot c\right)\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        13. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, s\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(-2, \mathsf{*.f64}\left(x, x\right)\right)\right), \left(c \cdot c\right)\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        14. *-lowering-*.f6457.5%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, s\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(-2, \mathsf{*.f64}\left(x, x\right)\right)\right), \mathsf{*.f64}\left(c, c\right)\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
      13. Applied egg-rr57.5%

        \[\leadsto \frac{\color{blue}{\frac{1}{\frac{x \cdot s}{\frac{1 + -2 \cdot \left(x \cdot x\right)}{c \cdot c}}}}}{x \cdot s} \]

      if 1.2e76 < x

      1. Initial program 65.1%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6483.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified83.1%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-/r*N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
        3. associate-*r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        4. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        5. associate-*l*N/A

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

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
        7. *-commutativeN/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
        8. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
        9. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        11. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        12. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        13. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
        19. *-lowering-*.f6496.0%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
      6. Applied egg-rr96.0%

        \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
      7. Taylor expanded in x around 0

        \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{1}{c \cdot \left(s \cdot x\right)}\right)}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
      8. Step-by-step derivation
        1. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\left(c \cdot s\right) \cdot x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
        3. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\left(s \cdot c\right) \cdot x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
        4. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(s \cdot \left(c \cdot x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(s, \left(c \cdot x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
        6. *-lowering-*.f6475.8%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
      9. Simplified75.8%

        \[\leadsto \frac{\color{blue}{\frac{1}{s \cdot \left(c \cdot x\right)}}}{x \cdot \left(s \cdot c\right)} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification61.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.2 \cdot 10^{+76}:\\ \;\;\;\;\frac{\frac{1}{\frac{x \cdot s}{\frac{1 + \left(x \cdot x\right) \cdot -2}{c \cdot c}}}}{x \cdot s}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{s \cdot \left(x \cdot c\right)}}{x \cdot \left(s \cdot c\right)}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 11: 60.9% accurate, 12.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1.2 \cdot 10^{+76}:\\ \;\;\;\;\frac{\frac{1}{x \cdot s} \cdot \frac{1 + \left(x \cdot x\right) \cdot -2}{c \cdot c}}{x \cdot s}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{s \cdot \left(x \cdot c\right)}}{x \cdot \left(s \cdot c\right)}\\ \end{array} \end{array} \]
    (FPCore (x c s)
     :precision binary64
     (if (<= x 1.2e+76)
       (/ (* (/ 1.0 (* x s)) (/ (+ 1.0 (* (* x x) -2.0)) (* c c))) (* x s))
       (/ (/ 1.0 (* s (* x c))) (* x (* s c)))))
    double code(double x, double c, double s) {
    	double tmp;
    	if (x <= 1.2e+76) {
    		tmp = ((1.0 / (x * s)) * ((1.0 + ((x * x) * -2.0)) / (c * c))) / (x * s);
    	} else {
    		tmp = (1.0 / (s * (x * c))) / (x * (s * c));
    	}
    	return tmp;
    }
    
    real(8) function code(x, c, s)
        real(8), intent (in) :: x
        real(8), intent (in) :: c
        real(8), intent (in) :: s
        real(8) :: tmp
        if (x <= 1.2d+76) then
            tmp = ((1.0d0 / (x * s)) * ((1.0d0 + ((x * x) * (-2.0d0))) / (c * c))) / (x * s)
        else
            tmp = (1.0d0 / (s * (x * c))) / (x * (s * c))
        end if
        code = tmp
    end function
    
    public static double code(double x, double c, double s) {
    	double tmp;
    	if (x <= 1.2e+76) {
    		tmp = ((1.0 / (x * s)) * ((1.0 + ((x * x) * -2.0)) / (c * c))) / (x * s);
    	} else {
    		tmp = (1.0 / (s * (x * c))) / (x * (s * c));
    	}
    	return tmp;
    }
    
    def code(x, c, s):
    	tmp = 0
    	if x <= 1.2e+76:
    		tmp = ((1.0 / (x * s)) * ((1.0 + ((x * x) * -2.0)) / (c * c))) / (x * s)
    	else:
    		tmp = (1.0 / (s * (x * c))) / (x * (s * c))
    	return tmp
    
    function code(x, c, s)
    	tmp = 0.0
    	if (x <= 1.2e+76)
    		tmp = Float64(Float64(Float64(1.0 / Float64(x * s)) * Float64(Float64(1.0 + Float64(Float64(x * x) * -2.0)) / Float64(c * c))) / Float64(x * s));
    	else
    		tmp = Float64(Float64(1.0 / Float64(s * Float64(x * c))) / Float64(x * Float64(s * c)));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, c, s)
    	tmp = 0.0;
    	if (x <= 1.2e+76)
    		tmp = ((1.0 / (x * s)) * ((1.0 + ((x * x) * -2.0)) / (c * c))) / (x * s);
    	else
    		tmp = (1.0 / (s * (x * c))) / (x * (s * c));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, c_, s_] := If[LessEqual[x, 1.2e+76], N[(N[(N[(1.0 / N[(x * s), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 1.2 \cdot 10^{+76}:\\
    \;\;\;\;\frac{\frac{1}{x \cdot s} \cdot \frac{1 + \left(x \cdot x\right) \cdot -2}{c \cdot c}}{x \cdot s}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{1}{s \cdot \left(x \cdot c\right)}}{x \cdot \left(s \cdot c\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 1.2e76

      1. Initial program 64.9%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6482.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified82.1%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-/l/N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right)}}{x} \]
        3. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right)}}{x} \]
        4. swap-sqrN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot s\right) \cdot \left(c \cdot c\right)\right)}}{x} \]
        5. unpow2N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot \left(c \cdot c\right)\right)}}{x} \]
        6. unpow2N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot {c}^{2}\right)}}{x} \]
        7. associate-*r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot {c}^{2}}}{x} \]
        8. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot {s}^{2}\right)}}{x} \]
        9. associate-/r*N/A

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

          \[\leadsto \frac{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{{s}^{2}}}{x} \]
        11. associate-/r*N/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\color{blue}{{s}^{2} \cdot x}} \]
        12. unpow2N/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\left(s \cdot s\right) \cdot x} \]
        13. associate-*l*N/A

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{s}\right), \color{blue}{\left(x \cdot s\right)}\right) \]
      6. Applied egg-rr77.3%

        \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot c\right)}}{s}}{x \cdot s}} \]
      7. Taylor expanded in x around 0

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{x}^{2}}{{c}^{2} \cdot s} + \frac{1}{{c}^{2} \cdot s}\right), x\right), \mathsf{*.f64}\left(\color{blue}{x}, s\right)\right) \]
      9. Simplified55.7%

        \[\leadsto \frac{\color{blue}{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot \frac{1}{\left(c \cdot c\right) \cdot s}}{x}}}{x \cdot s} \]
      10. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\left(1 + \left(x \cdot x\right) \cdot -2\right) \cdot 1}{\left(c \cdot c\right) \cdot s}}{x}\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        2. times-fracN/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1 + \left(x \cdot x\right) \cdot -2}{c \cdot c} \cdot \frac{1}{s}}{x}\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        3. associate-/l*N/A

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(1 + \left(x \cdot x\right) \cdot -2\right), \left(c \cdot c\right)\right), \left(\frac{1}{x \cdot s}\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        7. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\left(x \cdot x\right) \cdot -2\right)\right), \left(c \cdot c\right)\right), \left(\frac{1}{x \cdot s}\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(x \cdot x\right), -2\right)\right), \left(c \cdot c\right)\right), \left(\frac{1}{x \cdot s}\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        9. *-lowering-*.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), -2\right)\right), \mathsf{*.f64}\left(c, c\right)\right), \left(\frac{1}{x \cdot s}\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        11. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), -2\right)\right), \mathsf{*.f64}\left(c, c\right)\right), \mathsf{/.f64}\left(1, \left(x \cdot s\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
        12. *-lowering-*.f6457.5%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), -2\right)\right), \mathsf{*.f64}\left(c, c\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, s\right)\right)\right), \mathsf{*.f64}\left(x, s\right)\right) \]
      11. Applied egg-rr57.5%

        \[\leadsto \frac{\color{blue}{\frac{1 + \left(x \cdot x\right) \cdot -2}{c \cdot c} \cdot \frac{1}{x \cdot s}}}{x \cdot s} \]

      if 1.2e76 < x

      1. Initial program 65.1%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6483.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified83.1%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-/r*N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
        3. associate-*r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        4. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        5. associate-*l*N/A

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

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
        7. *-commutativeN/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
        8. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
        9. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        11. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        12. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        13. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
        19. *-lowering-*.f6496.0%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
      6. Applied egg-rr96.0%

        \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
      7. Taylor expanded in x around 0

        \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{1}{c \cdot \left(s \cdot x\right)}\right)}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
      8. Step-by-step derivation
        1. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\left(c \cdot s\right) \cdot x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
        3. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\left(s \cdot c\right) \cdot x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
        4. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(s \cdot \left(c \cdot x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(s, \left(c \cdot x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
        6. *-lowering-*.f6475.8%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
      9. Simplified75.8%

        \[\leadsto \frac{\color{blue}{\frac{1}{s \cdot \left(c \cdot x\right)}}}{x \cdot \left(s \cdot c\right)} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification61.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.2 \cdot 10^{+76}:\\ \;\;\;\;\frac{\frac{1}{x \cdot s} \cdot \frac{1 + \left(x \cdot x\right) \cdot -2}{c \cdot c}}{x \cdot s}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{s \cdot \left(x \cdot c\right)}}{x \cdot \left(s \cdot c\right)}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 12: 72.3% accurate, 13.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 2.7 \cdot 10^{+16}:\\ \;\;\;\;\frac{1}{c \cdot \left(c \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)\right)}\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{+87}:\\ \;\;\;\;\frac{-2}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \left(\left(x \cdot \left(s \cdot c\right)\right) \cdot \left(x \cdot c\right)\right)}\\ \end{array} \end{array} \]
    (FPCore (x c s)
     :precision binary64
     (if (<= x 2.7e+16)
       (/ 1.0 (* c (* c (* (* x s) (* x s)))))
       (if (<= x 1.65e+87)
         (/ -2.0 (* c (* c (* s s))))
         (/ 1.0 (* s (* (* x (* s c)) (* x c)))))))
    double code(double x, double c, double s) {
    	double tmp;
    	if (x <= 2.7e+16) {
    		tmp = 1.0 / (c * (c * ((x * s) * (x * s))));
    	} else if (x <= 1.65e+87) {
    		tmp = -2.0 / (c * (c * (s * s)));
    	} else {
    		tmp = 1.0 / (s * ((x * (s * c)) * (x * c)));
    	}
    	return tmp;
    }
    
    real(8) function code(x, c, s)
        real(8), intent (in) :: x
        real(8), intent (in) :: c
        real(8), intent (in) :: s
        real(8) :: tmp
        if (x <= 2.7d+16) then
            tmp = 1.0d0 / (c * (c * ((x * s) * (x * s))))
        else if (x <= 1.65d+87) then
            tmp = (-2.0d0) / (c * (c * (s * s)))
        else
            tmp = 1.0d0 / (s * ((x * (s * c)) * (x * c)))
        end if
        code = tmp
    end function
    
    public static double code(double x, double c, double s) {
    	double tmp;
    	if (x <= 2.7e+16) {
    		tmp = 1.0 / (c * (c * ((x * s) * (x * s))));
    	} else if (x <= 1.65e+87) {
    		tmp = -2.0 / (c * (c * (s * s)));
    	} else {
    		tmp = 1.0 / (s * ((x * (s * c)) * (x * c)));
    	}
    	return tmp;
    }
    
    def code(x, c, s):
    	tmp = 0
    	if x <= 2.7e+16:
    		tmp = 1.0 / (c * (c * ((x * s) * (x * s))))
    	elif x <= 1.65e+87:
    		tmp = -2.0 / (c * (c * (s * s)))
    	else:
    		tmp = 1.0 / (s * ((x * (s * c)) * (x * c)))
    	return tmp
    
    function code(x, c, s)
    	tmp = 0.0
    	if (x <= 2.7e+16)
    		tmp = Float64(1.0 / Float64(c * Float64(c * Float64(Float64(x * s) * Float64(x * s)))));
    	elseif (x <= 1.65e+87)
    		tmp = Float64(-2.0 / Float64(c * Float64(c * Float64(s * s))));
    	else
    		tmp = Float64(1.0 / Float64(s * Float64(Float64(x * Float64(s * c)) * Float64(x * c))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, c, s)
    	tmp = 0.0;
    	if (x <= 2.7e+16)
    		tmp = 1.0 / (c * (c * ((x * s) * (x * s))));
    	elseif (x <= 1.65e+87)
    		tmp = -2.0 / (c * (c * (s * s)));
    	else
    		tmp = 1.0 / (s * ((x * (s * c)) * (x * c)));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, c_, s_] := If[LessEqual[x, 2.7e+16], N[(1.0 / N[(c * N[(c * N[(N[(x * s), $MachinePrecision] * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.65e+87], N[(-2.0 / N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(s * N[(N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision] * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 2.7 \cdot 10^{+16}:\\
    \;\;\;\;\frac{1}{c \cdot \left(c \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)\right)}\\
    
    \mathbf{elif}\;x \leq 1.65 \cdot 10^{+87}:\\
    \;\;\;\;\frac{-2}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{s \cdot \left(\left(x \cdot \left(s \cdot c\right)\right) \cdot \left(x \cdot c\right)\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if x < 2.7e16

      1. Initial program 63.4%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6481.8%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified81.8%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-/r*N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
        3. associate-*r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        4. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
        5. associate-*l*N/A

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

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
        7. *-commutativeN/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
        8. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
        9. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        11. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        12. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        13. count-2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
        19. *-lowering-*.f6498.2%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
      6. Applied egg-rr98.2%

        \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
      7. Taylor expanded in x around 0

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

          \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left({c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)\right)}\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(1, \left(\left(c \cdot c\right) \cdot \left(\color{blue}{{s}^{2}} \cdot {x}^{2}\right)\right)\right) \]
        3. associate-*l*N/A

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

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

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{\left({s}^{2} \cdot {x}^{2}\right)}\right)\right)\right) \]
        6. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(\left(s \cdot s\right) \cdot {\color{blue}{x}}^{2}\right)\right)\right)\right) \]
        7. associate-*l*N/A

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

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

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

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \left(x \cdot \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
        11. *-lowering-*.f6465.9%

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
      9. Simplified65.9%

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

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

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(\left(x \cdot x\right) \cdot \color{blue}{\left(s \cdot s\right)}\right)\right)\right)\right) \]
        3. swap-sqrN/A

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

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(\left(x \cdot s\right), \color{blue}{\left(x \cdot s\right)}\right)\right)\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, s\right), \left(\color{blue}{x} \cdot s\right)\right)\right)\right)\right) \]
        6. *-lowering-*.f6474.5%

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, s\right), \mathsf{*.f64}\left(x, \color{blue}{s}\right)\right)\right)\right)\right) \]
      11. Applied egg-rr74.5%

        \[\leadsto \frac{1}{c \cdot \left(c \cdot \color{blue}{\left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)}\right)} \]

      if 2.7e16 < x < 1.6500000000000001e87

      1. Initial program 81.6%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6488.2%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified88.2%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-/l/N/A

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

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right)}}{x} \]
        3. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right)}}{x} \]
        4. swap-sqrN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot s\right) \cdot \left(c \cdot c\right)\right)}}{x} \]
        5. unpow2N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot \left(c \cdot c\right)\right)}}{x} \]
        6. unpow2N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot {c}^{2}\right)}}{x} \]
        7. associate-*r*N/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot {c}^{2}}}{x} \]
        8. *-commutativeN/A

          \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot {s}^{2}\right)}}{x} \]
        9. associate-/r*N/A

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

          \[\leadsto \frac{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{{s}^{2}}}{x} \]
        11. associate-/r*N/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\color{blue}{{s}^{2} \cdot x}} \]
        12. unpow2N/A

          \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\left(s \cdot s\right) \cdot x} \]
        13. associate-*l*N/A

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{s}\right), \color{blue}{\left(x \cdot s\right)}\right) \]
      6. Applied egg-rr87.6%

        \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot c\right)}}{s}}{x \cdot s}} \]
      7. Taylor expanded in x around 0

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{x}^{2}}{{c}^{2} \cdot s} + \frac{1}{{c}^{2} \cdot s}\right), x\right), \mathsf{*.f64}\left(\color{blue}{x}, s\right)\right) \]
      9. Simplified70.0%

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

        \[\leadsto \color{blue}{\frac{-2}{{c}^{2} \cdot {s}^{2}}} \]
      11. Step-by-step derivation
        1. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(-2, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(-2, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right) \]
        3. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(-2, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right) \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(-2, \left(s \cdot \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right) \]
        6. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right) \]
        7. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \left(c \cdot \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \]
        9. *-lowering-*.f6470.2%

          \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right) \]
      12. Simplified70.2%

        \[\leadsto \color{blue}{\frac{-2}{s \cdot \left(c \cdot \left(c \cdot s\right)\right)}} \]
      13. Taylor expanded in s around 0

        \[\leadsto \mathsf{/.f64}\left(-2, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right) \]
      14. Step-by-step derivation
        1. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(-2, \left(\left(c \cdot c\right) \cdot {\color{blue}{s}}^{2}\right)\right) \]
        2. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(-2, \left(c \cdot \color{blue}{\left(c \cdot {s}^{2}\right)}\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot {s}^{2}\right)}\right)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{\left({s}^{2}\right)}\right)\right)\right) \]
        5. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(s \cdot \color{blue}{s}\right)\right)\right)\right) \]
        6. *-lowering-*.f6469.9%

          \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \color{blue}{s}\right)\right)\right)\right) \]
      15. Simplified69.9%

        \[\leadsto \frac{-2}{\color{blue}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}} \]

      if 1.6500000000000001e87 < x

      1. Initial program 65.7%

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
        4. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
        5. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
        8. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
        9. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
        13. *-commutativeN/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
        15. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
        16. associate-*l*N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
        18. *-lowering-*.f6482.4%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
      3. Simplified82.4%

        \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
      4. Add Preprocessing
      5. Taylor expanded in x around 0

        \[\leadsto \mathsf{/.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, s\right)\right)\right)\right)\right)\right) \]
      6. Step-by-step derivation
        1. Simplified74.4%

          \[\leadsto \frac{\color{blue}{1}}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)} \]
        2. Step-by-step derivation
          1. associate-*r*N/A

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

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

            \[\leadsto \mathsf{/.f64}\left(1, \left(\left(x \cdot x\right) \cdot \left(\left(s \cdot c\right) \cdot \left(s \cdot \color{blue}{c}\right)\right)\right)\right) \]
          4. unswap-sqrN/A

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

            \[\leadsto \mathsf{/.f64}\left(1, \left(\left(x \cdot \left(s \cdot c\right)\right) \cdot \left(x \cdot \left(c \cdot \color{blue}{s}\right)\right)\right)\right) \]
          6. associate-*r*N/A

            \[\leadsto \mathsf{/.f64}\left(1, \left(\left(x \cdot \left(s \cdot c\right)\right) \cdot \left(\left(x \cdot c\right) \cdot \color{blue}{s}\right)\right)\right) \]
          7. associate-*r*N/A

            \[\leadsto \mathsf{/.f64}\left(1, \left(\left(\left(x \cdot \left(s \cdot c\right)\right) \cdot \left(x \cdot c\right)\right) \cdot \color{blue}{s}\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\left(\left(x \cdot \left(s \cdot c\right)\right) \cdot \left(x \cdot c\right)\right), \color{blue}{s}\right)\right) \]
          9. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x \cdot \left(s \cdot c\right)\right), \left(x \cdot c\right)\right), s\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \left(s \cdot c\right)\right), \left(x \cdot c\right)\right), s\right)\right) \]
          11. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot c\right)\right), s\right)\right) \]
          12. *-lowering-*.f6476.9%

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, c\right)\right), s\right)\right) \]
        3. Applied egg-rr76.9%

          \[\leadsto \frac{1}{\color{blue}{\left(\left(x \cdot \left(s \cdot c\right)\right) \cdot \left(x \cdot c\right)\right) \cdot s}} \]
      7. Recombined 3 regimes into one program.
      8. Final simplification74.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.7 \cdot 10^{+16}:\\ \;\;\;\;\frac{1}{c \cdot \left(c \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)\right)}\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{+87}:\\ \;\;\;\;\frac{-2}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \left(\left(x \cdot \left(s \cdot c\right)\right) \cdot \left(x \cdot c\right)\right)}\\ \end{array} \]
      9. Add Preprocessing

      Alternative 13: 71.3% accurate, 13.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 2.7 \cdot 10^{+16}:\\ \;\;\;\;\frac{1}{c \cdot \left(c \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)\right)}\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{+87}:\\ \;\;\;\;\frac{-2}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(s \cdot s\right) \cdot \left(c \cdot \left(x \cdot \left(x \cdot c\right)\right)\right)}\\ \end{array} \end{array} \]
      (FPCore (x c s)
       :precision binary64
       (if (<= x 2.7e+16)
         (/ 1.0 (* c (* c (* (* x s) (* x s)))))
         (if (<= x 1.35e+87)
           (/ -2.0 (* c (* c (* s s))))
           (/ 1.0 (* (* s s) (* c (* x (* x c))))))))
      double code(double x, double c, double s) {
      	double tmp;
      	if (x <= 2.7e+16) {
      		tmp = 1.0 / (c * (c * ((x * s) * (x * s))));
      	} else if (x <= 1.35e+87) {
      		tmp = -2.0 / (c * (c * (s * s)));
      	} else {
      		tmp = 1.0 / ((s * s) * (c * (x * (x * c))));
      	}
      	return tmp;
      }
      
      real(8) function code(x, c, s)
          real(8), intent (in) :: x
          real(8), intent (in) :: c
          real(8), intent (in) :: s
          real(8) :: tmp
          if (x <= 2.7d+16) then
              tmp = 1.0d0 / (c * (c * ((x * s) * (x * s))))
          else if (x <= 1.35d+87) then
              tmp = (-2.0d0) / (c * (c * (s * s)))
          else
              tmp = 1.0d0 / ((s * s) * (c * (x * (x * c))))
          end if
          code = tmp
      end function
      
      public static double code(double x, double c, double s) {
      	double tmp;
      	if (x <= 2.7e+16) {
      		tmp = 1.0 / (c * (c * ((x * s) * (x * s))));
      	} else if (x <= 1.35e+87) {
      		tmp = -2.0 / (c * (c * (s * s)));
      	} else {
      		tmp = 1.0 / ((s * s) * (c * (x * (x * c))));
      	}
      	return tmp;
      }
      
      def code(x, c, s):
      	tmp = 0
      	if x <= 2.7e+16:
      		tmp = 1.0 / (c * (c * ((x * s) * (x * s))))
      	elif x <= 1.35e+87:
      		tmp = -2.0 / (c * (c * (s * s)))
      	else:
      		tmp = 1.0 / ((s * s) * (c * (x * (x * c))))
      	return tmp
      
      function code(x, c, s)
      	tmp = 0.0
      	if (x <= 2.7e+16)
      		tmp = Float64(1.0 / Float64(c * Float64(c * Float64(Float64(x * s) * Float64(x * s)))));
      	elseif (x <= 1.35e+87)
      		tmp = Float64(-2.0 / Float64(c * Float64(c * Float64(s * s))));
      	else
      		tmp = Float64(1.0 / Float64(Float64(s * s) * Float64(c * Float64(x * Float64(x * c)))));
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, c, s)
      	tmp = 0.0;
      	if (x <= 2.7e+16)
      		tmp = 1.0 / (c * (c * ((x * s) * (x * s))));
      	elseif (x <= 1.35e+87)
      		tmp = -2.0 / (c * (c * (s * s)));
      	else
      		tmp = 1.0 / ((s * s) * (c * (x * (x * c))));
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, c_, s_] := If[LessEqual[x, 2.7e+16], N[(1.0 / N[(c * N[(c * N[(N[(x * s), $MachinePrecision] * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.35e+87], N[(-2.0 / N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(s * s), $MachinePrecision] * N[(c * N[(x * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;x \leq 2.7 \cdot 10^{+16}:\\
      \;\;\;\;\frac{1}{c \cdot \left(c \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)\right)}\\
      
      \mathbf{elif}\;x \leq 1.35 \cdot 10^{+87}:\\
      \;\;\;\;\frac{-2}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{1}{\left(s \cdot s\right) \cdot \left(c \cdot \left(x \cdot \left(x \cdot c\right)\right)\right)}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if x < 2.7e16

        1. Initial program 63.4%

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
          4. associate-*r*N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
          5. *-commutativeN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
          7. *-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
          8. associate-*r*N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
          9. *-commutativeN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
          11. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
          12. associate-*r*N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
          13. *-commutativeN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
          15. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
          16. associate-*l*N/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
          18. *-lowering-*.f6481.8%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
        3. Simplified81.8%

          \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. associate-/r*N/A

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

            \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
          3. associate-*r*N/A

            \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
          4. *-commutativeN/A

            \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
          5. associate-*l*N/A

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

            \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
          7. *-commutativeN/A

            \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
          8. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
          9. /-lowering-/.f64N/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
          11. count-2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
          12. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
          13. count-2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
          14. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
          17. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
          18. *-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
          19. *-lowering-*.f6498.2%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
        6. Applied egg-rr98.2%

          \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
        7. Taylor expanded in x around 0

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

            \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left({c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)\right)}\right) \]
          2. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(1, \left(\left(c \cdot c\right) \cdot \left(\color{blue}{{s}^{2}} \cdot {x}^{2}\right)\right)\right) \]
          3. associate-*l*N/A

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

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

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{\left({s}^{2} \cdot {x}^{2}\right)}\right)\right)\right) \]
          6. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(\left(s \cdot s\right) \cdot {\color{blue}{x}}^{2}\right)\right)\right)\right) \]
          7. associate-*l*N/A

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

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

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

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \left(x \cdot \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
          11. *-lowering-*.f6465.9%

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
        9. Simplified65.9%

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

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

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(\left(x \cdot x\right) \cdot \color{blue}{\left(s \cdot s\right)}\right)\right)\right)\right) \]
          3. swap-sqrN/A

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

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(\left(x \cdot s\right), \color{blue}{\left(x \cdot s\right)}\right)\right)\right)\right) \]
          5. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, s\right), \left(\color{blue}{x} \cdot s\right)\right)\right)\right)\right) \]
          6. *-lowering-*.f6474.5%

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, s\right), \mathsf{*.f64}\left(x, \color{blue}{s}\right)\right)\right)\right)\right) \]
        11. Applied egg-rr74.5%

          \[\leadsto \frac{1}{c \cdot \left(c \cdot \color{blue}{\left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)}\right)} \]

        if 2.7e16 < x < 1.35000000000000003e87

        1. Initial program 81.6%

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
          4. associate-*r*N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
          5. *-commutativeN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
          7. *-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
          8. associate-*r*N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
          9. *-commutativeN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
          11. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
          12. associate-*r*N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
          13. *-commutativeN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
          15. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
          16. associate-*l*N/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
          18. *-lowering-*.f6488.2%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
        3. Simplified88.2%

          \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. associate-/l/N/A

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

            \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right)}}{x} \]
          3. *-commutativeN/A

            \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right)}}{x} \]
          4. swap-sqrN/A

            \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot s\right) \cdot \left(c \cdot c\right)\right)}}{x} \]
          5. unpow2N/A

            \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot \left(c \cdot c\right)\right)}}{x} \]
          6. unpow2N/A

            \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot {c}^{2}\right)}}{x} \]
          7. associate-*r*N/A

            \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot {c}^{2}}}{x} \]
          8. *-commutativeN/A

            \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot {s}^{2}\right)}}{x} \]
          9. associate-/r*N/A

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

            \[\leadsto \frac{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{{s}^{2}}}{x} \]
          11. associate-/r*N/A

            \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\color{blue}{{s}^{2} \cdot x}} \]
          12. unpow2N/A

            \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\left(s \cdot s\right) \cdot x} \]
          13. associate-*l*N/A

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{s}\right), \color{blue}{\left(x \cdot s\right)}\right) \]
        6. Applied egg-rr87.6%

          \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot c\right)}}{s}}{x \cdot s}} \]
        7. Taylor expanded in x around 0

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{x}^{2}}{{c}^{2} \cdot s} + \frac{1}{{c}^{2} \cdot s}\right), x\right), \mathsf{*.f64}\left(\color{blue}{x}, s\right)\right) \]
        9. Simplified70.0%

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

          \[\leadsto \color{blue}{\frac{-2}{{c}^{2} \cdot {s}^{2}}} \]
        11. Step-by-step derivation
          1. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(-2, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right) \]
          2. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(-2, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right) \]
          3. associate-*r*N/A

            \[\leadsto \mathsf{/.f64}\left(-2, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right) \]
          4. *-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(-2, \left(s \cdot \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right) \]
          5. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right) \]
          6. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right) \]
          7. associate-*l*N/A

            \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \left(c \cdot \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \]
          9. *-lowering-*.f6470.2%

            \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right) \]
        12. Simplified70.2%

          \[\leadsto \color{blue}{\frac{-2}{s \cdot \left(c \cdot \left(c \cdot s\right)\right)}} \]
        13. Taylor expanded in s around 0

          \[\leadsto \mathsf{/.f64}\left(-2, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right) \]
        14. Step-by-step derivation
          1. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(-2, \left(\left(c \cdot c\right) \cdot {\color{blue}{s}}^{2}\right)\right) \]
          2. associate-*l*N/A

            \[\leadsto \mathsf{/.f64}\left(-2, \left(c \cdot \color{blue}{\left(c \cdot {s}^{2}\right)}\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot {s}^{2}\right)}\right)\right) \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{\left({s}^{2}\right)}\right)\right)\right) \]
          5. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(s \cdot \color{blue}{s}\right)\right)\right)\right) \]
          6. *-lowering-*.f6469.9%

            \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \color{blue}{s}\right)\right)\right)\right) \]
        15. Simplified69.9%

          \[\leadsto \frac{-2}{\color{blue}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}} \]

        if 1.35000000000000003e87 < x

        1. Initial program 65.7%

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
          4. associate-*r*N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
          5. *-commutativeN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
          7. *-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
          8. associate-*r*N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
          9. *-commutativeN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
          11. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
          12. associate-*r*N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
          13. *-commutativeN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
          15. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
          16. associate-*l*N/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
          18. *-lowering-*.f6482.4%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
        3. Simplified82.4%

          \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
        4. Add Preprocessing
        5. Taylor expanded in x around 0

          \[\leadsto \mathsf{/.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, s\right)\right)\right)\right)\right)\right) \]
        6. Step-by-step derivation
          1. Simplified74.4%

            \[\leadsto \frac{\color{blue}{1}}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)} \]
          2. Step-by-step derivation
            1. associate-*r*N/A

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

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

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(\left(c \cdot \left(c \cdot s\right)\right) \cdot s\right) \cdot \left(\color{blue}{x} \cdot x\right)\right)\right) \]
            4. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(c \cdot \left(c \cdot s\right)\right) \cdot \color{blue}{\left(s \cdot \left(x \cdot x\right)\right)}\right)\right) \]
            5. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(\left(c \cdot c\right) \cdot s\right) \cdot \left(\color{blue}{s} \cdot \left(x \cdot x\right)\right)\right)\right) \]
            6. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(c \cdot c\right) \cdot \color{blue}{\left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right)}\right)\right) \]
            7. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right) \cdot \color{blue}{\left(c \cdot c\right)}\right)\right) \]
            8. associate-*l*N/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(\left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right) \cdot c\right) \cdot \color{blue}{c}\right)\right) \]
            9. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(\left(\left(s \cdot s\right) \cdot \left(x \cdot x\right)\right) \cdot c\right) \cdot c\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(\left(s \cdot s\right) \cdot \left(\left(x \cdot x\right) \cdot c\right)\right) \cdot c\right)\right) \]
            11. associate-*l*N/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(s \cdot s\right) \cdot \color{blue}{\left(\left(\left(x \cdot x\right) \cdot c\right) \cdot c\right)}\right)\right) \]
            12. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\left(s \cdot s\right), \color{blue}{\left(\left(\left(x \cdot x\right) \cdot c\right) \cdot c\right)}\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(s, s\right), \left(\color{blue}{\left(\left(x \cdot x\right) \cdot c\right)} \cdot c\right)\right)\right) \]
            14. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(s, s\right), \mathsf{*.f64}\left(\left(\left(x \cdot x\right) \cdot c\right), \color{blue}{c}\right)\right)\right) \]
            15. associate-*l*N/A

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(s, s\right), \mathsf{*.f64}\left(\left(x \cdot \left(x \cdot c\right)\right), c\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(s, s\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \left(x \cdot c\right)\right), c\right)\right)\right) \]
            17. *-lowering-*.f6469.6%

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(s, s\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, c\right)\right), c\right)\right)\right) \]
          3. Applied egg-rr69.6%

            \[\leadsto \frac{1}{\color{blue}{\left(s \cdot s\right) \cdot \left(\left(x \cdot \left(x \cdot c\right)\right) \cdot c\right)}} \]
        7. Recombined 3 regimes into one program.
        8. Final simplification73.3%

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.7 \cdot 10^{+16}:\\ \;\;\;\;\frac{1}{c \cdot \left(c \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)\right)}\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{+87}:\\ \;\;\;\;\frac{-2}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(s \cdot s\right) \cdot \left(c \cdot \left(x \cdot \left(x \cdot c\right)\right)\right)}\\ \end{array} \]
        9. Add Preprocessing

        Alternative 14: 72.3% accurate, 13.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 2.7 \cdot 10^{+16}:\\ \;\;\;\;\frac{1}{c \cdot \left(c \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)\right)}\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{+87}:\\ \;\;\;\;\frac{-2}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x \cdot \left(c \cdot \left(s \cdot \left(s \cdot \left(x \cdot c\right)\right)\right)\right)}\\ \end{array} \end{array} \]
        (FPCore (x c s)
         :precision binary64
         (if (<= x 2.7e+16)
           (/ 1.0 (* c (* c (* (* x s) (* x s)))))
           (if (<= x 1.65e+87)
             (/ -2.0 (* c (* c (* s s))))
             (/ 1.0 (* x (* c (* s (* s (* x c)))))))))
        double code(double x, double c, double s) {
        	double tmp;
        	if (x <= 2.7e+16) {
        		tmp = 1.0 / (c * (c * ((x * s) * (x * s))));
        	} else if (x <= 1.65e+87) {
        		tmp = -2.0 / (c * (c * (s * s)));
        	} else {
        		tmp = 1.0 / (x * (c * (s * (s * (x * c)))));
        	}
        	return tmp;
        }
        
        real(8) function code(x, c, s)
            real(8), intent (in) :: x
            real(8), intent (in) :: c
            real(8), intent (in) :: s
            real(8) :: tmp
            if (x <= 2.7d+16) then
                tmp = 1.0d0 / (c * (c * ((x * s) * (x * s))))
            else if (x <= 1.65d+87) then
                tmp = (-2.0d0) / (c * (c * (s * s)))
            else
                tmp = 1.0d0 / (x * (c * (s * (s * (x * c)))))
            end if
            code = tmp
        end function
        
        public static double code(double x, double c, double s) {
        	double tmp;
        	if (x <= 2.7e+16) {
        		tmp = 1.0 / (c * (c * ((x * s) * (x * s))));
        	} else if (x <= 1.65e+87) {
        		tmp = -2.0 / (c * (c * (s * s)));
        	} else {
        		tmp = 1.0 / (x * (c * (s * (s * (x * c)))));
        	}
        	return tmp;
        }
        
        def code(x, c, s):
        	tmp = 0
        	if x <= 2.7e+16:
        		tmp = 1.0 / (c * (c * ((x * s) * (x * s))))
        	elif x <= 1.65e+87:
        		tmp = -2.0 / (c * (c * (s * s)))
        	else:
        		tmp = 1.0 / (x * (c * (s * (s * (x * c)))))
        	return tmp
        
        function code(x, c, s)
        	tmp = 0.0
        	if (x <= 2.7e+16)
        		tmp = Float64(1.0 / Float64(c * Float64(c * Float64(Float64(x * s) * Float64(x * s)))));
        	elseif (x <= 1.65e+87)
        		tmp = Float64(-2.0 / Float64(c * Float64(c * Float64(s * s))));
        	else
        		tmp = Float64(1.0 / Float64(x * Float64(c * Float64(s * Float64(s * Float64(x * c))))));
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, c, s)
        	tmp = 0.0;
        	if (x <= 2.7e+16)
        		tmp = 1.0 / (c * (c * ((x * s) * (x * s))));
        	elseif (x <= 1.65e+87)
        		tmp = -2.0 / (c * (c * (s * s)));
        	else
        		tmp = 1.0 / (x * (c * (s * (s * (x * c)))));
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, c_, s_] := If[LessEqual[x, 2.7e+16], N[(1.0 / N[(c * N[(c * N[(N[(x * s), $MachinePrecision] * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.65e+87], N[(-2.0 / N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x * N[(c * N[(s * N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;x \leq 2.7 \cdot 10^{+16}:\\
        \;\;\;\;\frac{1}{c \cdot \left(c \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)\right)}\\
        
        \mathbf{elif}\;x \leq 1.65 \cdot 10^{+87}:\\
        \;\;\;\;\frac{-2}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{1}{x \cdot \left(c \cdot \left(s \cdot \left(s \cdot \left(x \cdot c\right)\right)\right)\right)}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if x < 2.7e16

          1. Initial program 63.4%

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
            4. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
            5. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
            7. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
            8. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
            9. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
            11. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
            12. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
            13. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
            15. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
            16. associate-*l*N/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
            18. *-lowering-*.f6481.8%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
          3. Simplified81.8%

            \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
          4. Add Preprocessing
          5. Step-by-step derivation
            1. associate-/r*N/A

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

              \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
            3. associate-*r*N/A

              \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
            4. *-commutativeN/A

              \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
            5. associate-*l*N/A

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

              \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
            7. *-commutativeN/A

              \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
            8. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
            9. /-lowering-/.f64N/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
            11. count-2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
            12. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
            13. count-2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
            14. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
            17. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
            18. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
            19. *-lowering-*.f6498.2%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
          6. Applied egg-rr98.2%

            \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
          7. Taylor expanded in x around 0

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

              \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left({c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)\right)}\right) \]
            2. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(c \cdot c\right) \cdot \left(\color{blue}{{s}^{2}} \cdot {x}^{2}\right)\right)\right) \]
            3. associate-*l*N/A

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

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

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{\left({s}^{2} \cdot {x}^{2}\right)}\right)\right)\right) \]
            6. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(\left(s \cdot s\right) \cdot {\color{blue}{x}}^{2}\right)\right)\right)\right) \]
            7. associate-*l*N/A

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

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

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

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \left(x \cdot \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
            11. *-lowering-*.f6465.9%

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
          9. Simplified65.9%

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

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

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(\left(x \cdot x\right) \cdot \color{blue}{\left(s \cdot s\right)}\right)\right)\right)\right) \]
            3. swap-sqrN/A

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

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(\left(x \cdot s\right), \color{blue}{\left(x \cdot s\right)}\right)\right)\right)\right) \]
            5. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, s\right), \left(\color{blue}{x} \cdot s\right)\right)\right)\right)\right) \]
            6. *-lowering-*.f6474.5%

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, s\right), \mathsf{*.f64}\left(x, \color{blue}{s}\right)\right)\right)\right)\right) \]
          11. Applied egg-rr74.5%

            \[\leadsto \frac{1}{c \cdot \left(c \cdot \color{blue}{\left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)}\right)} \]

          if 2.7e16 < x < 1.6500000000000001e87

          1. Initial program 81.6%

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
            4. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
            5. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
            7. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
            8. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
            9. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
            11. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
            12. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
            13. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
            15. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
            16. associate-*l*N/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
            18. *-lowering-*.f6488.2%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
          3. Simplified88.2%

            \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
          4. Add Preprocessing
          5. Step-by-step derivation
            1. associate-/l/N/A

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

              \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right)}}{x} \]
            3. *-commutativeN/A

              \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right)}}{x} \]
            4. swap-sqrN/A

              \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot s\right) \cdot \left(c \cdot c\right)\right)}}{x} \]
            5. unpow2N/A

              \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot \left(c \cdot c\right)\right)}}{x} \]
            6. unpow2N/A

              \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot {c}^{2}\right)}}{x} \]
            7. associate-*r*N/A

              \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot {c}^{2}}}{x} \]
            8. *-commutativeN/A

              \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot {s}^{2}\right)}}{x} \]
            9. associate-/r*N/A

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

              \[\leadsto \frac{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{{s}^{2}}}{x} \]
            11. associate-/r*N/A

              \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\color{blue}{{s}^{2} \cdot x}} \]
            12. unpow2N/A

              \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\left(s \cdot s\right) \cdot x} \]
            13. associate-*l*N/A

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{s}\right), \color{blue}{\left(x \cdot s\right)}\right) \]
          6. Applied egg-rr87.6%

            \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot c\right)}}{s}}{x \cdot s}} \]
          7. Taylor expanded in x around 0

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{x}^{2}}{{c}^{2} \cdot s} + \frac{1}{{c}^{2} \cdot s}\right), x\right), \mathsf{*.f64}\left(\color{blue}{x}, s\right)\right) \]
          9. Simplified70.0%

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

            \[\leadsto \color{blue}{\frac{-2}{{c}^{2} \cdot {s}^{2}}} \]
          11. Step-by-step derivation
            1. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(-2, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right) \]
            2. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(-2, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right) \]
            3. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(-2, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right) \]
            4. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(-2, \left(s \cdot \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right) \]
            5. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right) \]
            6. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right) \]
            7. associate-*l*N/A

              \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \left(c \cdot \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \]
            8. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \]
            9. *-lowering-*.f6470.2%

              \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right) \]
          12. Simplified70.2%

            \[\leadsto \color{blue}{\frac{-2}{s \cdot \left(c \cdot \left(c \cdot s\right)\right)}} \]
          13. Taylor expanded in s around 0

            \[\leadsto \mathsf{/.f64}\left(-2, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right) \]
          14. Step-by-step derivation
            1. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(-2, \left(\left(c \cdot c\right) \cdot {\color{blue}{s}}^{2}\right)\right) \]
            2. associate-*l*N/A

              \[\leadsto \mathsf{/.f64}\left(-2, \left(c \cdot \color{blue}{\left(c \cdot {s}^{2}\right)}\right)\right) \]
            3. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot {s}^{2}\right)}\right)\right) \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{\left({s}^{2}\right)}\right)\right)\right) \]
            5. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(s \cdot \color{blue}{s}\right)\right)\right)\right) \]
            6. *-lowering-*.f6469.9%

              \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \color{blue}{s}\right)\right)\right)\right) \]
          15. Simplified69.9%

            \[\leadsto \frac{-2}{\color{blue}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}} \]

          if 1.6500000000000001e87 < x

          1. Initial program 65.7%

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
            4. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
            5. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
            7. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
            8. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
            9. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
            11. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
            12. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
            13. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
            15. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
            16. associate-*l*N/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
            18. *-lowering-*.f6482.4%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
          3. Simplified82.4%

            \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
          4. Add Preprocessing
          5. Taylor expanded in x around 0

            \[\leadsto \mathsf{/.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, s\right)\right)\right)\right)\right)\right) \]
          6. Step-by-step derivation
            1. Simplified74.4%

              \[\leadsto \frac{\color{blue}{1}}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)} \]
            2. Taylor expanded in x around 0

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

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \left(\left(c \cdot c\right) \cdot \left(\color{blue}{{s}^{2}} \cdot x\right)\right)\right)\right) \]
              2. associate-*l*N/A

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

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot \left({s}^{2} \cdot x\right)\right)}\right)\right)\right) \]
              4. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, \left(\left({s}^{2} \cdot x\right) \cdot \color{blue}{c}\right)\right)\right)\right) \]
              5. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, \left(\left(\left(s \cdot s\right) \cdot x\right) \cdot c\right)\right)\right)\right) \]
              6. associate-*l*N/A

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, \left(\left(s \cdot \left(s \cdot x\right)\right) \cdot c\right)\right)\right)\right) \]
              7. associate-*l*N/A

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, \left(s \cdot \color{blue}{\left(\left(s \cdot x\right) \cdot c\right)}\right)\right)\right)\right) \]
              8. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, \left(s \cdot \left(c \cdot \color{blue}{\left(s \cdot x\right)}\right)\right)\right)\right)\right) \]
              9. *-lowering-*.f64N/A

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

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \left(\left(c \cdot s\right) \cdot \color{blue}{x}\right)\right)\right)\right)\right) \]
              11. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \left(\left(s \cdot c\right) \cdot x\right)\right)\right)\right)\right) \]
              12. associate-*l*N/A

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \left(s \cdot \color{blue}{\left(c \cdot x\right)}\right)\right)\right)\right)\right) \]
              13. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \color{blue}{\left(c \cdot x\right)}\right)\right)\right)\right)\right) \]
              14. *-lowering-*.f6476.9%

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
            4. Simplified76.9%

              \[\leadsto \frac{1}{x \cdot \color{blue}{\left(c \cdot \left(s \cdot \left(s \cdot \left(c \cdot x\right)\right)\right)\right)}} \]
          7. Recombined 3 regimes into one program.
          8. Final simplification74.7%

            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.7 \cdot 10^{+16}:\\ \;\;\;\;\frac{1}{c \cdot \left(c \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)\right)}\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{+87}:\\ \;\;\;\;\frac{-2}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x \cdot \left(c \cdot \left(s \cdot \left(s \cdot \left(x \cdot c\right)\right)\right)\right)}\\ \end{array} \]
          9. Add Preprocessing

          Alternative 15: 36.7% accurate, 17.4× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;s \leq 9.2 \cdot 10^{-29}:\\ \;\;\;\;\frac{0 - 2}{s \cdot \left(c \cdot \left(s \cdot c\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{c \cdot \left(c \cdot \left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right)\right)}\\ \end{array} \end{array} \]
          (FPCore (x c s)
           :precision binary64
           (if (<= s 9.2e-29)
             (/ (- 0.0 2.0) (* s (* c (* s c))))
             (/ 1.0 (* c (* c (* s (* s (* x x))))))))
          double code(double x, double c, double s) {
          	double tmp;
          	if (s <= 9.2e-29) {
          		tmp = (0.0 - 2.0) / (s * (c * (s * c)));
          	} else {
          		tmp = 1.0 / (c * (c * (s * (s * (x * x)))));
          	}
          	return tmp;
          }
          
          real(8) function code(x, c, s)
              real(8), intent (in) :: x
              real(8), intent (in) :: c
              real(8), intent (in) :: s
              real(8) :: tmp
              if (s <= 9.2d-29) then
                  tmp = (0.0d0 - 2.0d0) / (s * (c * (s * c)))
              else
                  tmp = 1.0d0 / (c * (c * (s * (s * (x * x)))))
              end if
              code = tmp
          end function
          
          public static double code(double x, double c, double s) {
          	double tmp;
          	if (s <= 9.2e-29) {
          		tmp = (0.0 - 2.0) / (s * (c * (s * c)));
          	} else {
          		tmp = 1.0 / (c * (c * (s * (s * (x * x)))));
          	}
          	return tmp;
          }
          
          def code(x, c, s):
          	tmp = 0
          	if s <= 9.2e-29:
          		tmp = (0.0 - 2.0) / (s * (c * (s * c)))
          	else:
          		tmp = 1.0 / (c * (c * (s * (s * (x * x)))))
          	return tmp
          
          function code(x, c, s)
          	tmp = 0.0
          	if (s <= 9.2e-29)
          		tmp = Float64(Float64(0.0 - 2.0) / Float64(s * Float64(c * Float64(s * c))));
          	else
          		tmp = Float64(1.0 / Float64(c * Float64(c * Float64(s * Float64(s * Float64(x * x))))));
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, c, s)
          	tmp = 0.0;
          	if (s <= 9.2e-29)
          		tmp = (0.0 - 2.0) / (s * (c * (s * c)));
          	else
          		tmp = 1.0 / (c * (c * (s * (s * (x * x)))));
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, c_, s_] := If[LessEqual[s, 9.2e-29], N[(N[(0.0 - 2.0), $MachinePrecision] / N[(s * N[(c * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(c * N[(c * N[(s * N[(s * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;s \leq 9.2 \cdot 10^{-29}:\\
          \;\;\;\;\frac{0 - 2}{s \cdot \left(c \cdot \left(s \cdot c\right)\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{1}{c \cdot \left(c \cdot \left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right)\right)}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if s < 9.19999999999999965e-29

            1. Initial program 62.8%

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

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

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
              4. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
              5. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
              7. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
              8. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
              9. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
              11. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
              12. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
              13. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
              15. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
              16. associate-*l*N/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
              18. *-lowering-*.f6480.1%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
            3. Simplified80.1%

              \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
            4. Add Preprocessing
            5. Step-by-step derivation
              1. associate-/l/N/A

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

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right)}}{x} \]
              3. *-commutativeN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right)}}{x} \]
              4. swap-sqrN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot s\right) \cdot \left(c \cdot c\right)\right)}}{x} \]
              5. unpow2N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot \left(c \cdot c\right)\right)}}{x} \]
              6. unpow2N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot {c}^{2}\right)}}{x} \]
              7. associate-*r*N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot {c}^{2}}}{x} \]
              8. *-commutativeN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot {s}^{2}\right)}}{x} \]
              9. associate-/r*N/A

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

                \[\leadsto \frac{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{{s}^{2}}}{x} \]
              11. associate-/r*N/A

                \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\color{blue}{{s}^{2} \cdot x}} \]
              12. unpow2N/A

                \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\left(s \cdot s\right) \cdot x} \]
              13. associate-*l*N/A

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

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

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

                \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{s}\right), \color{blue}{\left(x \cdot s\right)}\right) \]
            6. Applied egg-rr77.2%

              \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot c\right)}}{s}}{x \cdot s}} \]
            7. Taylor expanded in x around 0

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{x}^{2}}{{c}^{2} \cdot s} + \frac{1}{{c}^{2} \cdot s}\right), x\right), \mathsf{*.f64}\left(\color{blue}{x}, s\right)\right) \]
            9. Simplified48.6%

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

              \[\leadsto \color{blue}{\frac{-2}{{c}^{2} \cdot {s}^{2}}} \]
            11. Step-by-step derivation
              1. /-lowering-/.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right) \]
              2. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right) \]
              3. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right) \]
              4. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left(s \cdot \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right) \]
              5. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right) \]
              6. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right) \]
              7. associate-*l*N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \left(c \cdot \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \]
              8. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \]
              9. *-lowering-*.f6424.2%

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right) \]
            12. Simplified24.2%

              \[\leadsto \color{blue}{\frac{-2}{s \cdot \left(c \cdot \left(c \cdot s\right)\right)}} \]
            13. Step-by-step derivation
              1. frac-2negN/A

                \[\leadsto \frac{\mathsf{neg}\left(-2\right)}{\color{blue}{\mathsf{neg}\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)}} \]
              2. metadata-evalN/A

                \[\leadsto \frac{2}{\mathsf{neg}\left(\color{blue}{s \cdot \left(c \cdot \left(c \cdot s\right)\right)}\right)} \]
              3. /-lowering-/.f64N/A

                \[\leadsto \mathsf{/.f64}\left(2, \color{blue}{\left(\mathsf{neg}\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}\right) \]
              4. neg-sub0N/A

                \[\leadsto \mathsf{/.f64}\left(2, \left(0 - \color{blue}{s \cdot \left(c \cdot \left(c \cdot s\right)\right)}\right)\right) \]
              5. --lowering--.f64N/A

                \[\leadsto \mathsf{/.f64}\left(2, \mathsf{\_.f64}\left(0, \color{blue}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)}\right)\right) \]
              6. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(2, \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(s, \color{blue}{\left(c \cdot \left(c \cdot s\right)\right)}\right)\right)\right) \]
              7. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(2, \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(s, \left(c \cdot \left(s \cdot \color{blue}{c}\right)\right)\right)\right)\right) \]
              8. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(2, \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(s \cdot c\right)}\right)\right)\right)\right) \]
              9. *-lowering-*.f6440.7%

                \[\leadsto \mathsf{/.f64}\left(2, \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right)\right)\right) \]
            14. Applied egg-rr40.7%

              \[\leadsto \color{blue}{\frac{2}{0 - s \cdot \left(c \cdot \left(s \cdot c\right)\right)}} \]

            if 9.19999999999999965e-29 < s

            1. Initial program 70.4%

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

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

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
              4. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
              5. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
              7. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
              8. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
              9. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
              11. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
              12. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
              13. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
              15. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
              16. associate-*l*N/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
              18. *-lowering-*.f6488.0%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
            3. Simplified88.0%

              \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
            4. Add Preprocessing
            5. Step-by-step derivation
              1. associate-/r*N/A

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

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
              3. associate-*r*N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
              4. *-commutativeN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
              5. associate-*l*N/A

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

                \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
              7. *-commutativeN/A

                \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
              8. /-lowering-/.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
              9. /-lowering-/.f64N/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              11. count-2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              12. cos-lowering-cos.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              13. count-2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              14. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              15. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              16. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              17. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
              18. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
              19. *-lowering-*.f6498.5%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
            6. Applied egg-rr98.5%

              \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
            7. Taylor expanded in x around 0

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

                \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left({c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)\right)}\right) \]
              2. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(1, \left(\left(c \cdot c\right) \cdot \left(\color{blue}{{s}^{2}} \cdot {x}^{2}\right)\right)\right) \]
              3. associate-*l*N/A

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

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

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{\left({s}^{2} \cdot {x}^{2}\right)}\right)\right)\right) \]
              6. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(\left(s \cdot s\right) \cdot {\color{blue}{x}}^{2}\right)\right)\right)\right) \]
              7. associate-*l*N/A

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

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

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

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \left(x \cdot \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
              11. *-lowering-*.f6476.4%

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
            9. Simplified76.4%

              \[\leadsto \color{blue}{\frac{1}{c \cdot \left(c \cdot \left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right)\right)}} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification39.1%

            \[\leadsto \begin{array}{l} \mathbf{if}\;s \leq 9.2 \cdot 10^{-29}:\\ \;\;\;\;\frac{0 - 2}{s \cdot \left(c \cdot \left(s \cdot c\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{c \cdot \left(c \cdot \left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right)\right)}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 16: 28.1% accurate, 19.5× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.78:\\ \;\;\;\;\frac{0 - 2}{s \cdot \left(c \cdot \left(s \cdot c\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}\\ \end{array} \end{array} \]
          (FPCore (x c s)
           :precision binary64
           (if (<= x 0.78)
             (/ (- 0.0 2.0) (* s (* c (* s c))))
             (/ -2.0 (* c (* c (* s s))))))
          double code(double x, double c, double s) {
          	double tmp;
          	if (x <= 0.78) {
          		tmp = (0.0 - 2.0) / (s * (c * (s * c)));
          	} else {
          		tmp = -2.0 / (c * (c * (s * s)));
          	}
          	return tmp;
          }
          
          real(8) function code(x, c, s)
              real(8), intent (in) :: x
              real(8), intent (in) :: c
              real(8), intent (in) :: s
              real(8) :: tmp
              if (x <= 0.78d0) then
                  tmp = (0.0d0 - 2.0d0) / (s * (c * (s * c)))
              else
                  tmp = (-2.0d0) / (c * (c * (s * s)))
              end if
              code = tmp
          end function
          
          public static double code(double x, double c, double s) {
          	double tmp;
          	if (x <= 0.78) {
          		tmp = (0.0 - 2.0) / (s * (c * (s * c)));
          	} else {
          		tmp = -2.0 / (c * (c * (s * s)));
          	}
          	return tmp;
          }
          
          def code(x, c, s):
          	tmp = 0
          	if x <= 0.78:
          		tmp = (0.0 - 2.0) / (s * (c * (s * c)))
          	else:
          		tmp = -2.0 / (c * (c * (s * s)))
          	return tmp
          
          function code(x, c, s)
          	tmp = 0.0
          	if (x <= 0.78)
          		tmp = Float64(Float64(0.0 - 2.0) / Float64(s * Float64(c * Float64(s * c))));
          	else
          		tmp = Float64(-2.0 / Float64(c * Float64(c * Float64(s * s))));
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, c, s)
          	tmp = 0.0;
          	if (x <= 0.78)
          		tmp = (0.0 - 2.0) / (s * (c * (s * c)));
          	else
          		tmp = -2.0 / (c * (c * (s * s)));
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, c_, s_] := If[LessEqual[x, 0.78], N[(N[(0.0 - 2.0), $MachinePrecision] / N[(s * N[(c * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 / N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;x \leq 0.78:\\
          \;\;\;\;\frac{0 - 2}{s \cdot \left(c \cdot \left(s \cdot c\right)\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{-2}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if x < 0.78000000000000003

            1. Initial program 62.6%

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

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

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
              4. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
              5. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
              7. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
              8. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
              9. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
              11. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
              12. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
              13. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
              15. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
              16. associate-*l*N/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
              18. *-lowering-*.f6481.4%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
            3. Simplified81.4%

              \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
            4. Add Preprocessing
            5. Step-by-step derivation
              1. associate-/l/N/A

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

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right)}}{x} \]
              3. *-commutativeN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right)}}{x} \]
              4. swap-sqrN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot s\right) \cdot \left(c \cdot c\right)\right)}}{x} \]
              5. unpow2N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot \left(c \cdot c\right)\right)}}{x} \]
              6. unpow2N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot {c}^{2}\right)}}{x} \]
              7. associate-*r*N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot {c}^{2}}}{x} \]
              8. *-commutativeN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot {s}^{2}\right)}}{x} \]
              9. associate-/r*N/A

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

                \[\leadsto \frac{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{{s}^{2}}}{x} \]
              11. associate-/r*N/A

                \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\color{blue}{{s}^{2} \cdot x}} \]
              12. unpow2N/A

                \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\left(s \cdot s\right) \cdot x} \]
              13. associate-*l*N/A

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

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

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

                \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{s}\right), \color{blue}{\left(x \cdot s\right)}\right) \]
            6. Applied egg-rr75.7%

              \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot c\right)}}{s}}{x \cdot s}} \]
            7. Taylor expanded in x around 0

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{x}^{2}}{{c}^{2} \cdot s} + \frac{1}{{c}^{2} \cdot s}\right), x\right), \mathsf{*.f64}\left(\color{blue}{x}, s\right)\right) \]
            9. Simplified54.5%

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

              \[\leadsto \color{blue}{\frac{-2}{{c}^{2} \cdot {s}^{2}}} \]
            11. Step-by-step derivation
              1. /-lowering-/.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right) \]
              2. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right) \]
              3. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right) \]
              4. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left(s \cdot \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right) \]
              5. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right) \]
              6. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right) \]
              7. associate-*l*N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \left(c \cdot \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \]
              8. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \]
              9. *-lowering-*.f6423.2%

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right) \]
            12. Simplified23.2%

              \[\leadsto \color{blue}{\frac{-2}{s \cdot \left(c \cdot \left(c \cdot s\right)\right)}} \]
            13. Step-by-step derivation
              1. frac-2negN/A

                \[\leadsto \frac{\mathsf{neg}\left(-2\right)}{\color{blue}{\mathsf{neg}\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)}} \]
              2. metadata-evalN/A

                \[\leadsto \frac{2}{\mathsf{neg}\left(\color{blue}{s \cdot \left(c \cdot \left(c \cdot s\right)\right)}\right)} \]
              3. /-lowering-/.f64N/A

                \[\leadsto \mathsf{/.f64}\left(2, \color{blue}{\left(\mathsf{neg}\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}\right) \]
              4. neg-sub0N/A

                \[\leadsto \mathsf{/.f64}\left(2, \left(0 - \color{blue}{s \cdot \left(c \cdot \left(c \cdot s\right)\right)}\right)\right) \]
              5. --lowering--.f64N/A

                \[\leadsto \mathsf{/.f64}\left(2, \mathsf{\_.f64}\left(0, \color{blue}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)}\right)\right) \]
              6. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(2, \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(s, \color{blue}{\left(c \cdot \left(c \cdot s\right)\right)}\right)\right)\right) \]
              7. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(2, \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(s, \left(c \cdot \left(s \cdot \color{blue}{c}\right)\right)\right)\right)\right) \]
              8. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(2, \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(s \cdot c\right)}\right)\right)\right)\right) \]
              9. *-lowering-*.f6442.5%

                \[\leadsto \mathsf{/.f64}\left(2, \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right)\right)\right) \]
            14. Applied egg-rr42.5%

              \[\leadsto \color{blue}{\frac{2}{0 - s \cdot \left(c \cdot \left(s \cdot c\right)\right)}} \]

            if 0.78000000000000003 < x

            1. Initial program 71.4%

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

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

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
              4. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
              5. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
              7. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
              8. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
              9. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
              11. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
              12. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
              13. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
              15. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
              16. associate-*l*N/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
              18. *-lowering-*.f6484.8%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
            3. Simplified84.8%

              \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
            4. Add Preprocessing
            5. Step-by-step derivation
              1. associate-/l/N/A

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

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right)}}{x} \]
              3. *-commutativeN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right)}}{x} \]
              4. swap-sqrN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot s\right) \cdot \left(c \cdot c\right)\right)}}{x} \]
              5. unpow2N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot \left(c \cdot c\right)\right)}}{x} \]
              6. unpow2N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot {c}^{2}\right)}}{x} \]
              7. associate-*r*N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot {c}^{2}}}{x} \]
              8. *-commutativeN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot {s}^{2}\right)}}{x} \]
              9. associate-/r*N/A

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

                \[\leadsto \frac{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{{s}^{2}}}{x} \]
              11. associate-/r*N/A

                \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\color{blue}{{s}^{2} \cdot x}} \]
              12. unpow2N/A

                \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\left(s \cdot s\right) \cdot x} \]
              13. associate-*l*N/A

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

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

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

                \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{s}\right), \color{blue}{\left(x \cdot s\right)}\right) \]
            6. Applied egg-rr84.1%

              \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot c\right)}}{s}}{x \cdot s}} \]
            7. Taylor expanded in x around 0

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{x}^{2}}{{c}^{2} \cdot s} + \frac{1}{{c}^{2} \cdot s}\right), x\right), \mathsf{*.f64}\left(\color{blue}{x}, s\right)\right) \]
            9. Simplified30.8%

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

              \[\leadsto \color{blue}{\frac{-2}{{c}^{2} \cdot {s}^{2}}} \]
            11. Step-by-step derivation
              1. /-lowering-/.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right) \]
              2. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right) \]
              3. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right) \]
              4. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left(s \cdot \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right) \]
              5. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right) \]
              6. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right) \]
              7. associate-*l*N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \left(c \cdot \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \]
              8. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \]
              9. *-lowering-*.f6439.1%

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right) \]
            12. Simplified39.1%

              \[\leadsto \color{blue}{\frac{-2}{s \cdot \left(c \cdot \left(c \cdot s\right)\right)}} \]
            13. Taylor expanded in s around 0

              \[\leadsto \mathsf{/.f64}\left(-2, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right) \]
            14. Step-by-step derivation
              1. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left(\left(c \cdot c\right) \cdot {\color{blue}{s}}^{2}\right)\right) \]
              2. associate-*l*N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left(c \cdot \color{blue}{\left(c \cdot {s}^{2}\right)}\right)\right) \]
              3. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot {s}^{2}\right)}\right)\right) \]
              4. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{\left({s}^{2}\right)}\right)\right)\right) \]
              5. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(s \cdot \color{blue}{s}\right)\right)\right)\right) \]
              6. *-lowering-*.f6441.7%

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \color{blue}{s}\right)\right)\right)\right) \]
            15. Simplified41.7%

              \[\leadsto \frac{-2}{\color{blue}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification28.1%

            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.78:\\ \;\;\;\;\frac{0 - 2}{s \cdot \left(c \cdot \left(s \cdot c\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 17: 77.8% accurate, 20.9× speedup?

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
            4. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
            5. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
            7. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
            8. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
            9. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
            11. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
            12. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
            13. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
            15. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
            16. associate-*l*N/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
            18. *-lowering-*.f6482.3%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
          3. Simplified82.3%

            \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
          4. Add Preprocessing
          5. Step-by-step derivation
            1. associate-/r*N/A

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

              \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
            3. associate-*r*N/A

              \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
            4. *-commutativeN/A

              \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
            5. associate-*l*N/A

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

              \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
            7. *-commutativeN/A

              \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
            8. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
            9. /-lowering-/.f64N/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
            11. count-2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
            12. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
            13. count-2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
            14. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
            17. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
            18. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
            19. *-lowering-*.f6497.8%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
          6. Applied egg-rr97.8%

            \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
          7. Taylor expanded in x around 0

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

              \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left({c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)\right)}\right) \]
            2. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(c \cdot c\right) \cdot \left(\color{blue}{{s}^{2}} \cdot {x}^{2}\right)\right)\right) \]
            3. associate-*l*N/A

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

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

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{\left({s}^{2} \cdot {x}^{2}\right)}\right)\right)\right) \]
            6. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(\left(s \cdot s\right) \cdot {\color{blue}{x}}^{2}\right)\right)\right)\right) \]
            7. associate-*l*N/A

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

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

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

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \left(x \cdot \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
            11. *-lowering-*.f6464.6%

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
          9. Simplified64.6%

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

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

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(s \cdot \left(s \cdot \left(x \cdot x\right)\right)\right) \cdot \color{blue}{\left(c \cdot c\right)}\right)\right) \]
            3. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(\left(s \cdot s\right) \cdot \left(x \cdot x\right)\right) \cdot \left(\color{blue}{c} \cdot c\right)\right)\right) \]
            4. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(\left(x \cdot x\right) \cdot \left(s \cdot s\right)\right) \cdot \left(\color{blue}{c} \cdot c\right)\right)\right) \]
            5. swap-sqrN/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right) \cdot \left(\color{blue}{c} \cdot c\right)\right)\right) \]
            6. swap-sqrN/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(\left(x \cdot s\right) \cdot c\right) \cdot \color{blue}{\left(\left(x \cdot s\right) \cdot c\right)}\right)\right) \]
            7. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(x \cdot \left(s \cdot c\right)\right) \cdot \left(\color{blue}{\left(x \cdot s\right)} \cdot c\right)\right)\right) \]
            8. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\left(x \cdot \left(s \cdot c\right)\right) \cdot \left(x \cdot \color{blue}{\left(s \cdot c\right)}\right)\right)\right) \]
            9. associate-*r*N/A

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

              \[\leadsto \mathsf{/.f64}\left(1, \left(x \cdot \left(\left(c \cdot s\right) \cdot \left(\color{blue}{x} \cdot \left(s \cdot c\right)\right)\right)\right)\right) \]
            11. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(x \cdot \left(c \cdot \color{blue}{\left(s \cdot \left(x \cdot \left(s \cdot c\right)\right)\right)}\right)\right)\right) \]
            12. /-rgt-identityN/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{x}{1} \cdot \left(\color{blue}{c} \cdot \left(s \cdot \left(x \cdot \left(s \cdot c\right)\right)\right)\right)\right)\right) \]
            13. associate-/r/N/A

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

              \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{x}{\frac{1}{\left(c \cdot s\right) \cdot \color{blue}{\left(x \cdot \left(s \cdot c\right)\right)}}}\right)\right) \]
            15. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{x}{\frac{\frac{1}{s \cdot c}}{\color{blue}{x \cdot \left(s \cdot c\right)}}}\right)\right) \]
            17. inv-powN/A

              \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{x}{\frac{{\left(s \cdot c\right)}^{-1}}{\color{blue}{x} \cdot \left(s \cdot c\right)}}\right)\right) \]
            18. associate-/r/N/A

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

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\left(\frac{x}{{\left(s \cdot c\right)}^{-1}}\right), \color{blue}{\left(x \cdot \left(s \cdot c\right)\right)}\right)\right) \]
          11. Applied egg-rr78.2%

            \[\leadsto \frac{1}{\color{blue}{\frac{x}{\frac{1}{s \cdot c}} \cdot \left(x \cdot \left(s \cdot c\right)\right)}} \]
          12. Final simplification78.2%

            \[\leadsto \frac{1}{\left(x \cdot \left(s \cdot c\right)\right) \cdot \frac{x}{\frac{1}{s \cdot c}}} \]
          13. Add Preprocessing

          Alternative 18: 77.8% accurate, 20.9× speedup?

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
            4. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
            5. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
            7. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
            8. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
            9. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
            11. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
            12. associate-*r*N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
            13. *-commutativeN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
            15. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
            16. associate-*l*N/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
            18. *-lowering-*.f6482.3%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
          3. Simplified82.3%

            \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
          4. Add Preprocessing
          5. Taylor expanded in x around 0

            \[\leadsto \mathsf{/.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, s\right)\right)\right)\right)\right)\right) \]
          6. Step-by-step derivation
            1. Simplified69.1%

              \[\leadsto \frac{\color{blue}{1}}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)} \]
            2. Step-by-step derivation
              1. remove-double-divN/A

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

                \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\frac{\frac{1}{x}}{\color{blue}{x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)}}}\right)\right) \]
              3. clear-numN/A

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

                \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{x \cdot \left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right)}{\frac{1}{x}}\right)\right) \]
              5. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{x \cdot \left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right)}{\frac{1}{x}}\right)\right) \]
              6. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot \left(s \cdot c\right)\right) \cdot \left(s \cdot c\right)}{\frac{\color{blue}{1}}{x}}\right)\right) \]
              7. associate-/l*N/A

                \[\leadsto \mathsf{/.f64}\left(1, \left(\left(x \cdot \left(s \cdot c\right)\right) \cdot \color{blue}{\frac{s \cdot c}{\frac{1}{x}}}\right)\right) \]
              8. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\left(x \cdot \left(s \cdot c\right)\right), \color{blue}{\left(\frac{s \cdot c}{\frac{1}{x}}\right)}\right)\right) \]
              9. *-lowering-*.f64N/A

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

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right), \left(\frac{s \cdot \color{blue}{c}}{\frac{1}{x}}\right)\right)\right) \]
              11. /-lowering-/.f64N/A

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right), \mathsf{/.f64}\left(\left(s \cdot c\right), \color{blue}{\left(\frac{1}{x}\right)}\right)\right)\right) \]
              12. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(s, c\right), \left(\frac{\color{blue}{1}}{x}\right)\right)\right)\right) \]
              13. /-lowering-/.f6478.2%

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(s, c\right), \mathsf{/.f64}\left(1, \color{blue}{x}\right)\right)\right)\right) \]
            3. Applied egg-rr78.2%

              \[\leadsto \frac{1}{\color{blue}{\left(x \cdot \left(s \cdot c\right)\right) \cdot \frac{s \cdot c}{\frac{1}{x}}}} \]
            4. Add Preprocessing

            Alternative 19: 76.9% accurate, 24.1× speedup?

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

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

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

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
              4. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
              5. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
              7. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
              8. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
              9. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
              11. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
              12. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
              13. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
              15. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
              16. associate-*l*N/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
              18. *-lowering-*.f6482.3%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
            3. Simplified82.3%

              \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
            4. Add Preprocessing
            5. Step-by-step derivation
              1. associate-/r*N/A

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

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
              3. associate-*r*N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
              4. *-commutativeN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
              5. associate-*l*N/A

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

                \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
              7. *-commutativeN/A

                \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
              8. /-lowering-/.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
              9. /-lowering-/.f64N/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              11. count-2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              12. cos-lowering-cos.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              13. count-2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              14. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              15. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              16. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              17. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
              18. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
              19. *-lowering-*.f6497.8%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
            6. Applied egg-rr97.8%

              \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
            7. Taylor expanded in x around 0

              \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{1}{c \cdot \left(s \cdot x\right)}\right)}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
            8. Step-by-step derivation
              1. /-lowering-/.f64N/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\left(c \cdot s\right) \cdot x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
              3. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\left(s \cdot c\right) \cdot x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
              4. associate-*l*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(s \cdot \left(c \cdot x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
              5. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(s, \left(c \cdot x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
              6. *-lowering-*.f6477.5%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, c\right)\right)\right) \]
            9. Simplified77.5%

              \[\leadsto \frac{\color{blue}{\frac{1}{s \cdot \left(c \cdot x\right)}}}{x \cdot \left(s \cdot c\right)} \]
            10. Final simplification77.5%

              \[\leadsto \frac{\frac{1}{s \cdot \left(x \cdot c\right)}}{x \cdot \left(s \cdot c\right)} \]
            11. Add Preprocessing

            Alternative 20: 72.3% accurate, 24.1× speedup?

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

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

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

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
              4. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
              5. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
              7. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
              8. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
              9. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
              11. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
              12. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
              13. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
              15. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
              16. associate-*l*N/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
              18. *-lowering-*.f6482.3%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
            3. Simplified82.3%

              \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
            4. Add Preprocessing
            5. Step-by-step derivation
              1. associate-/r*N/A

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

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right) \cdot \color{blue}{x}} \]
              3. associate-*r*N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
              4. *-commutativeN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x}}{\left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right) \cdot x} \]
              5. associate-*l*N/A

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

                \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
              7. *-commutativeN/A

                \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}}{x \cdot \color{blue}{\left(c \cdot s\right)}} \]
              8. /-lowering-/.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s}\right), \color{blue}{\left(x \cdot \left(c \cdot s\right)\right)}\right) \]
              9. /-lowering-/.f64N/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(2 \cdot x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              11. count-2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cos \left(x + x\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              12. cos-lowering-cos.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(x + x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              13. count-2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\left(2 \cdot x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              14. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(c \cdot s\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              15. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \left(s \cdot c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              16. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \left(x \cdot \left(c \cdot s\right)\right)\right) \]
              17. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(c \cdot s\right)}\right)\right) \]
              18. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \left(s \cdot \color{blue}{c}\right)\right)\right) \]
              19. *-lowering-*.f6497.8%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), x\right), \mathsf{*.f64}\left(s, c\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{c}\right)\right)\right) \]
            6. Applied egg-rr97.8%

              \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s \cdot c}}{x \cdot \left(s \cdot c\right)}} \]
            7. Taylor expanded in x around 0

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

                \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left({c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)\right)}\right) \]
              2. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(1, \left(\left(c \cdot c\right) \cdot \left(\color{blue}{{s}^{2}} \cdot {x}^{2}\right)\right)\right) \]
              3. associate-*l*N/A

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

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

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{\left({s}^{2} \cdot {x}^{2}\right)}\right)\right)\right) \]
              6. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(\left(s \cdot s\right) \cdot {\color{blue}{x}}^{2}\right)\right)\right)\right) \]
              7. associate-*l*N/A

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

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

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

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \left(x \cdot \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
              11. *-lowering-*.f6464.6%

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right)\right)\right)\right) \]
            9. Simplified64.6%

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

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

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(\left(x \cdot x\right) \cdot \color{blue}{\left(s \cdot s\right)}\right)\right)\right)\right) \]
              3. swap-sqrN/A

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

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(\left(x \cdot s\right), \color{blue}{\left(x \cdot s\right)}\right)\right)\right)\right) \]
              5. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, s\right), \left(\color{blue}{x} \cdot s\right)\right)\right)\right)\right) \]
              6. *-lowering-*.f6472.0%

                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, s\right), \mathsf{*.f64}\left(x, \color{blue}{s}\right)\right)\right)\right)\right) \]
            11. Applied egg-rr72.0%

              \[\leadsto \frac{1}{c \cdot \left(c \cdot \color{blue}{\left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)}\right)} \]
            12. Add Preprocessing

            Alternative 21: 28.8% accurate, 34.8× speedup?

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

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

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

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left({\color{blue}{c}}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)\right) \]
              4. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \left(\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right) \cdot \color{blue}{x}\right)\right) \]
              5. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot \left(x \cdot {s}^{2}\right)\right)}\right)\right) \]
              7. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left({s}^{2} \cdot \color{blue}{x}\right)\right)\right)\right) \]
              8. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot {s}^{2}\right) \cdot \color{blue}{x}\right)\right)\right) \]
              9. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right)\right)\right) \]
              11. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right) \]
              12. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right)\right)\right) \]
              13. *-commutativeN/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right)\right)\right) \]
              15. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right)\right)\right) \]
              16. associate-*l*N/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right)\right)\right) \]
              18. *-lowering-*.f6482.3%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(2, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right)\right)\right) \]
            3. Simplified82.3%

              \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)\right)}} \]
            4. Add Preprocessing
            5. Step-by-step derivation
              1. associate-/l/N/A

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

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(c \cdot s\right)\right)}}{x} \]
              3. *-commutativeN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot c\right) \cdot \left(s \cdot c\right)\right)}}{x} \]
              4. swap-sqrN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(s \cdot s\right) \cdot \left(c \cdot c\right)\right)}}{x} \]
              5. unpow2N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot \left(c \cdot c\right)\right)}}{x} \]
              6. unpow2N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left({s}^{2} \cdot {c}^{2}\right)}}{x} \]
              7. associate-*r*N/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot {c}^{2}}}{x} \]
              8. *-commutativeN/A

                \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot {s}^{2}\right)}}{x} \]
              9. associate-/r*N/A

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

                \[\leadsto \frac{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{{s}^{2}}}{x} \]
              11. associate-/r*N/A

                \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\color{blue}{{s}^{2} \cdot x}} \]
              12. unpow2N/A

                \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{\left(s \cdot s\right) \cdot x} \]
              13. associate-*l*N/A

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

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

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

                \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{{c}^{2}}}{x}}{s}\right), \color{blue}{\left(x \cdot s\right)}\right) \]
            6. Applied egg-rr77.9%

              \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot c\right)}}{s}}{x \cdot s}} \]
            7. Taylor expanded in x around 0

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{x}^{2}}{{c}^{2} \cdot s} + \frac{1}{{c}^{2} \cdot s}\right), x\right), \mathsf{*.f64}\left(\color{blue}{x}, s\right)\right) \]
            9. Simplified48.2%

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

              \[\leadsto \color{blue}{\frac{-2}{{c}^{2} \cdot {s}^{2}}} \]
            11. Step-by-step derivation
              1. /-lowering-/.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right) \]
              2. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left({c}^{2} \cdot \left(s \cdot \color{blue}{s}\right)\right)\right) \]
              3. associate-*r*N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left(\left({c}^{2} \cdot s\right) \cdot \color{blue}{s}\right)\right) \]
              4. *-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left(s \cdot \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right) \]
              5. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \color{blue}{\left({c}^{2} \cdot s\right)}\right)\right) \]
              6. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \left(\left(c \cdot c\right) \cdot s\right)\right)\right) \]
              7. associate-*l*N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \left(c \cdot \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \]
              8. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot s\right)}\right)\right)\right) \]
              9. *-lowering-*.f6427.4%

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(s, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{s}\right)\right)\right)\right) \]
            12. Simplified27.4%

              \[\leadsto \color{blue}{\frac{-2}{s \cdot \left(c \cdot \left(c \cdot s\right)\right)}} \]
            13. Taylor expanded in s around 0

              \[\leadsto \mathsf{/.f64}\left(-2, \color{blue}{\left({c}^{2} \cdot {s}^{2}\right)}\right) \]
            14. Step-by-step derivation
              1. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left(\left(c \cdot c\right) \cdot {\color{blue}{s}}^{2}\right)\right) \]
              2. associate-*l*N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \left(c \cdot \color{blue}{\left(c \cdot {s}^{2}\right)}\right)\right) \]
              3. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \color{blue}{\left(c \cdot {s}^{2}\right)}\right)\right) \]
              4. *-lowering-*.f64N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \color{blue}{\left({s}^{2}\right)}\right)\right)\right) \]
              5. unpow2N/A

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \left(s \cdot \color{blue}{s}\right)\right)\right)\right) \]
              6. *-lowering-*.f6431.1%

                \[\leadsto \mathsf{/.f64}\left(-2, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(c, \mathsf{*.f64}\left(s, \color{blue}{s}\right)\right)\right)\right) \]
            15. Simplified31.1%

              \[\leadsto \frac{-2}{\color{blue}{c \cdot \left(c \cdot \left(s \cdot s\right)\right)}} \]
            16. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 2024163 
            (FPCore (x c s)
              :name "mixedcos"
              :precision binary64
              (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))