
(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:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* c (* x s))) (t_1 (cos (* 2.0 x))) (t_2 (* x (* c s))))
(if (<= (/ t_1 (* (pow c 2.0) (* x (* x (pow s 2.0))))) INFINITY)
(/ (/ t_1 t_0) t_0)
(/ (fma (cos x) (cos x) (- (pow (sin x) 2.0))) (* t_2 t_2)))))
double code(double x, double c, double s) {
double t_0 = c * (x * s);
double t_1 = cos((2.0 * x));
double t_2 = x * (c * s);
double tmp;
if ((t_1 / (pow(c, 2.0) * (x * (x * pow(s, 2.0))))) <= ((double) INFINITY)) {
tmp = (t_1 / t_0) / t_0;
} else {
tmp = fma(cos(x), cos(x), -pow(sin(x), 2.0)) / (t_2 * t_2);
}
return tmp;
}
function code(x, c, s) t_0 = Float64(c * Float64(x * s)) t_1 = cos(Float64(2.0 * x)) t_2 = Float64(x * Float64(c * s)) tmp = 0.0 if (Float64(t_1 / Float64((c ^ 2.0) * Float64(x * Float64(x * (s ^ 2.0))))) <= Inf) tmp = Float64(Float64(t_1 / t_0) / t_0); else tmp = Float64(fma(cos(x), cos(x), Float64(-(sin(x) ^ 2.0))) / Float64(t_2 * t_2)); end return tmp end
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[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 / N[(N[Power[c, 2.0], $MachinePrecision] * N[(x * N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(t$95$1 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Cos[x], $MachinePrecision] * N[Cos[x], $MachinePrecision] + (-N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision])), $MachinePrecision] / N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
t_1 := \cos \left(2 \cdot x\right)\\
t_2 := x \cdot \left(c \cdot s\right)\\
\mathbf{if}\;\frac{t\_1}{{c}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq \infty:\\
\;\;\;\;\frac{\frac{t\_1}{t\_0}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\cos x, \cos x, -{\sin x}^{2}\right)}{t\_2 \cdot t\_2}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x))) < +inf.0Initial program 78.7%
*-un-lft-identity78.7%
add-sqr-sqrt78.7%
times-frac78.7%
Applied egg-rr99.4%
*-commutative99.4%
associate-*l/99.4%
div-inv99.4%
*-commutative99.4%
Applied egg-rr99.4%
if +inf.0 < (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x))) Initial program 0.0%
*-un-lft-identity0.0%
add-sqr-sqrt0.0%
times-frac0.0%
Applied egg-rr85.3%
*-commutative85.3%
frac-2neg85.3%
frac-2neg85.3%
metadata-eval85.3%
frac-times85.3%
*-commutative85.3%
*-commutative85.3%
associate-*r*85.6%
distribute-rgt-neg-in85.6%
*-commutative85.6%
associate-*r*97.1%
distribute-rgt-neg-in97.1%
Applied egg-rr97.1%
*-commutative97.1%
cos-299.1%
Applied egg-rr99.1%
fma-neg99.2%
distribute-rgt-neg-in99.2%
Simplified99.2%
Taylor expanded in x around inf 99.2%
neg-mul-199.2%
Simplified99.2%
Final simplification99.3%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* c (* x s))) (t_1 (cos (* 2.0 x))) (t_2 (* x (* c s))))
(if (<= (/ t_1 (* (pow c 2.0) (* x (* x (pow s 2.0))))) INFINITY)
(/ (/ t_1 t_0) t_0)
(/ (- (pow (cos x) 2.0) (pow (sin x) 2.0)) (* t_2 t_2)))))
double code(double x, double c, double s) {
double t_0 = c * (x * s);
double t_1 = cos((2.0 * x));
double t_2 = x * (c * s);
double tmp;
if ((t_1 / (pow(c, 2.0) * (x * (x * pow(s, 2.0))))) <= ((double) INFINITY)) {
tmp = (t_1 / t_0) / t_0;
} else {
tmp = (pow(cos(x), 2.0) - pow(sin(x), 2.0)) / (t_2 * t_2);
}
return tmp;
}
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 = x * (c * s);
double tmp;
if ((t_1 / (Math.pow(c, 2.0) * (x * (x * Math.pow(s, 2.0))))) <= Double.POSITIVE_INFINITY) {
tmp = (t_1 / t_0) / t_0;
} else {
tmp = (Math.pow(Math.cos(x), 2.0) - Math.pow(Math.sin(x), 2.0)) / (t_2 * t_2);
}
return tmp;
}
def code(x, c, s): t_0 = c * (x * s) t_1 = math.cos((2.0 * x)) t_2 = x * (c * s) tmp = 0 if (t_1 / (math.pow(c, 2.0) * (x * (x * math.pow(s, 2.0))))) <= math.inf: tmp = (t_1 / t_0) / t_0 else: tmp = (math.pow(math.cos(x), 2.0) - math.pow(math.sin(x), 2.0)) / (t_2 * t_2) return tmp
function code(x, c, s) t_0 = Float64(c * Float64(x * s)) t_1 = cos(Float64(2.0 * x)) t_2 = Float64(x * Float64(c * s)) tmp = 0.0 if (Float64(t_1 / Float64((c ^ 2.0) * Float64(x * Float64(x * (s ^ 2.0))))) <= Inf) tmp = Float64(Float64(t_1 / t_0) / t_0); else tmp = Float64(Float64((cos(x) ^ 2.0) - (sin(x) ^ 2.0)) / Float64(t_2 * t_2)); end return tmp end
function tmp_2 = code(x, c, s) t_0 = c * (x * s); t_1 = cos((2.0 * x)); t_2 = x * (c * s); tmp = 0.0; if ((t_1 / ((c ^ 2.0) * (x * (x * (s ^ 2.0))))) <= Inf) tmp = (t_1 / t_0) / t_0; else tmp = ((cos(x) ^ 2.0) - (sin(x) ^ 2.0)) / (t_2 * t_2); end tmp_2 = tmp; end
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[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 / N[(N[Power[c, 2.0], $MachinePrecision] * N[(x * N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(t$95$1 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
t_1 := \cos \left(2 \cdot x\right)\\
t_2 := x \cdot \left(c \cdot s\right)\\
\mathbf{if}\;\frac{t\_1}{{c}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq \infty:\\
\;\;\;\;\frac{\frac{t\_1}{t\_0}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\cos x}^{2} - {\sin x}^{2}}{t\_2 \cdot t\_2}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x))) < +inf.0Initial program 78.7%
*-un-lft-identity78.7%
add-sqr-sqrt78.7%
times-frac78.7%
Applied egg-rr99.4%
*-commutative99.4%
associate-*l/99.4%
div-inv99.4%
*-commutative99.4%
Applied egg-rr99.4%
if +inf.0 < (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x))) Initial program 0.0%
*-un-lft-identity0.0%
add-sqr-sqrt0.0%
times-frac0.0%
Applied egg-rr85.3%
*-commutative85.3%
frac-2neg85.3%
frac-2neg85.3%
metadata-eval85.3%
frac-times85.3%
*-commutative85.3%
*-commutative85.3%
associate-*r*85.6%
distribute-rgt-neg-in85.6%
*-commutative85.6%
associate-*r*97.1%
distribute-rgt-neg-in97.1%
Applied egg-rr97.1%
*-commutative97.1%
cos-299.1%
Applied egg-rr99.1%
fma-neg99.2%
distribute-rgt-neg-in99.2%
Simplified99.2%
Taylor expanded in x around inf 99.1%
+-commutative99.1%
neg-mul-199.1%
unsub-neg99.1%
Simplified99.1%
Final simplification99.3%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* c (* x s))) (t_1 (cos (* 2.0 x))) (t_2 (* x (* c s))))
(if (<= (/ t_1 (* (pow c 2.0) (* x (* x (pow s 2.0))))) INFINITY)
(/ (/ t_1 t_0) t_0)
(/ t_1 (* t_2 t_2)))))
double code(double x, double c, double s) {
double t_0 = c * (x * s);
double t_1 = cos((2.0 * x));
double t_2 = x * (c * s);
double tmp;
if ((t_1 / (pow(c, 2.0) * (x * (x * pow(s, 2.0))))) <= ((double) INFINITY)) {
tmp = (t_1 / t_0) / t_0;
} else {
tmp = t_1 / (t_2 * t_2);
}
return tmp;
}
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 = x * (c * s);
double tmp;
if ((t_1 / (Math.pow(c, 2.0) * (x * (x * Math.pow(s, 2.0))))) <= Double.POSITIVE_INFINITY) {
tmp = (t_1 / t_0) / t_0;
} else {
tmp = t_1 / (t_2 * t_2);
}
return tmp;
}
def code(x, c, s): t_0 = c * (x * s) t_1 = math.cos((2.0 * x)) t_2 = x * (c * s) tmp = 0 if (t_1 / (math.pow(c, 2.0) * (x * (x * math.pow(s, 2.0))))) <= math.inf: tmp = (t_1 / t_0) / t_0 else: tmp = t_1 / (t_2 * t_2) return tmp
function code(x, c, s) t_0 = Float64(c * Float64(x * s)) t_1 = cos(Float64(2.0 * x)) t_2 = Float64(x * Float64(c * s)) tmp = 0.0 if (Float64(t_1 / Float64((c ^ 2.0) * Float64(x * Float64(x * (s ^ 2.0))))) <= Inf) tmp = Float64(Float64(t_1 / t_0) / t_0); else tmp = Float64(t_1 / Float64(t_2 * t_2)); end return tmp end
function tmp_2 = code(x, c, s) t_0 = c * (x * s); t_1 = cos((2.0 * x)); t_2 = x * (c * s); tmp = 0.0; if ((t_1 / ((c ^ 2.0) * (x * (x * (s ^ 2.0))))) <= Inf) tmp = (t_1 / t_0) / t_0; else tmp = t_1 / (t_2 * t_2); end tmp_2 = tmp; end
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[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 / N[(N[Power[c, 2.0], $MachinePrecision] * N[(x * N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(t$95$1 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision], N[(t$95$1 / N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
t_1 := \cos \left(2 \cdot x\right)\\
t_2 := x \cdot \left(c \cdot s\right)\\
\mathbf{if}\;\frac{t\_1}{{c}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq \infty:\\
\;\;\;\;\frac{\frac{t\_1}{t\_0}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{t\_2 \cdot t\_2}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x))) < +inf.0Initial program 78.7%
*-un-lft-identity78.7%
add-sqr-sqrt78.7%
times-frac78.7%
Applied egg-rr99.4%
*-commutative99.4%
associate-*l/99.4%
div-inv99.4%
*-commutative99.4%
Applied egg-rr99.4%
if +inf.0 < (/.f64 (cos.f64 (*.f64 2 x)) (*.f64 (pow.f64 c 2) (*.f64 (*.f64 x (pow.f64 s 2)) x))) Initial program 0.0%
*-un-lft-identity0.0%
add-sqr-sqrt0.0%
times-frac0.0%
Applied egg-rr85.3%
*-commutative85.3%
frac-2neg85.3%
frac-2neg85.3%
metadata-eval85.3%
frac-times85.3%
*-commutative85.3%
*-commutative85.3%
associate-*r*85.6%
distribute-rgt-neg-in85.6%
*-commutative85.6%
associate-*r*97.1%
distribute-rgt-neg-in97.1%
Applied egg-rr97.1%
Final simplification99.0%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* c (* x s))) (t_1 (cos (* 2.0 x))))
(if (<= c 5.2e-240)
(/ (* t_1 (/ (/ 1.0 (* x (* c s))) (* c s))) x)
(/ (/ t_1 t_0) t_0))))
double code(double x, double c, double s) {
double t_0 = c * (x * s);
double t_1 = cos((2.0 * x));
double tmp;
if (c <= 5.2e-240) {
tmp = (t_1 * ((1.0 / (x * (c * s))) / (c * s))) / x;
} else {
tmp = (t_1 / t_0) / 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) :: t_1
real(8) :: tmp
t_0 = c * (x * s)
t_1 = cos((2.0d0 * x))
if (c <= 5.2d-240) then
tmp = (t_1 * ((1.0d0 / (x * (c * s))) / (c * s))) / x
else
tmp = (t_1 / t_0) / t_0
end if
code = tmp
end function
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 tmp;
if (c <= 5.2e-240) {
tmp = (t_1 * ((1.0 / (x * (c * s))) / (c * s))) / x;
} else {
tmp = (t_1 / t_0) / t_0;
}
return tmp;
}
def code(x, c, s): t_0 = c * (x * s) t_1 = math.cos((2.0 * x)) tmp = 0 if c <= 5.2e-240: tmp = (t_1 * ((1.0 / (x * (c * s))) / (c * s))) / x else: tmp = (t_1 / t_0) / t_0 return tmp
function code(x, c, s) t_0 = Float64(c * Float64(x * s)) t_1 = cos(Float64(2.0 * x)) tmp = 0.0 if (c <= 5.2e-240) tmp = Float64(Float64(t_1 * Float64(Float64(1.0 / Float64(x * Float64(c * s))) / Float64(c * s))) / x); else tmp = Float64(Float64(t_1 / t_0) / t_0); end return tmp end
function tmp_2 = code(x, c, s) t_0 = c * (x * s); t_1 = cos((2.0 * x)); tmp = 0.0; if (c <= 5.2e-240) tmp = (t_1 * ((1.0 / (x * (c * s))) / (c * s))) / x; else tmp = (t_1 / t_0) / t_0; end tmp_2 = tmp; end
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]}, If[LessEqual[c, 5.2e-240], N[(N[(t$95$1 * N[(N[(1.0 / N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(t$95$1 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
t_1 := \cos \left(2 \cdot x\right)\\
\mathbf{if}\;c \leq 5.2 \cdot 10^{-240}:\\
\;\;\;\;\frac{t\_1 \cdot \frac{\frac{1}{x \cdot \left(c \cdot s\right)}}{c \cdot s}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_1}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if c < 5.19999999999999984e-240Initial program 64.6%
*-un-lft-identity64.6%
add-sqr-sqrt64.6%
times-frac64.6%
Applied egg-rr96.2%
*-commutative96.2%
frac-2neg96.2%
frac-2neg96.2%
metadata-eval96.2%
frac-times96.2%
*-commutative96.2%
*-commutative96.2%
associate-*r*94.5%
distribute-rgt-neg-in94.5%
*-commutative94.5%
associate-*r*96.6%
distribute-rgt-neg-in96.6%
Applied egg-rr96.6%
*-un-lft-identity96.6%
associate-*r*90.5%
times-frac91.0%
associate-*l*88.3%
add-sqr-sqrt41.9%
sqrt-unprod51.4%
sqr-neg51.4%
sqrt-prod18.4%
add-sqr-sqrt28.5%
Applied egg-rr88.3%
associate-*r/88.3%
frac-2neg88.3%
Applied egg-rr91.4%
if 5.19999999999999984e-240 < c Initial program 66.4%
*-un-lft-identity66.4%
add-sqr-sqrt66.4%
times-frac66.4%
Applied egg-rr97.8%
*-commutative97.8%
associate-*l/97.8%
div-inv97.9%
*-commutative97.9%
Applied egg-rr97.9%
Final simplification94.6%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* c (* x s))) (t_1 (cos (* 2.0 x))))
(if (<= c 2e-276)
(/ (/ t_1 (* x (* x (* c s)))) (* c s))
(/ (/ t_1 t_0) t_0))))
double code(double x, double c, double s) {
double t_0 = c * (x * s);
double t_1 = cos((2.0 * x));
double tmp;
if (c <= 2e-276) {
tmp = (t_1 / (x * (x * (c * s)))) / (c * s);
} else {
tmp = (t_1 / t_0) / 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) :: t_1
real(8) :: tmp
t_0 = c * (x * s)
t_1 = cos((2.0d0 * x))
if (c <= 2d-276) then
tmp = (t_1 / (x * (x * (c * s)))) / (c * s)
else
tmp = (t_1 / t_0) / t_0
end if
code = tmp
end function
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 tmp;
if (c <= 2e-276) {
tmp = (t_1 / (x * (x * (c * s)))) / (c * s);
} else {
tmp = (t_1 / t_0) / t_0;
}
return tmp;
}
def code(x, c, s): t_0 = c * (x * s) t_1 = math.cos((2.0 * x)) tmp = 0 if c <= 2e-276: tmp = (t_1 / (x * (x * (c * s)))) / (c * s) else: tmp = (t_1 / t_0) / t_0 return tmp
function code(x, c, s) t_0 = Float64(c * Float64(x * s)) t_1 = cos(Float64(2.0 * x)) tmp = 0.0 if (c <= 2e-276) tmp = Float64(Float64(t_1 / Float64(x * Float64(x * Float64(c * s)))) / Float64(c * s)); else tmp = Float64(Float64(t_1 / t_0) / t_0); end return tmp end
function tmp_2 = code(x, c, s) t_0 = c * (x * s); t_1 = cos((2.0 * x)); tmp = 0.0; if (c <= 2e-276) tmp = (t_1 / (x * (x * (c * s)))) / (c * s); else tmp = (t_1 / t_0) / t_0; end tmp_2 = tmp; end
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]}, If[LessEqual[c, 2e-276], N[(N[(t$95$1 / N[(x * N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c * s), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
t_1 := \cos \left(2 \cdot x\right)\\
\mathbf{if}\;c \leq 2 \cdot 10^{-276}:\\
\;\;\;\;\frac{\frac{t\_1}{x \cdot \left(x \cdot \left(c \cdot s\right)\right)}}{c \cdot s}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_1}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if c < 2e-276Initial program 64.7%
*-un-lft-identity64.7%
add-sqr-sqrt64.7%
times-frac64.7%
Applied egg-rr96.1%
*-commutative96.1%
frac-2neg96.1%
frac-2neg96.1%
metadata-eval96.1%
frac-times96.0%
*-commutative96.0%
*-commutative96.0%
associate-*r*94.3%
distribute-rgt-neg-in94.3%
*-commutative94.3%
associate-*r*96.5%
distribute-rgt-neg-in96.5%
Applied egg-rr96.5%
*-un-lft-identity96.5%
associate-*l*93.2%
times-frac92.3%
Applied egg-rr90.0%
associate-*l/90.5%
*-lft-identity90.5%
associate-*r*92.8%
*-commutative92.8%
Simplified92.8%
if 2e-276 < c Initial program 66.3%
*-un-lft-identity66.3%
add-sqr-sqrt66.2%
times-frac66.2%
Applied egg-rr97.9%
*-commutative97.9%
associate-*l/97.9%
div-inv97.9%
*-commutative97.9%
Applied egg-rr97.9%
Final simplification95.5%
(FPCore (x c s) :precision binary64 (/ (/ (cos (* 2.0 x)) c) (* (* c (* x s)) (* x s))))
double code(double x, double c, double s) {
return (cos((2.0 * x)) / 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 = (cos((2.0d0 * x)) / c) / ((c * (x * s)) * (x * s))
end function
public static double code(double x, double c, double s) {
return (Math.cos((2.0 * x)) / c) / ((c * (x * s)) * (x * s));
}
def code(x, c, s): return (math.cos((2.0 * x)) / c) / ((c * (x * s)) * (x * s))
function code(x, c, s) return Float64(Float64(cos(Float64(2.0 * x)) / c) / Float64(Float64(c * Float64(x * s)) * Float64(x * s))) end
function tmp = code(x, c, s) tmp = (cos((2.0 * x)) / c) / ((c * (x * s)) * (x * s)); end
code[x_, c_, s_] := N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / c), $MachinePrecision] / N[(N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision] * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\cos \left(2 \cdot x\right)}{c}}{\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(x \cdot s\right)}
\end{array}
Initial program 65.5%
*-un-lft-identity65.5%
add-sqr-sqrt65.5%
times-frac65.5%
Applied egg-rr97.0%
associate-*l/97.0%
*-un-lft-identity97.0%
associate-/r*97.0%
associate-/l/93.5%
*-commutative93.5%
Applied egg-rr93.5%
Final simplification93.5%
(FPCore (x c s) :precision binary64 (let* ((t_0 (* c (* x s)))) (/ (/ (cos (* 2.0 x)) t_0) t_0)))
double code(double x, double c, double s) {
double t_0 = c * (x * s);
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 = c * (x * s)
code = (cos((2.0d0 * x)) / t_0) / t_0
end function
public static double code(double x, double c, double s) {
double t_0 = c * (x * s);
return (Math.cos((2.0 * x)) / t_0) / t_0;
}
def code(x, c, s): t_0 = c * (x * s) return (math.cos((2.0 * x)) / t_0) / t_0
function code(x, c, s) t_0 = Float64(c * Float64(x * s)) return Float64(Float64(cos(Float64(2.0 * x)) / t_0) / t_0) end
function tmp = code(x, c, s) t_0 = c * (x * s); tmp = (cos((2.0 * x)) / t_0) / t_0; end
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $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 := c \cdot \left(x \cdot s\right)\\
\frac{\frac{\cos \left(2 \cdot x\right)}{t\_0}}{t\_0}
\end{array}
\end{array}
Initial program 65.5%
*-un-lft-identity65.5%
add-sqr-sqrt65.5%
times-frac65.5%
Applied egg-rr97.0%
*-commutative97.0%
associate-*l/97.0%
div-inv97.0%
*-commutative97.0%
Applied egg-rr97.0%
Final simplification97.0%
(FPCore (x c s) :precision binary64 (let* ((t_0 (* x (* c s))) (t_1 (/ 1.0 (* c (* x s))))) (if (<= x 2.6e+44) (* t_1 t_1) (/ (/ -1.0 t_0) t_0))))
double code(double x, double c, double s) {
double t_0 = x * (c * s);
double t_1 = 1.0 / (c * (x * s));
double tmp;
if (x <= 2.6e+44) {
tmp = t_1 * t_1;
} else {
tmp = (-1.0 / t_0) / 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) :: t_1
real(8) :: tmp
t_0 = x * (c * s)
t_1 = 1.0d0 / (c * (x * s))
if (x <= 2.6d+44) then
tmp = t_1 * t_1
else
tmp = ((-1.0d0) / t_0) / t_0
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double t_0 = x * (c * s);
double t_1 = 1.0 / (c * (x * s));
double tmp;
if (x <= 2.6e+44) {
tmp = t_1 * t_1;
} else {
tmp = (-1.0 / t_0) / t_0;
}
return tmp;
}
def code(x, c, s): t_0 = x * (c * s) t_1 = 1.0 / (c * (x * s)) tmp = 0 if x <= 2.6e+44: tmp = t_1 * t_1 else: tmp = (-1.0 / t_0) / t_0 return tmp
function code(x, c, s) t_0 = Float64(x * Float64(c * s)) t_1 = Float64(1.0 / Float64(c * Float64(x * s))) tmp = 0.0 if (x <= 2.6e+44) tmp = Float64(t_1 * t_1); else tmp = Float64(Float64(-1.0 / t_0) / t_0); end return tmp end
function tmp_2 = code(x, c, s) t_0 = x * (c * s); t_1 = 1.0 / (c * (x * s)); tmp = 0.0; if (x <= 2.6e+44) tmp = t_1 * t_1; else tmp = (-1.0 / t_0) / t_0; end tmp_2 = tmp; end
code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.6e+44], N[(t$95$1 * t$95$1), $MachinePrecision], N[(N[(-1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(c \cdot s\right)\\
t_1 := \frac{1}{c \cdot \left(x \cdot s\right)}\\
\mathbf{if}\;x \leq 2.6 \cdot 10^{+44}:\\
\;\;\;\;t\_1 \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if x < 2.5999999999999999e44Initial program 67.4%
*-un-lft-identity67.4%
add-sqr-sqrt67.3%
times-frac67.3%
Applied egg-rr97.7%
Taylor expanded in x around 0 85.4%
if 2.5999999999999999e44 < x Initial program 59.8%
Taylor expanded in x around 0 53.2%
associate-/r*53.2%
*-commutative53.2%
unpow253.2%
unpow253.2%
swap-sqr56.8%
unpow256.8%
associate-/r*56.8%
unpow256.8%
unpow256.8%
swap-sqr61.2%
unpow261.2%
*-commutative61.2%
Simplified61.2%
unpow261.2%
associate-*r*61.2%
*-commutative61.2%
associate-*l*61.3%
Applied egg-rr61.3%
Applied egg-rr62.1%
associate-/r*62.1%
*-commutative62.1%
associate-/l/62.1%
Simplified62.1%
Applied egg-rr63.5%
Final simplification80.0%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* x (* c s))))
(if (<= x 2.6e+44)
(* (/ 1.0 (* c (* x s))) (/ (/ 1.0 c) (* x s)))
(/ (/ -1.0 t_0) t_0))))
double code(double x, double c, double s) {
double t_0 = x * (c * s);
double tmp;
if (x <= 2.6e+44) {
tmp = (1.0 / (c * (x * s))) * ((1.0 / c) / (x * s));
} else {
tmp = (-1.0 / t_0) / 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 * (c * s)
if (x <= 2.6d+44) then
tmp = (1.0d0 / (c * (x * s))) * ((1.0d0 / c) / (x * s))
else
tmp = ((-1.0d0) / t_0) / t_0
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double t_0 = x * (c * s);
double tmp;
if (x <= 2.6e+44) {
tmp = (1.0 / (c * (x * s))) * ((1.0 / c) / (x * s));
} else {
tmp = (-1.0 / t_0) / t_0;
}
return tmp;
}
def code(x, c, s): t_0 = x * (c * s) tmp = 0 if x <= 2.6e+44: tmp = (1.0 / (c * (x * s))) * ((1.0 / c) / (x * s)) else: tmp = (-1.0 / t_0) / t_0 return tmp
function code(x, c, s) t_0 = Float64(x * Float64(c * s)) tmp = 0.0 if (x <= 2.6e+44) tmp = Float64(Float64(1.0 / Float64(c * Float64(x * s))) * Float64(Float64(1.0 / c) / Float64(x * s))); else tmp = Float64(Float64(-1.0 / t_0) / t_0); end return tmp end
function tmp_2 = code(x, c, s) t_0 = x * (c * s); tmp = 0.0; if (x <= 2.6e+44) tmp = (1.0 / (c * (x * s))) * ((1.0 / c) / (x * s)); else tmp = (-1.0 / t_0) / t_0; end tmp_2 = tmp; end
code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.6e+44], N[(N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(c \cdot s\right)\\
\mathbf{if}\;x \leq 2.6 \cdot 10^{+44}:\\
\;\;\;\;\frac{1}{c \cdot \left(x \cdot s\right)} \cdot \frac{\frac{1}{c}}{x \cdot s}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if x < 2.5999999999999999e44Initial program 67.4%
*-un-lft-identity67.4%
add-sqr-sqrt67.3%
times-frac67.3%
Applied egg-rr97.7%
Taylor expanded in x around 0 85.4%
associate-/r*85.4%
Simplified85.4%
if 2.5999999999999999e44 < x Initial program 59.8%
Taylor expanded in x around 0 53.2%
associate-/r*53.2%
*-commutative53.2%
unpow253.2%
unpow253.2%
swap-sqr56.8%
unpow256.8%
associate-/r*56.8%
unpow256.8%
unpow256.8%
swap-sqr61.2%
unpow261.2%
*-commutative61.2%
Simplified61.2%
unpow261.2%
associate-*r*61.2%
*-commutative61.2%
associate-*l*61.3%
Applied egg-rr61.3%
Applied egg-rr62.1%
associate-/r*62.1%
*-commutative62.1%
associate-/l/62.1%
Simplified62.1%
Applied egg-rr63.5%
Final simplification80.0%
(FPCore (x c s) :precision binary64 (/ 1.0 (* (* c s) (* x (* c (* x s))))))
double code(double x, double c, double s) {
return 1.0 / ((c * s) * (x * (c * (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 * s) * (x * (c * (x * s))))
end function
public static double code(double x, double c, double s) {
return 1.0 / ((c * s) * (x * (c * (x * s))));
}
def code(x, c, s): return 1.0 / ((c * s) * (x * (c * (x * s))))
function code(x, c, s) return Float64(1.0 / Float64(Float64(c * s) * Float64(x * Float64(c * Float64(x * s))))) end
function tmp = code(x, c, s) tmp = 1.0 / ((c * s) * (x * (c * (x * s)))); end
code[x_, c_, s_] := N[(1.0 / N[(N[(c * s), $MachinePrecision] * N[(x * N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\left(c \cdot s\right) \cdot \left(x \cdot \left(c \cdot \left(x \cdot s\right)\right)\right)}
\end{array}
Initial program 65.5%
Taylor expanded in x around 0 54.3%
associate-/r*54.1%
*-commutative54.1%
unpow254.1%
unpow254.1%
swap-sqr65.7%
unpow265.7%
associate-/r*65.8%
unpow265.8%
unpow265.8%
swap-sqr79.3%
unpow279.3%
*-commutative79.3%
Simplified79.3%
unpow279.3%
associate-*r*79.0%
*-commutative79.0%
associate-*l*77.2%
Applied egg-rr77.2%
Final simplification77.2%
(FPCore (x c s) :precision binary64 (/ 1.0 (* (* c s) (* x (* x (* c s))))))
double code(double x, double c, double s) {
return 1.0 / ((c * s) * (x * (x * (c * 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 * s) * (x * (x * (c * s))))
end function
public static double code(double x, double c, double s) {
return 1.0 / ((c * s) * (x * (x * (c * s))));
}
def code(x, c, s): return 1.0 / ((c * s) * (x * (x * (c * s))))
function code(x, c, s) return Float64(1.0 / Float64(Float64(c * s) * Float64(x * Float64(x * Float64(c * s))))) end
function tmp = code(x, c, s) tmp = 1.0 / ((c * s) * (x * (x * (c * s)))); end
code[x_, c_, s_] := N[(1.0 / N[(N[(c * s), $MachinePrecision] * N[(x * N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\left(c \cdot s\right) \cdot \left(x \cdot \left(x \cdot \left(c \cdot s\right)\right)\right)}
\end{array}
Initial program 65.5%
Taylor expanded in x around 0 54.3%
associate-/r*54.1%
*-commutative54.1%
unpow254.1%
unpow254.1%
swap-sqr65.7%
unpow265.7%
associate-/r*65.8%
unpow265.8%
unpow265.8%
swap-sqr79.3%
unpow279.3%
*-commutative79.3%
Simplified79.3%
unpow279.3%
associate-*r*79.0%
*-commutative79.0%
associate-*l*77.2%
Applied egg-rr77.2%
add-sqr-sqrt41.7%
sqrt-prod53.5%
sqr-neg53.5%
sqrt-unprod16.6%
add-sqr-sqrt38.8%
*-commutative38.8%
add-sqr-sqrt22.2%
sqrt-prod50.6%
sqr-neg50.6%
sqrt-unprod35.5%
add-sqr-sqrt77.2%
associate-*l*77.7%
pow177.7%
Applied egg-rr77.2%
unpow177.2%
associate-*r*77.7%
*-commutative77.7%
Simplified77.7%
Final simplification77.7%
(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(Float64(c * 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[(N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision] * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{c \cdot \left(\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(x \cdot s\right)\right)}
\end{array}
Initial program 65.5%
Taylor expanded in x around 0 54.3%
associate-/r*54.1%
*-commutative54.1%
unpow254.1%
unpow254.1%
swap-sqr65.7%
unpow265.7%
associate-/r*65.8%
unpow265.8%
unpow265.8%
swap-sqr79.3%
unpow279.3%
*-commutative79.3%
Simplified79.3%
*-commutative79.3%
unpow279.3%
*-commutative79.3%
associate-*r*76.9%
Applied egg-rr76.9%
Final simplification76.9%
(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(Float64(1.0 / c) / Float64(Float64(c * 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[(N[(1.0 / c), $MachinePrecision] / N[(N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision] * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{c}}{\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(x \cdot s\right)}
\end{array}
Initial program 65.5%
Taylor expanded in x around 0 54.3%
associate-/r*54.1%
*-commutative54.1%
unpow254.1%
unpow254.1%
swap-sqr65.7%
unpow265.7%
associate-/r*65.8%
unpow265.8%
unpow265.8%
swap-sqr79.3%
unpow279.3%
*-commutative79.3%
Simplified79.3%
pow-flip79.5%
*-commutative79.5%
pow-flip79.3%
unpow279.3%
metadata-eval79.3%
frac-times79.5%
associate-/r*79.5%
associate-/r*79.4%
Applied egg-rr79.4%
associate-/l/79.5%
*-commutative79.5%
frac-times77.0%
*-un-lft-identity77.0%
*-commutative77.0%
*-commutative77.0%
Applied egg-rr77.0%
Final simplification77.0%
(FPCore (x c s) :precision binary64 (let* ((t_0 (* x (* c s)))) (/ (/ 1.0 t_0) t_0)))
double code(double x, double c, double s) {
double t_0 = x * (c * s);
return (1.0 / 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 * (c * s)
code = (1.0d0 / t_0) / t_0
end function
public static double code(double x, double c, double s) {
double t_0 = x * (c * s);
return (1.0 / t_0) / t_0;
}
def code(x, c, s): t_0 = x * (c * s) return (1.0 / t_0) / t_0
function code(x, c, s) t_0 = Float64(x * Float64(c * s)) return Float64(Float64(1.0 / t_0) / t_0) end
function tmp = code(x, c, s) t_0 = x * (c * s); tmp = (1.0 / t_0) / t_0; end
code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(c \cdot s\right)\\
\frac{\frac{1}{t\_0}}{t\_0}
\end{array}
\end{array}
Initial program 65.5%
Taylor expanded in x around 0 54.3%
associate-/r*54.1%
*-commutative54.1%
unpow254.1%
unpow254.1%
swap-sqr65.7%
unpow265.7%
associate-/r*65.8%
unpow265.8%
unpow265.8%
swap-sqr79.3%
unpow279.3%
*-commutative79.3%
Simplified79.3%
unpow279.3%
associate-*r*79.0%
*-commutative79.0%
associate-*l*77.2%
Applied egg-rr77.2%
Applied egg-rr38.8%
associate-/r*38.8%
*-commutative38.8%
associate-/l/38.8%
Simplified38.8%
Applied egg-rr79.6%
Final simplification79.6%
herbie shell --seed 2024061
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))