Average Error: 28.6 → 2.4
Time: 18.8s
Precision: binary64
Cost: 7888
\[ \begin{array}{c}[c, s] = \mathsf{sort}([c, s])\\ \end{array} \]
\[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
\[\begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ t_1 := \cos \left(2 \cdot x\right)\\ t_2 := s \cdot \left(x \cdot c\right)\\ t_3 := \frac{1}{t_2} \cdot \frac{\cos \left(x + x\right)}{t_2}\\ \mathbf{if}\;s \leq -1 \cdot 10^{-200}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;s \leq 10^{-195}:\\ \;\;\;\;\frac{t_1}{x \cdot \left(\left(c \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)\right)}\\ \mathbf{elif}\;s \leq 5.254182057873494 \cdot 10^{+163}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;s \leq 6.617913438541177 \cdot 10^{+303}:\\ \;\;\;\;\frac{t_1}{t_0 \cdot t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t_1}{\left(x \cdot x\right) \cdot \left(c \cdot \left(c \cdot s\right)\right)}}{s}\\ \end{array} \]
(FPCore (x c s)
 :precision binary64
 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* c (* x s)))
        (t_1 (cos (* 2.0 x)))
        (t_2 (* s (* x c)))
        (t_3 (* (/ 1.0 t_2) (/ (cos (+ x x)) t_2))))
   (if (<= s -1e-200)
     t_3
     (if (<= s 1e-195)
       (/ t_1 (* x (* (* c s) (* x (* c s)))))
       (if (<= s 5.254182057873494e+163)
         t_3
         (if (<= s 6.617913438541177e+303)
           (/ t_1 (* t_0 t_0))
           (/ (/ t_1 (* (* x x) (* c (* c s)))) s)))))))
