mixedcos

Percentage Accurate: 66.6% → 99.1%
Time: 16.1s
Alternatives: 12
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 12 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: 66.6% 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: 99.1% accurate, 0.7× speedup?

\[\begin{array}{l} c_m = \left|c\right| \\ [x, c_m, s] = \mathsf{sort}([x, c_m, s])\\ \\ \begin{array}{l} t_0 := c_m \cdot \left(x \cdot s\right)\\ t_1 := \cos \left(2 \cdot x\right)\\ t_2 := x \cdot \left(c_m \cdot s\right)\\ \mathbf{if}\;\frac{t_1}{{c_m}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq \infty:\\ \;\;\;\;\frac{1}{t_0} \cdot \frac{t_1}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t_1}{t_2}}{t_2}\\ \end{array} \end{array} \]
c_m = (fabs.f64 c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
(FPCore (x c_m s)
 :precision binary64
 (let* ((t_0 (* c_m (* x s))) (t_1 (cos (* 2.0 x))) (t_2 (* x (* c_m s))))
   (if (<= (/ t_1 (* (pow c_m 2.0) (* x (* x (pow s 2.0))))) INFINITY)
     (* (/ 1.0 t_0) (/ t_1 t_0))
     (/ (/ t_1 t_2) t_2))))
c_m = fabs(c);
assert(x < c_m && c_m < s);
double code(double x, double c_m, double s) {
	double t_0 = c_m * (x * s);
	double t_1 = cos((2.0 * x));
	double t_2 = x * (c_m * s);
	double tmp;
	if ((t_1 / (pow(c_m, 2.0) * (x * (x * pow(s, 2.0))))) <= ((double) INFINITY)) {
		tmp = (1.0 / t_0) * (t_1 / t_0);
	} else {
		tmp = (t_1 / t_2) / t_2;
	}
	return tmp;
}
c_m = Math.abs(c);
assert x < c_m && c_m < s;
public static double code(double x, double c_m, double s) {
	double t_0 = c_m * (x * s);
	double t_1 = Math.cos((2.0 * x));
	double t_2 = x * (c_m * s);
	double tmp;
	if ((t_1 / (Math.pow(c_m, 2.0) * (x * (x * Math.pow(s, 2.0))))) <= Double.POSITIVE_INFINITY) {
		tmp = (1.0 / t_0) * (t_1 / t_0);
	} else {
		tmp = (t_1 / t_2) / t_2;
	}
	return tmp;
}
c_m = math.fabs(c)
[x, c_m, s] = sort([x, c_m, s])
def code(x, c_m, s):
	t_0 = c_m * (x * s)
	t_1 = math.cos((2.0 * x))
	t_2 = x * (c_m * s)
	tmp = 0
	if (t_1 / (math.pow(c_m, 2.0) * (x * (x * math.pow(s, 2.0))))) <= math.inf:
		tmp = (1.0 / t_0) * (t_1 / t_0)
	else:
		tmp = (t_1 / t_2) / t_2
	return tmp
c_m = abs(c)
x, c_m, s = sort([x, c_m, s])
function code(x, c_m, s)
	t_0 = Float64(c_m * Float64(x * s))
	t_1 = cos(Float64(2.0 * x))
	t_2 = Float64(x * Float64(c_m * s))
	tmp = 0.0
	if (Float64(t_1 / Float64((c_m ^ 2.0) * Float64(x * Float64(x * (s ^ 2.0))))) <= Inf)
		tmp = Float64(Float64(1.0 / t_0) * Float64(t_1 / t_0));
	else
		tmp = Float64(Float64(t_1 / t_2) / t_2);
	end
	return tmp
end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp_2 = code(x, c_m, s)
	t_0 = c_m * (x * s);
	t_1 = cos((2.0 * x));
	t_2 = x * (c_m * s);
	tmp = 0.0;
	if ((t_1 / ((c_m ^ 2.0) * (x * (x * (s ^ 2.0))))) <= Inf)
		tmp = (1.0 / t_0) * (t_1 / t_0);
	else
		tmp = (t_1 / t_2) / t_2;
	end
	tmp_2 = tmp;
end
c_m = N[Abs[c], $MachinePrecision]
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s_] := Block[{t$95$0 = N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(c$95$m * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 / N[(N[Power[c$95$m, 2.0], $MachinePrecision] * N[(x * N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(t$95$1 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / t$95$2), $MachinePrecision] / t$95$2), $MachinePrecision]]]]]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\begin{array}{l}
t_0 := c_m \cdot \left(x \cdot s\right)\\
t_1 := \cos \left(2 \cdot x\right)\\
t_2 := x \cdot \left(c_m \cdot s\right)\\
\mathbf{if}\;\frac{t_1}{{c_m}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq \infty:\\
\;\;\;\;\frac{1}{t_0} \cdot \frac{t_1}{t_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_1}{t_2}}{t_2}\\


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 2: 86.6% accurate, 2.7× speedup?