double code(double x, double c, double s) {
	return cos((2.0 * x)) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	double t_1 = cos((2.0 * x));
	double t_2 = s * (x * c);
	double t_3 = (1.0 / t_2) * (cos((x + x)) / t_2);
	double tmp;
	if (s <= -1e-200) {
		tmp = t_3;
	} else if (s <= 1e-195) {
		tmp = t_1 / (x * ((c * s) * (x * (c * s))));
	} else if (s <= 5.254182057873494e+163) {
		tmp = t_3;
	} else if (s <= 6.617913438541177e+303) {
		tmp = t_1 / (t_0 * t_0);
	} else {
		tmp = (t_1 / ((x * x) * (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
    code = cos((2.0d0 * x)) / ((c ** 2.0d0) * ((x * (s ** 2.0d0)) * x))
end function
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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = c * (x * s)
    t_1 = cos((2.0d0 * x))
    t_2 = s * (x * c)
    t_3 = (1.0d0 / t_2) * (cos((x + x)) / t_2)
    if (s <= (-1d-200)) then
        tmp = t_3
    else if (s <= 1d-195) then
        tmp = t_1 / (x * ((c * s) * (x * (c * s))))
    else if (s <= 5.254182057873494d+163) then
        tmp = t_3
    else if (s <= 6.617913438541177d+303) then
        tmp = t_1 / (t_0 * t_0)
    else
        tmp = (t_1 / ((x * x) * (c * (c * s)))) / s
    end if
    code = tmp
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));
}
public static double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	double t_1 = Math.cos((2.0 * x));
	double t_2 = s * (x * c);
	double t_3 = (1.0 / t_2) * (Math.cos((x + x)) / t_2);
	double tmp;
	if (s <= -1e-200) {
		tmp = t_3;
	} else if (s <= 1e-195) {
		tmp = t_1 / (x * ((c * s) * (x * (c * s))));
	} else if (s <= 5.254182057873494e+163) {
		tmp = t_3;
	} else if (s <= 6.617913438541177e+303) {
		tmp = t_1 / (t_0 * t_0);
	} else {
		tmp = (t_1 / ((x * x) * (c * (c * s)))) / s;
	}
	return tmp;
}
def code(x, c, s):
	return math.cos((2.0 * x)) / (math.pow(c, 2.0) * ((x * math.pow(s, 2.0)) * x))
def code(x, c, s):
	t_0 = c * (x * s)
	t_1 = math.cos((2.0 * x))
	t_2 = s * (x * c)
	t_3 = (1.0 / t_2) * (math.cos((x + x)) / t_2)
	tmp = 0
	if s <= -1e-200:
		tmp = t_3
	elif s <= 1e-195:
		tmp = t_1 / (x * ((c * s) * (x * (c * s))))
	elif s <= 5.254182057873494e+163:
		tmp = t_3
	elif s <= 6.617913438541177e+303:
		tmp = t_1 / (t_0 * t_0)
	else:
		tmp = (t_1 / ((x * x) * (c * (c * s)))) / s
	return tmp
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 code(x, c, s)
	t_0 = Float64(c * Float64(x * s))
	t_1 = cos(Float64(2.0 * x))
	t_2 = Float64(s * Float64(x * c))
	t_3 = Float64(Float64(1.0 / t_2) * Float64(cos(Float64(x + x)) / t_2))
	tmp = 0.0
	if (s <= -1e-200)
		tmp = t_3;
	elseif (s <= 1e-195)
		tmp = Float64(t_1 / Float64(x * Float64(Float64(c * s) * Float64(x * Float64(c * s)))));
	elseif (s <= 5.254182057873494e+163)
		tmp = t_3;
	elseif (s <= 6.617913438541177e+303)
		tmp = Float64(t_1 / Float64(t_0 * t_0));
	else
		tmp = Float64(Float64(t_1 / Float64(Float64(x * x) * Float64(c * Float64(c * s)))) / s);
	end
	return tmp
end
function tmp = code(x, c, s)
	tmp = cos((2.0 * x)) / ((c ^ 2.0) * ((x * (s ^ 2.0)) * x));
end
function tmp_2 = code(x, c, s)
	t_0 = c * (x * s);
	t_1 = cos((2.0 * x));
	t_2 = s * (x * c);
	t_3 = (1.0 / t_2) * (cos((x + x)) / t_2);
	tmp = 0.0;
	if (s <= -1e-200)
		tmp = t_3;
	elseif (s <= 1e-195)
		tmp = t_1 / (x * ((c * s) * (x * (c * s))));
	elseif (s <= 5.254182057873494e+163)
		tmp = t_3;
	elseif (s <= 6.617913438541177e+303)
		tmp = t_1 / (t_0 * t_0);
	else
		tmp = (t_1 / ((x * x) * (c * (c * s)))) / s;
	end
	tmp_2 = tmp;
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]
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(1.0 / t$95$2), $MachinePrecision] * N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[s, -1e-200], t$95$3, If[LessEqual[s, 1e-195], N[(t$95$1 / N[(x * N[(N[(c * s), $MachinePrecision] * N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[s, 5.254182057873494e+163], t$95$3, If[LessEqual[s, 6.617913438541177e+303], N[(t$95$1 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[(N[(x * x), $MachinePrecision] * N[(c * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / s), $MachinePrecision]]]]]]]]]
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
t_1 := \cos \left(2 \cdot x\right)\\
t_2 := s \cdot \left(x \cdot c\right)\\
t_3 := \frac{1}{t_2} \cdot \frac{\cos \left(x + x\right)}{t_2}\\
\mathbf{if}\;s \leq -1 \cdot 10^{-200}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;s \leq 10^{-195}:\\
\;\;\;\;\frac{t_1}{x \cdot \left(\left(c \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)\right)}\\

\mathbf{elif}\;s \leq 5.254182057873494 \cdot 10^{+163}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;s \leq 6.617913438541177 \cdot 10^{+303}:\\
\;\;\;\;\frac{t_1}{t_0 \cdot t_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_1}{\left(x \cdot x\right) \cdot \left(c \cdot \left(c \cdot s\right)\right)}}{s}\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if s < -9.9999999999999998e-201 or 1.0000000000000001e-195 < s < 5.2541820578734942e163

    1. Initial program 23.7

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Simplified14.4

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right)\right)}} \]
      Proof
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (*.f64 (*.f64 c s) (*.f64 c s))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (Rewrite<= unswap-sqr_binary64 (*.f64 (*.f64 c c) (*.f64 s s)))))): 83 points increase in error, 5 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 c 2)) (*.f64 s s))))): 0 points increase in error, 1 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (*.f64 (pow.f64 c 2) (Rewrite<= unpow2_binary64 (pow.f64 s 2)))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (Rewrite=> *-commutative_binary64 (*.f64 (pow.f64 s 2) (pow.f64 c 2)))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 x (pow.f64 s 2)) (pow.f64 c 2))))): 8 points increase in error, 15 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (Rewrite<= *-commutative_binary64 (*.f64 (pow.f64 c 2) (*.f64 x (pow.f64 s 2)))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 (pow.f64 c 2) (*.f64 x (pow.f64 s 2))) x))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (Rewrite<= associate-*r*_binary64 (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x)))): 11 points increase in error, 8 points decrease in error
    3. Applied egg-rr0.7

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

    if -9.9999999999999998e-201 < s < 1.0000000000000001e-195

    1. Initial program 64.0

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Simplified21.5

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right)\right)}} \]
      Proof
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (*.f64 (*.f64 c s) (*.f64 c s))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (Rewrite<= unswap-sqr_binary64 (*.f64 (*.f64 c c) (*.f64 s s)))))): 83 points increase in error, 5 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 c 2)) (*.f64 s s))))): 0 points increase in error, 1 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (*.f64 (pow.f64 c 2) (Rewrite<= unpow2_binary64 (pow.f64 s 2)))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (Rewrite=> *-commutative_binary64 (*.f64 (pow.f64 s 2) (pow.f64 c 2)))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 x (pow.f64 s 2)) (pow.f64 c 2))))): 8 points increase in error, 15 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (Rewrite<= *-commutative_binary64 (*.f64 (pow.f64 c 2) (*.f64 x (pow.f64 s 2)))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 (pow.f64 c 2) (*.f64 x (pow.f64 s 2))) x))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (Rewrite<= associate-*r*_binary64 (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x)))): 11 points increase in error, 8 points decrease in error
    3. Applied egg-rr12.3

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{\left(\left(x \cdot c\right) \cdot s\right)}^{2}}} \]
    4. Applied egg-rr10.7

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

    if 5.2541820578734942e163 < s < 6.6179134385411768e303

    1. Initial program 27.7

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Taylor expanded in x around inf 31.2

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)}} \]
    3. Simplified2.8

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \left(s \cdot x\right)\right)}} \]
      Proof
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (*.f64 c (*.f64 s x)) (*.f64 c (*.f64 s x)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (Rewrite<= unswap-sqr_binary64 (*.f64 (*.f64 c c) (*.f64 (*.f64 s x) (*.f64 s x))))): 99 points increase in error, 17 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 c 2)) (*.f64 (*.f64 s x) (*.f64 s x)))): 1 points increase in error, 1 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (Rewrite<= unswap-sqr_binary64 (*.f64 (*.f64 s s) (*.f64 x x))))): 70 points increase in error, 7 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 s 2)) (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (*.f64 (pow.f64 s 2) (Rewrite<= unpow2_binary64 (pow.f64 x 2))))): 0 points increase in error, 0 points decrease in error

    if 6.6179134385411768e303 < s

    1. Initial program 23.2

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Simplified5.9

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(\left(c \cdot s\right) \cdot \left(c \cdot s\right)\right)\right)}} \]
      Proof
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (*.f64 (*.f64 c s) (*.f64 c s))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (Rewrite<= unswap-sqr_binary64 (*.f64 (*.f64 c c) (*.f64 s s)))))): 83 points increase in error, 5 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 c 2)) (*.f64 s s))))): 0 points increase in error, 1 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (*.f64 (pow.f64 c 2) (Rewrite<= unpow2_binary64 (pow.f64 s 2)))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (*.f64 x (Rewrite=> *-commutative_binary64 (*.f64 (pow.f64 s 2) (pow.f64 c 2)))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 x (pow.f64 s 2)) (pow.f64 c 2))))): 8 points increase in error, 15 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 x (Rewrite<= *-commutative_binary64 (*.f64 (pow.f64 c 2) (*.f64 x (pow.f64 s 2)))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 (pow.f64 c 2) (*.f64 x (pow.f64 s 2))) x))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (Rewrite<= associate-*r*_binary64 (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x)))): 11 points increase in error, 8 points decrease in error
    3. Applied egg-rr6.9

      \[\leadsto \color{blue}{\frac{1}{\left(x \cdot c\right) \cdot s} \cdot \frac{\cos \left(x + x\right)}{\left(x \cdot c\right) \cdot s}} \]
    4. Taylor expanded in x around inf 29.7

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{{s}^{2} \cdot \left({c}^{2} \cdot {x}^{2}\right)}} \]
    5. Simplified16.4

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(x \cdot 2\right)}{\left(x \cdot x\right) \cdot \left(c \cdot \left(c \cdot s\right)\right)}}{s}} \]
      Proof
      (/.f64 (/.f64 (cos.f64 (*.f64 x 2)) (*.f64 (*.f64 x x) (*.f64 c (*.f64 c s)))) s): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (cos.f64 (Rewrite<= *-commutative_binary64 (*.f64 2 x))) (*.f64 (*.f64 x x) (*.f64 c (*.f64 c s)))) s): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 x 2)) (*.f64 c (*.f64 c s)))) s): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 x 2) (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 c c) s)))) s): 23 points increase in error, 2 points decrease in error
      (/.f64 (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 x 2) (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 c 2)) s))) s): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (cos.f64 (*.f64 2 x)) (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 (pow.f64 x 2) (pow.f64 c 2)) s))) s): 14 points increase in error, 16 points decrease in error
      (/.f64 (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (Rewrite<= *-commutative_binary64 (*.f64 (pow.f64 c 2) (pow.f64 x 2))) s)) s): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-/r*_binary64 (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (*.f64 (*.f64 (pow.f64 c 2) (pow.f64 x 2)) s) s))): 7 points increase in error, 9 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (Rewrite<= associate-*r*_binary64 (*.f64 (*.f64 (pow.f64 c 2) (pow.f64 x 2)) (*.f64 s s)))): 50 points increase in error, 5 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (*.f64 (pow.f64 c 2) (pow.f64 x 2)) (Rewrite<= unpow2_binary64 (pow.f64 s 2)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (cos.f64 (*.f64 2 x)) (Rewrite<= *-commutative_binary64 (*.f64 (pow.f64 s 2) (*.f64 (pow.f64 c 2) (pow.f64 x 2))))): 0 points increase in error, 0 points decrease in error
  3. Recombined 4 regimes into one program.
  4. Final simplification2.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;s \leq -1 \cdot 10^{-200}:\\ \;\;\;\;\frac{1}{s \cdot \left(x \cdot c\right)} \cdot \frac{\cos \left(x + x\right)}{s \cdot \left(x \cdot c\right)}\\ \mathbf{elif}\;s \leq 10^{-195}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(c \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)\right)}\\ \mathbf{elif}\;s \leq 5.254182057873494 \cdot 10^{+163}:\\ \;\;\;\;\frac{1}{s \cdot \left(x \cdot c\right)} \cdot \frac{\cos \left(x + x\right)}{s \cdot \left(x \cdot c\right)}\\ \mathbf{elif}\;s \leq 6.617913438541177 \cdot 10^{+303}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(c \cdot \left(x \cdot s\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot x\right) \cdot \left(c \cdot \left(c \cdot s\right)\right)}}{s}\\ \end{array} \]

Alternatives

Alternative 1
Error0.9
Cost33540
\[\begin{array}{l} t_0 := \frac{1}{c \cdot \left(x \cdot s\right)}\\ t_1 := \cos \left(x + x\right)\\ \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq \infty:\\ \;\;\;\;\left(t_0 \cdot t_0\right) \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot {\left(x \cdot \left(c \cdot s\right)\right)}^{-2}\\ \end{array} \]
Alternative 2
Error2.1
Cost8012
\[\begin{array}{l} t_0 := \frac{1}{c \cdot \left(x \cdot s\right)}\\ t_1 := \cos \left(x + x\right)\\ t_2 := \frac{1}{s \cdot \left(x \cdot c\right)} \cdot \frac{t_1}{\frac{x \cdot c}{\frac{1}{s}}}\\ \mathbf{if}\;s \leq -1 \cdot 10^{-206}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;s \leq 10^{-195}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(c \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)\right)}\\ \mathbf{elif}\;s \leq 5.447460178572098 \cdot 10^{+193}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\left(t_0 \cdot t_0\right) \cdot t_1\\ \end{array} \]
Alternative 3
Error2.1
Cost8012
\[\begin{array}{l} t_0 := \frac{1}{c \cdot \left(x \cdot s\right)}\\ t_1 := s \cdot \left(x \cdot c\right)\\ t_2 := \cos \left(x + x\right)\\ t_3 := \frac{1}{t_1} \cdot \frac{t_2}{t_1}\\ \mathbf{if}\;s \leq -1 \cdot 10^{-200}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;s \leq 10^{-195}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(c \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)\right)}\\ \mathbf{elif}\;s \leq 5.447460178572098 \cdot 10^{+193}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\left(t_0 \cdot t_0\right) \cdot t_2\\ \end{array} \]
Alternative 4
Error5.2
Cost7888
\[\begin{array}{l} t_0 := \frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(c \cdot s\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)\right)}\\ t_1 := c \cdot \left(x \cdot s\right)\\ t_2 := \frac{\frac{\frac{\cos \left(x \cdot -2\right)}{x}}{c}}{s \cdot t_1}\\ \mathbf{if}\;x \leq -9.924332427065405 \cdot 10^{+203}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1 \cdot 10^{+71}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-123}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 10^{-10}:\\ \;\;\;\;{t_1}^{-2}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Error4.3
Cost7756
\[\begin{array}{l} t_0 := x \cdot \left(c \cdot s\right)\\ t_1 := \cos \left(2 \cdot x\right)\\ t_2 := c \cdot \left(x \cdot s\right)\\ \mathbf{if}\;x \leq -1.2505232442775908 \cdot 10^{+216}:\\ \;\;\;\;\frac{t_1}{x \cdot \left(\left(c \cdot s\right) \cdot t_0\right)}\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-123}:\\ \;\;\;\;\frac{t_1}{\left(c \cdot s\right) \cdot \left(x \cdot t_0\right)}\\ \mathbf{elif}\;x \leq 10^{-10}:\\ \;\;\;\;{t_2}^{-2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{\cos \left(x \cdot -2\right)}{x}}{c}}{s \cdot t_2}\\ \end{array} \]
Alternative 6
Error5.1
Cost7624
\[\begin{array}{l} t_0 := \frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(x \cdot c\right) \cdot \left(s \cdot \left(x \cdot c\right)\right)\right)}\\ \mathbf{if}\;x \leq -5 \cdot 10^{-123}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 5 \cdot 10^{-77}:\\ \;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error5.5
Cost7624
\[\begin{array}{l} t_0 := \frac{\frac{1}{x}}{c \cdot s}\\ t_1 := \frac{\frac{\frac{\cos \left(x \cdot -2\right)}{x}}{c}}{s \cdot \left(c \cdot \left(x \cdot s\right)\right)}\\ \mathbf{if}\;x \leq -1 \cdot 10^{-10}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 10^{-10}:\\ \;\;\;\;t_0 \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error2.4
Cost7624
\[\begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ t_1 := \frac{\cos \left(2 \cdot x\right)}{t_0 \cdot t_0}\\ \mathbf{if}\;s \leq 10^{-148}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;s \leq 1.246057001985802 \cdot 10^{+137}:\\ \;\;\;\;\frac{\cos \left(x \cdot -2\right)}{\left(x \cdot c\right) \cdot \left(\left(s \cdot s\right) \cdot \left(x \cdot c\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error16.5
Cost6916
\[\begin{array}{l} t_0 := \frac{1}{s \cdot \left(x \cdot c\right)}\\ \mathbf{if}\;c \leq -1.1368709955508976 \cdot 10^{+161}:\\ \;\;\;\;t_0 \cdot \left(t_0 + -2 \cdot \frac{x}{c \cdot s}\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\ \end{array} \]
Alternative 10
Error16.5
Cost1604
\[\begin{array}{l} t_0 := \frac{1}{s \cdot \left(x \cdot c\right)}\\ \mathbf{if}\;c \leq -1.1368709955508976 \cdot 10^{+161}:\\ \;\;\;\;t_0 \cdot \left(t_0 + -2 \cdot \frac{x}{c \cdot s}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{c}}{x \cdot s}}{c \cdot \left(x \cdot s\right)}\\ \end{array} \]
Alternative 11
Error16.2
Cost964
\[\begin{array}{l} t_0 := s \cdot \left(x \cdot c\right)\\ \mathbf{if}\;c \leq -5.401648599176778 \cdot 10^{+211}:\\ \;\;\;\;\frac{\frac{1}{t_0}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{c}}{x \cdot s}}{c \cdot \left(x \cdot s\right)}\\ \end{array} \]
Alternative 12
Error17.0
Cost832
\[\frac{\frac{\frac{1}{c}}{x \cdot s}}{c \cdot \left(x \cdot s\right)} \]

Error

Reproduce

herbie shell --seed 2022294 
(FPCore (x c s)
  :name "mixedcos"
  :precision binary64
  (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))