\[\begin{array}{l} c_m = \left|c\right| \\ [x, c_m, s] = \mathsf{sort}([x, c_m, s])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq 3.4 \cdot 10^{-51}:\\ \;\;\;\;\frac{1}{c_m \cdot \left(\left(x \cdot s\right) \cdot \left(c_m \cdot \left(x \cdot s\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\cos \left(2 \cdot x\right)}{s}}{\left(x \cdot \left(c_m \cdot s\right)\right) \cdot \left(x \cdot c_m\right)}\\ \end{array} \end{array} \]
c_m = (fabs.f64 c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
(FPCore (x c_m s)
 :precision binary64
 (if (<= x 3.4e-51)
   (/ 1.0 (* c_m (* (* x s) (* c_m (* x s)))))
   (/ (/ (cos (* 2.0 x)) s) (* (* x (* c_m s)) (* x c_m)))))
c_m = fabs(c);
assert(x < c_m && c_m < s);
double code(double x, double c_m, double s) {
	double tmp;
	if (x <= 3.4e-51) {
		tmp = 1.0 / (c_m * ((x * s) * (c_m * (x * s))));
	} else {
		tmp = (cos((2.0 * x)) / s) / ((x * (c_m * s)) * (x * c_m));
	}
	return tmp;
}
c_m = abs(c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s
    real(8) :: tmp
    if (x <= 3.4d-51) then
        tmp = 1.0d0 / (c_m * ((x * s) * (c_m * (x * s))))
    else
        tmp = (cos((2.0d0 * x)) / s) / ((x * (c_m * s)) * (x * c_m))
    end if
    code = tmp
end function
c_m = Math.abs(c);
assert x < c_m && c_m < s;
public static double code(double x, double c_m, double s) {
	double tmp;
	if (x <= 3.4e-51) {
		tmp = 1.0 / (c_m * ((x * s) * (c_m * (x * s))));
	} else {
		tmp = (Math.cos((2.0 * x)) / s) / ((x * (c_m * s)) * (x * c_m));
	}
	return tmp;
}
c_m = math.fabs(c)
[x, c_m, s] = sort([x, c_m, s])
def code(x, c_m, s):
	tmp = 0
	if x <= 3.4e-51:
		tmp = 1.0 / (c_m * ((x * s) * (c_m * (x * s))))
	else:
		tmp = (math.cos((2.0 * x)) / s) / ((x * (c_m * s)) * (x * c_m))
	return tmp
c_m = abs(c)
x, c_m, s = sort([x, c_m, s])
function code(x, c_m, s)
	tmp = 0.0
	if (x <= 3.4e-51)
		tmp = Float64(1.0 / Float64(c_m * Float64(Float64(x * s) * Float64(c_m * Float64(x * s)))));
	else
		tmp = Float64(Float64(cos(Float64(2.0 * x)) / s) / Float64(Float64(x * Float64(c_m * s)) * Float64(x * c_m)));
	end
	return tmp
end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp_2 = code(x, c_m, s)
	tmp = 0.0;
	if (x <= 3.4e-51)
		tmp = 1.0 / (c_m * ((x * s) * (c_m * (x * s))));
	else
		tmp = (cos((2.0 * x)) / s) / ((x * (c_m * s)) * (x * c_m));
	end
	tmp_2 = tmp;
end
c_m = N[Abs[c], $MachinePrecision]
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s_] := If[LessEqual[x, 3.4e-51], N[(1.0 / N[(c$95$m * N[(N[(x * s), $MachinePrecision] * N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / s), $MachinePrecision] / N[(N[(x * N[(c$95$m * s), $MachinePrecision]), $MachinePrecision] * N[(x * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.4 \cdot 10^{-51}:\\
\;\;\;\;\frac{1}{c_m \cdot \left(\left(x \cdot s\right) \cdot \left(c_m \cdot \left(x \cdot s\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(2 \cdot x\right)}{s}}{\left(x \cdot \left(c_m \cdot s\right)\right) \cdot \left(x \cdot c_m\right)}\\


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 3: 97.7% accurate, 2.7× speedup?

\[\begin{array}{l} c_m = \left|c\right| \\ [x, c_m, s] = \mathsf{sort}([x, c_m, s])\\ \\ \begin{array}{l} t_0 := x \cdot \left(c_m \cdot s\right)\\ \mathbf{if}\;c_m \leq 9.8 \cdot 10^{+23}:\\ \;\;\;\;\frac{\frac{\cos \left(2 \cdot x\right)}{t_0}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;{\left(c_m \cdot \left(x \cdot s\right)\right)}^{-2}\\ \end{array} \end{array} \]
c_m = (fabs.f64 c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
(FPCore (x c_m s)
 :precision binary64
 (let* ((t_0 (* x (* c_m s))))
   (if (<= c_m 9.8e+23)
     (/ (/ (cos (* 2.0 x)) t_0) t_0)
     (pow (* c_m (* x s)) -2.0))))
c_m = fabs(c);
assert(x < c_m && c_m < s);
double code(double x, double c_m, double s) {
	double t_0 = x * (c_m * s);
	double tmp;
	if (c_m <= 9.8e+23) {
		tmp = (cos((2.0 * x)) / t_0) / t_0;
	} else {
		tmp = pow((c_m * (x * s)), -2.0);
	}
	return tmp;
}
c_m = abs(c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x * (c_m * s)
    if (c_m <= 9.8d+23) then
        tmp = (cos((2.0d0 * x)) / t_0) / t_0
    else
        tmp = (c_m * (x * s)) ** (-2.0d0)
    end if
    code = tmp
end function
c_m = Math.abs(c);
assert x < c_m && c_m < s;
public static double code(double x, double c_m, double s) {
	double t_0 = x * (c_m * s);
	double tmp;
	if (c_m <= 9.8e+23) {
		tmp = (Math.cos((2.0 * x)) / t_0) / t_0;
	} else {
		tmp = Math.pow((c_m * (x * s)), -2.0);
	}
	return tmp;
}
c_m = math.fabs(c)
[x, c_m, s] = sort([x, c_m, s])
def code(x, c_m, s):
	t_0 = x * (c_m * s)
	tmp = 0
	if c_m <= 9.8e+23:
		tmp = (math.cos((2.0 * x)) / t_0) / t_0
	else:
		tmp = math.pow((c_m * (x * s)), -2.0)
	return tmp
c_m = abs(c)
x, c_m, s = sort([x, c_m, s])
function code(x, c_m, s)
	t_0 = Float64(x * Float64(c_m * s))
	tmp = 0.0
	if (c_m <= 9.8e+23)
		tmp = Float64(Float64(cos(Float64(2.0 * x)) / t_0) / t_0);
	else
		tmp = Float64(c_m * Float64(x * s)) ^ -2.0;
	end
	return tmp
end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp_2 = code(x, c_m, s)
	t_0 = x * (c_m * s);
	tmp = 0.0;
	if (c_m <= 9.8e+23)
		tmp = (cos((2.0 * x)) / t_0) / t_0;
	else
		tmp = (c_m * (x * s)) ^ -2.0;
	end
	tmp_2 = tmp;
end
c_m = N[Abs[c], $MachinePrecision]
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s_] := Block[{t$95$0 = N[(x * N[(c$95$m * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c$95$m, 9.8e+23], N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision], N[Power[N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]]]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\begin{array}{l}
t_0 := x \cdot \left(c_m \cdot s\right)\\
\mathbf{if}\;c_m \leq 9.8 \cdot 10^{+23}:\\
\;\;\;\;\frac{\frac{\cos \left(2 \cdot x\right)}{t_0}}{t_0}\\

\mathbf{else}:\\
\;\;\;\;{\left(c_m \cdot \left(x \cdot s\right)\right)}^{-2}\\


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 4: 97.7% accurate, 2.7× speedup?

\[\begin{array}{l} c_m = \left|c\right| \\ [x, c_m, s] = \mathsf{sort}([x, c_m, s])\\ \\ \begin{array}{l} t_0 := \cos \left(2 \cdot x\right)\\ t_1 := x \cdot \left(c_m \cdot s\right)\\ \mathbf{if}\;c_m \leq 4.2 \cdot 10^{-48}:\\ \;\;\;\;\frac{\frac{t_0}{t_1}}{t_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{t_0}{c_m \cdot \left(x \cdot s\right)}}{x \cdot s}}{c_m}\\ \end{array} \end{array} \]
c_m = (fabs.f64 c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
(FPCore (x c_m s)
 :precision binary64
 (let* ((t_0 (cos (* 2.0 x))) (t_1 (* x (* c_m s))))
   (if (<= c_m 4.2e-48)
     (/ (/ t_0 t_1) t_1)
     (/ (/ (/ t_0 (* c_m (* x s))) (* x s)) c_m))))
c_m = fabs(c);
assert(x < c_m && c_m < s);
double code(double x, double c_m, double s) {
	double t_0 = cos((2.0 * x));
	double t_1 = x * (c_m * s);
	double tmp;
	if (c_m <= 4.2e-48) {
		tmp = (t_0 / t_1) / t_1;
	} else {
		tmp = ((t_0 / (c_m * (x * s))) / (x * s)) / c_m;
	}
	return tmp;
}
c_m = abs(c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = cos((2.0d0 * x))
    t_1 = x * (c_m * s)
    if (c_m <= 4.2d-48) then
        tmp = (t_0 / t_1) / t_1
    else
        tmp = ((t_0 / (c_m * (x * s))) / (x * s)) / c_m
    end if
    code = tmp
end function
c_m = Math.abs(c);
assert x < c_m && c_m < s;
public static double code(double x, double c_m, double s) {
	double t_0 = Math.cos((2.0 * x));
	double t_1 = x * (c_m * s);
	double tmp;
	if (c_m <= 4.2e-48) {
		tmp = (t_0 / t_1) / t_1;
	} else {
		tmp = ((t_0 / (c_m * (x * s))) / (x * s)) / c_m;
	}
	return tmp;
}
c_m = math.fabs(c)
[x, c_m, s] = sort([x, c_m, s])
def code(x, c_m, s):
	t_0 = math.cos((2.0 * x))
	t_1 = x * (c_m * s)
	tmp = 0
	if c_m <= 4.2e-48:
		tmp = (t_0 / t_1) / t_1
	else:
		tmp = ((t_0 / (c_m * (x * s))) / (x * s)) / c_m
	return tmp
c_m = abs(c)
x, c_m, s = sort([x, c_m, s])
function code(x, c_m, s)
	t_0 = cos(Float64(2.0 * x))
	t_1 = Float64(x * Float64(c_m * s))
	tmp = 0.0
	if (c_m <= 4.2e-48)
		tmp = Float64(Float64(t_0 / t_1) / t_1);
	else
		tmp = Float64(Float64(Float64(t_0 / Float64(c_m * Float64(x * s))) / Float64(x * s)) / c_m);
	end
	return tmp
end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp_2 = code(x, c_m, s)
	t_0 = cos((2.0 * x));
	t_1 = x * (c_m * s);
	tmp = 0.0;
	if (c_m <= 4.2e-48)
		tmp = (t_0 / t_1) / t_1;
	else
		tmp = ((t_0 / (c_m * (x * s))) / (x * s)) / c_m;
	end
	tmp_2 = tmp;
end
c_m = N[Abs[c], $MachinePrecision]
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s_] := Block[{t$95$0 = N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(c$95$m * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c$95$m, 4.2e-48], N[(N[(t$95$0 / t$95$1), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(N[(t$95$0 / N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision]]]]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\begin{array}{l}
t_0 := \cos \left(2 \cdot x\right)\\
t_1 := x \cdot \left(c_m \cdot s\right)\\
\mathbf{if}\;c_m \leq 4.2 \cdot 10^{-48}:\\
\;\;\;\;\frac{\frac{t_0}{t_1}}{t_1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{t_0}{c_m \cdot \left(x \cdot s\right)}}{x \cdot s}}{c_m}\\


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 5: 93.9% accurate, 2.7× speedup?

\[\begin{array}{l} c_m = \left|c\right| \\ [x, c_m, s] = \mathsf{sort}([x, c_m, s])\\ \\ \frac{\frac{\cos \left(2 \cdot x\right)}{c_m}}{\left(x \cdot s\right) \cdot \left(c_m \cdot \left(x \cdot s\right)\right)} \end{array} \]
c_m = (fabs.f64 c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
(FPCore (x c_m s)
 :precision binary64
 (/ (/ (cos (* 2.0 x)) c_m) (* (* x s) (* c_m (* x s)))))
c_m = fabs(c);
assert(x < c_m && c_m < s);
double code(double x, double c_m, double s) {
	return (cos((2.0 * x)) / c_m) / ((x * s) * (c_m * (x * s)));
}
c_m = abs(c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s
    code = (cos((2.0d0 * x)) / c_m) / ((x * s) * (c_m * (x * s)))
end function
c_m = Math.abs(c);
assert x < c_m && c_m < s;
public static double code(double x, double c_m, double s) {
	return (Math.cos((2.0 * x)) / c_m) / ((x * s) * (c_m * (x * s)));
}
c_m = math.fabs(c)
[x, c_m, s] = sort([x, c_m, s])
def code(x, c_m, s):
	return (math.cos((2.0 * x)) / c_m) / ((x * s) * (c_m * (x * s)))
c_m = abs(c)
x, c_m, s = sort([x, c_m, s])
function code(x, c_m, s)
	return Float64(Float64(cos(Float64(2.0 * x)) / c_m) / Float64(Float64(x * s) * Float64(c_m * Float64(x * s))))
end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp = code(x, c_m, s)
	tmp = (cos((2.0 * x)) / c_m) / ((x * s) * (c_m * (x * s)));
end
c_m = N[Abs[c], $MachinePrecision]
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s_] := N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / c$95$m), $MachinePrecision] / N[(N[(x * s), $MachinePrecision] * N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\frac{\frac{\cos \left(2 \cdot x\right)}{c_m}}{\left(x \cdot s\right) \cdot \left(c_m \cdot \left(x \cdot s\right)\right)}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 6: 78.9% accurate, 2.9× speedup?

\[\begin{array}{l} c_m = \left|c\right| \\ [x, c_m, s] = \mathsf{sort}([x, c_m, s])\\ \\ {\left(\frac{c_m}{\frac{\frac{1}{x}}{s}}\right)}^{-2} \end{array} \]
c_m = (fabs.f64 c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
(FPCore (x c_m s) :precision binary64 (pow (/ c_m (/ (/ 1.0 x) s)) -2.0))
c_m = fabs(c);
assert(x < c_m && c_m < s);
double code(double x, double c_m, double s) {
	return pow((c_m / ((1.0 / x) / s)), -2.0);
}
c_m = abs(c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s
    code = (c_m / ((1.0d0 / x) / s)) ** (-2.0d0)
end function
c_m = Math.abs(c);
assert x < c_m && c_m < s;
public static double code(double x, double c_m, double s) {
	return Math.pow((c_m / ((1.0 / x) / s)), -2.0);
}
c_m = math.fabs(c)
[x, c_m, s] = sort([x, c_m, s])
def code(x, c_m, s):
	return math.pow((c_m / ((1.0 / x) / s)), -2.0)
c_m = abs(c)
x, c_m, s = sort([x, c_m, s])
function code(x, c_m, s)
	return Float64(c_m / Float64(Float64(1.0 / x) / s)) ^ -2.0
end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp = code(x, c_m, s)
	tmp = (c_m / ((1.0 / x) / s)) ^ -2.0;
end
c_m = N[Abs[c], $MachinePrecision]
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s_] := N[Power[N[(c$95$m / N[(N[(1.0 / x), $MachinePrecision] / s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
{\left(\frac{c_m}{\frac{\frac{1}{x}}{s}}\right)}^{-2}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 7: 79.0% accurate, 3.0× speedup?

\[\begin{array}{l} c_m = \left|c\right| \\ [x, c_m, s] = \mathsf{sort}([x, c_m, s])\\ \\ {\left(c_m \cdot \left(x \cdot s\right)\right)}^{-2} \end{array} \]
c_m = (fabs.f64 c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
(FPCore (x c_m s) :precision binary64 (pow (* c_m (* x s)) -2.0))
c_m = fabs(c);
assert(x < c_m && c_m < s);
double code(double x, double c_m, double s) {
	return pow((c_m * (x * s)), -2.0);
}
c_m = abs(c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s
    code = (c_m * (x * s)) ** (-2.0d0)
end function
c_m = Math.abs(c);
assert x < c_m && c_m < s;
public static double code(double x, double c_m, double s) {
	return Math.pow((c_m * (x * s)), -2.0);
}
c_m = math.fabs(c)
[x, c_m, s] = sort([x, c_m, s])
def code(x, c_m, s):
	return math.pow((c_m * (x * s)), -2.0)
c_m = abs(c)
x, c_m, s = sort([x, c_m, s])
function code(x, c_m, s)
	return Float64(c_m * Float64(x * s)) ^ -2.0
end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp = code(x, c_m, s)
	tmp = (c_m * (x * s)) ^ -2.0;
end
c_m = N[Abs[c], $MachinePrecision]
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s_] := N[Power[N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
{\left(c_m \cdot \left(x \cdot s\right)\right)}^{-2}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 8: 76.8% accurate, 20.8× speedup?

\[\begin{array}{l} c_m = \left|c\right| \\ [x, c_m, s] = \mathsf{sort}([x, c_m, s])\\ \\ \begin{array}{l} t_0 := c_m \cdot \left(x \cdot s\right)\\ \mathbf{if}\;s \leq 2.9 \cdot 10^{+207}:\\ \;\;\;\;\frac{1}{\left(x \cdot c_m\right) \cdot \left(s \cdot t_0\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(c_m \cdot s\right) \cdot \left(x \cdot t_0\right)}\\ \end{array} \end{array} \]
c_m = (fabs.f64 c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
(FPCore (x c_m s)
 :precision binary64
 (let* ((t_0 (* c_m (* x s))))
   (if (<= s 2.9e+207)
     (/ 1.0 (* (* x c_m) (* s t_0)))
     (/ 1.0 (* (* c_m s) (* x t_0))))))
c_m = fabs(c);
assert(x < c_m && c_m < s);
double code(double x, double c_m, double s) {
	double t_0 = c_m * (x * s);
	double tmp;
	if (s <= 2.9e+207) {
		tmp = 1.0 / ((x * c_m) * (s * t_0));
	} else {
		tmp = 1.0 / ((c_m * s) * (x * t_0));
	}
	return tmp;
}
c_m = abs(c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s
    real(8) :: t_0
    real(8) :: tmp
    t_0 = c_m * (x * s)
    if (s <= 2.9d+207) then
        tmp = 1.0d0 / ((x * c_m) * (s * t_0))
    else
        tmp = 1.0d0 / ((c_m * s) * (x * t_0))
    end if
    code = tmp
end function
c_m = Math.abs(c);
assert x < c_m && c_m < s;
public static double code(double x, double c_m, double s) {
	double t_0 = c_m * (x * s);
	double tmp;
	if (s <= 2.9e+207) {
		tmp = 1.0 / ((x * c_m) * (s * t_0));
	} else {
		tmp = 1.0 / ((c_m * s) * (x * t_0));
	}
	return tmp;
}
c_m = math.fabs(c)
[x, c_m, s] = sort([x, c_m, s])
def code(x, c_m, s):
	t_0 = c_m * (x * s)
	tmp = 0
	if s <= 2.9e+207:
		tmp = 1.0 / ((x * c_m) * (s * t_0))
	else:
		tmp = 1.0 / ((c_m * s) * (x * t_0))
	return tmp
c_m = abs(c)
x, c_m, s = sort([x, c_m, s])
function code(x, c_m, s)
	t_0 = Float64(c_m * Float64(x * s))
	tmp = 0.0
	if (s <= 2.9e+207)
		tmp = Float64(1.0 / Float64(Float64(x * c_m) * Float64(s * t_0)));
	else
		tmp = Float64(1.0 / Float64(Float64(c_m * s) * Float64(x * t_0)));
	end
	return tmp
end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp_2 = code(x, c_m, s)
	t_0 = c_m * (x * s);
	tmp = 0.0;
	if (s <= 2.9e+207)
		tmp = 1.0 / ((x * c_m) * (s * t_0));
	else
		tmp = 1.0 / ((c_m * s) * (x * t_0));
	end
	tmp_2 = tmp;
end
c_m = N[Abs[c], $MachinePrecision]
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s_] := Block[{t$95$0 = N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[s, 2.9e+207], N[(1.0 / N[(N[(x * c$95$m), $MachinePrecision] * N[(s * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(c$95$m * s), $MachinePrecision] * N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\begin{array}{l}
t_0 := c_m \cdot \left(x \cdot s\right)\\
\mathbf{if}\;s \leq 2.9 \cdot 10^{+207}:\\
\;\;\;\;\frac{1}{\left(x \cdot c_m\right) \cdot \left(s \cdot t_0\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(c_m \cdot s\right) \cdot \left(x \cdot t_0\right)}\\


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 9: 79.0% accurate, 20.9× speedup?

\[\begin{array}{l} c_m = \left|c\right| \\ [x, c_m, s] = \mathsf{sort}([x, c_m, s])\\ \\ \frac{1}{c_m \cdot \left(x \cdot s\right)} \cdot \frac{\frac{1}{c_m}}{x \cdot s} \end{array} \]
c_m = (fabs.f64 c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
(FPCore (x c_m s)
 :precision binary64
 (* (/ 1.0 (* c_m (* x s))) (/ (/ 1.0 c_m) (* x s))))
c_m = fabs(c);
assert(x < c_m && c_m < s);
double code(double x, double c_m, double s) {
	return (1.0 / (c_m * (x * s))) * ((1.0 / c_m) / (x * s));
}
c_m = abs(c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s
    code = (1.0d0 / (c_m * (x * s))) * ((1.0d0 / c_m) / (x * s))
end function
c_m = Math.abs(c);
assert x < c_m && c_m < s;
public static double code(double x, double c_m, double s) {
	return (1.0 / (c_m * (x * s))) * ((1.0 / c_m) / (x * s));
}
c_m = math.fabs(c)
[x, c_m, s] = sort([x, c_m, s])
def code(x, c_m, s):
	return (1.0 / (c_m * (x * s))) * ((1.0 / c_m) / (x * s))
c_m = abs(c)
x, c_m, s = sort([x, c_m, s])
function code(x, c_m, s)
	return Float64(Float64(1.0 / Float64(c_m * Float64(x * s))) * Float64(Float64(1.0 / c_m) / Float64(x * s)))
end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp = code(x, c_m, s)
	tmp = (1.0 / (c_m * (x * s))) * ((1.0 / c_m) / (x * s));
end
c_m = N[Abs[c], $MachinePrecision]
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s_] := N[(N[(1.0 / N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c$95$m), $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\frac{1}{c_m \cdot \left(x \cdot s\right)} \cdot \frac{\frac{1}{c_m}}{x \cdot s}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 10: 78.9% accurate, 20.9× speedup?

\[\begin{array}{l} c_m = \left|c\right| \\ [x, c_m, s] = \mathsf{sort}([x, c_m, s])\\ \\ \frac{1}{c_m \cdot \left(x \cdot s\right)} \cdot \frac{\frac{\frac{1}{s}}{x}}{c_m} \end{array} \]
c_m = (fabs.f64 c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
(FPCore (x c_m s)
 :precision binary64
 (* (/ 1.0 (* c_m (* x s))) (/ (/ (/ 1.0 s) x) c_m)))
c_m = fabs(c);
assert(x < c_m && c_m < s);
double code(double x, double c_m, double s) {
	return (1.0 / (c_m * (x * s))) * (((1.0 / s) / x) / c_m);
}
c_m = abs(c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s
    code = (1.0d0 / (c_m * (x * s))) * (((1.0d0 / s) / x) / c_m)
end function
c_m = Math.abs(c);
assert x < c_m && c_m < s;
public static double code(double x, double c_m, double s) {
	return (1.0 / (c_m * (x * s))) * (((1.0 / s) / x) / c_m);
}
c_m = math.fabs(c)
[x, c_m, s] = sort([x, c_m, s])
def code(x, c_m, s):
	return (1.0 / (c_m * (x * s))) * (((1.0 / s) / x) / c_m)
c_m = abs(c)
x, c_m, s = sort([x, c_m, s])
function code(x, c_m, s)
	return Float64(Float64(1.0 / Float64(c_m * Float64(x * s))) * Float64(Float64(Float64(1.0 / s) / x) / c_m))
end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp = code(x, c_m, s)
	tmp = (1.0 / (c_m * (x * s))) * (((1.0 / s) / x) / c_m);
end
c_m = N[Abs[c], $MachinePrecision]
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s_] := N[(N[(1.0 / N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1.0 / s), $MachinePrecision] / x), $MachinePrecision] / c$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\frac{1}{c_m \cdot \left(x \cdot s\right)} \cdot \frac{\frac{\frac{1}{s}}{x}}{c_m}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 11: 75.8% accurate, 24.1× speedup?

\[\begin{array}{l} c_m = \left|c\right| \\ [x, c_m, s] = \mathsf{sort}([x, c_m, s])\\ \\ \frac{1}{\left(c_m \cdot s\right) \cdot \left(x \cdot \left(c_m \cdot \left(x \cdot s\right)\right)\right)} \end{array} \]
c_m = (fabs.f64 c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
(FPCore (x c_m s)
 :precision binary64
 (/ 1.0 (* (* c_m s) (* x (* c_m (* x s))))))
c_m = fabs(c);
assert(x < c_m && c_m < s);
double code(double x, double c_m, double s) {
	return 1.0 / ((c_m * s) * (x * (c_m * (x * s))));
}
c_m = abs(c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s
    code = 1.0d0 / ((c_m * s) * (x * (c_m * (x * s))))
end function
c_m = Math.abs(c);
assert x < c_m && c_m < s;
public static double code(double x, double c_m, double s) {
	return 1.0 / ((c_m * s) * (x * (c_m * (x * s))));
}
c_m = math.fabs(c)
[x, c_m, s] = sort([x, c_m, s])
def code(x, c_m, s):
	return 1.0 / ((c_m * s) * (x * (c_m * (x * s))))
c_m = abs(c)
x, c_m, s = sort([x, c_m, s])
function code(x, c_m, s)
	return Float64(1.0 / Float64(Float64(c_m * s) * Float64(x * Float64(c_m * Float64(x * s)))))
end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp = code(x, c_m, s)
	tmp = 1.0 / ((c_m * s) * (x * (c_m * (x * s))));
end
c_m = N[Abs[c], $MachinePrecision]
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s_] := N[(1.0 / N[(N[(c$95$m * s), $MachinePrecision] * N[(x * N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\frac{1}{\left(c_m \cdot s\right) \cdot \left(x \cdot \left(c_m \cdot \left(x \cdot s\right)\right)\right)}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 12: 78.8% accurate, 24.1× speedup?

\[\begin{array}{l} c_m = \left|c\right| \\ [x, c_m, s] = \mathsf{sort}([x, c_m, s])\\ \\ \begin{array}{l} t_0 := c_m \cdot \left(x \cdot s\right)\\ \frac{1}{t_0 \cdot t_0} \end{array} \end{array} \]
c_m = (fabs.f64 c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
(FPCore (x c_m s)
 :precision binary64
 (let* ((t_0 (* c_m (* x s)))) (/ 1.0 (* t_0 t_0))))
c_m = fabs(c);
assert(x < c_m && c_m < s);
double code(double x, double c_m, double s) {
	double t_0 = c_m * (x * s);
	return 1.0 / (t_0 * t_0);
}
c_m = abs(c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s
    real(8) :: t_0
    t_0 = c_m * (x * s)
    code = 1.0d0 / (t_0 * t_0)
end function
c_m = Math.abs(c);
assert x < c_m && c_m < s;
public static double code(double x, double c_m, double s) {
	double t_0 = c_m * (x * s);
	return 1.0 / (t_0 * t_0);
}
c_m = math.fabs(c)
[x, c_m, s] = sort([x, c_m, s])
def code(x, c_m, s):
	t_0 = c_m * (x * s)
	return 1.0 / (t_0 * t_0)
c_m = abs(c)
x, c_m, s = sort([x, c_m, s])
function code(x, c_m, s)
	t_0 = Float64(c_m * Float64(x * s))
	return Float64(1.0 / Float64(t_0 * t_0))
end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp = code(x, c_m, s)
	t_0 = c_m * (x * s);
	tmp = 1.0 / (t_0 * t_0);
end
c_m = N[Abs[c], $MachinePrecision]
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s_] := Block[{t$95$0 = N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]}, N[(1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\begin{array}{l}
t_0 := c_m \cdot \left(x \cdot s\right)\\
\frac{1}{t_0 \cdot t_0}
\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Reproduce

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