
(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 16 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}
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 (+ x x))) (t_1 (* c_m (* x s))))
(if (<=
(/ (cos (* 2.0 x)) (* (pow c_m 2.0) (* x (* x (pow s 2.0)))))
INFINITY)
(/ (/ t_0 t_1) t_1)
(/ t_0 (pow (* x (* c_m 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 = cos((x + x));
double t_1 = c_m * (x * s);
double tmp;
if ((cos((2.0 * x)) / (pow(c_m, 2.0) * (x * (x * pow(s, 2.0))))) <= ((double) INFINITY)) {
tmp = (t_0 / t_1) / t_1;
} else {
tmp = t_0 / pow((x * (c_m * s)), 2.0);
}
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 = Math.cos((x + x));
double t_1 = c_m * (x * s);
double tmp;
if ((Math.cos((2.0 * x)) / (Math.pow(c_m, 2.0) * (x * (x * Math.pow(s, 2.0))))) <= Double.POSITIVE_INFINITY) {
tmp = (t_0 / t_1) / t_1;
} else {
tmp = t_0 / Math.pow((x * (c_m * 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 = math.cos((x + x)) t_1 = c_m * (x * s) tmp = 0 if (math.cos((2.0 * x)) / (math.pow(c_m, 2.0) * (x * (x * math.pow(s, 2.0))))) <= math.inf: tmp = (t_0 / t_1) / t_1 else: tmp = t_0 / math.pow((x * (c_m * 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 = cos(Float64(x + x)) t_1 = Float64(c_m * Float64(x * s)) tmp = 0.0 if (Float64(cos(Float64(2.0 * x)) / Float64((c_m ^ 2.0) * Float64(x * Float64(x * (s ^ 2.0))))) <= Inf) tmp = Float64(Float64(t_0 / t_1) / t_1); else tmp = Float64(t_0 / (Float64(x * Float64(c_m * 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 = cos((x + x));
t_1 = c_m * (x * s);
tmp = 0.0;
if ((cos((2.0 * x)) / ((c_m ^ 2.0) * (x * (x * (s ^ 2.0))))) <= Inf)
tmp = (t_0 / t_1) / t_1;
else
tmp = t_0 / ((x * (c_m * 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[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / 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[(t$95$0 / t$95$1), $MachinePrecision] / t$95$1), $MachinePrecision], N[(t$95$0 / N[Power[N[(x * N[(c$95$m * s), $MachinePrecision]), $MachinePrecision], 2.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 := \cos \left(x + x\right)\\
t_1 := c\_m \cdot \left(x \cdot s\right)\\
\mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{{c\_m}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq \infty:\\
\;\;\;\;\frac{\frac{t\_0}{t\_1}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{{\left(x \cdot \left(c\_m \cdot s\right)\right)}^{2}}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < +inf.0Initial program 77.2%
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
pow-prod-downN/A
pow2N/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6498.1
Applied egg-rr98.1%
count-2N/A
+-lowering-+.f6498.1
Applied egg-rr98.1%
count-2N/A
unpow2N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6499.6
Applied egg-rr99.6%
if +inf.0 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) Initial program 0.0%
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
pow-prod-downN/A
pow2N/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6497.5
Applied egg-rr97.5%
count-2N/A
+-lowering-+.f6497.5
Applied egg-rr97.5%
Final simplification99.1%
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 (<=
(/ (cos (* 2.0 x)) (* (pow c_m 2.0) (* x (* x (pow s 2.0)))))
-2e-199)
(/
(/
(fma
(* x x)
(*
(/ x (* c_m s))
(* x (fma x (* x -0.08888888888888889) 0.6666666666666666)))
(* (fma x (* x -2.0) 1.0) (/ 1.0 (* c_m s))))
x)
t_0)
(/ (/ 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);
double tmp;
if ((cos((2.0 * x)) / (pow(c_m, 2.0) * (x * (x * pow(s, 2.0))))) <= -2e-199) {
tmp = (fma((x * x), ((x / (c_m * s)) * (x * fma(x, (x * -0.08888888888888889), 0.6666666666666666))), (fma(x, (x * -2.0), 1.0) * (1.0 / (c_m * s)))) / x) / t_0;
} else {
tmp = (1.0 / t_0) / 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 (Float64(cos(Float64(2.0 * x)) / Float64((c_m ^ 2.0) * Float64(x * Float64(x * (s ^ 2.0))))) <= -2e-199) tmp = Float64(Float64(fma(Float64(x * x), Float64(Float64(x / Float64(c_m * s)) * Float64(x * fma(x, Float64(x * -0.08888888888888889), 0.6666666666666666))), Float64(fma(x, Float64(x * -2.0), 1.0) * Float64(1.0 / Float64(c_m * s)))) / x) / t_0); else tmp = Float64(Float64(1.0 / t_0) / t_0); end return 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[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c$95$m, 2.0], $MachinePrecision] * N[(x * N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-199], N[(N[(N[(N[(x * x), $MachinePrecision] * N[(N[(x / N[(c$95$m * s), $MachinePrecision]), $MachinePrecision] * N[(x * N[(x * N[(x * -0.08888888888888889), $MachinePrecision] + 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x * N[(x * -2.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(1.0 / N[(c$95$m * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$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 := c\_m \cdot \left(x \cdot s\right)\\
\mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{{c\_m}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq -2 \cdot 10^{-199}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x \cdot x, \frac{x}{c\_m \cdot s} \cdot \left(x \cdot \mathsf{fma}\left(x, x \cdot -0.08888888888888889, 0.6666666666666666\right)\right), \mathsf{fma}\left(x, x \cdot -2, 1\right) \cdot \frac{1}{c\_m \cdot s}\right)}{x}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < -1.99999999999999996e-199Initial program 52.1%
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
pow-prod-downN/A
pow2N/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6494.6
Applied egg-rr94.6%
count-2N/A
+-lowering-+.f6494.6
Applied egg-rr94.6%
count-2N/A
unpow2N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6499.0
Applied egg-rr99.0%
Taylor expanded in x around 0
Simplified29.5%
if -1.99999999999999996e-199 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) Initial program 62.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6475.8
Simplified75.8%
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
swap-sqrN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6485.3
Applied egg-rr85.3%
Final simplification80.9%
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 (<=
(/ (cos (* 2.0 x)) (* (pow c_m 2.0) (* x (* x (pow s 2.0)))))
-2e-199)
(/
(fma
(* x x)
(fma x (* x (fma (* x x) -0.08888888888888889 0.6666666666666666)) -2.0)
1.0)
(* x (* x (* s (* c_m (* c_m 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);
double tmp;
if ((cos((2.0 * x)) / (pow(c_m, 2.0) * (x * (x * pow(s, 2.0))))) <= -2e-199) {
tmp = fma((x * x), fma(x, (x * fma((x * x), -0.08888888888888889, 0.6666666666666666)), -2.0), 1.0) / (x * (x * (s * (c_m * (c_m * s)))));
} else {
tmp = (1.0 / t_0) / 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 (Float64(cos(Float64(2.0 * x)) / Float64((c_m ^ 2.0) * Float64(x * Float64(x * (s ^ 2.0))))) <= -2e-199) tmp = Float64(fma(Float64(x * x), fma(x, Float64(x * fma(Float64(x * x), -0.08888888888888889, 0.6666666666666666)), -2.0), 1.0) / Float64(x * Float64(x * Float64(s * Float64(c_m * Float64(c_m * s)))))); else tmp = Float64(Float64(1.0 / t_0) / t_0); end return 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[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c$95$m, 2.0], $MachinePrecision] * N[(x * N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-199], N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * N[(N[(x * x), $MachinePrecision] * -0.08888888888888889 + 0.6666666666666666), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x * N[(x * N[(s * N[(c$95$m * N[(c$95$m * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$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 := c\_m \cdot \left(x \cdot s\right)\\
\mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{{c\_m}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq -2 \cdot 10^{-199}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, -0.08888888888888889, 0.6666666666666666\right), -2\right), 1\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c\_m \cdot \left(c\_m \cdot s\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < -1.99999999999999996e-199Initial program 52.1%
Taylor expanded in x around inf
/-lowering-/.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6452.0
Simplified52.0%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6429.5
Simplified29.5%
if -1.99999999999999996e-199 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) Initial program 62.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6475.8
Simplified75.8%
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
swap-sqrN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6485.3
Applied egg-rr85.3%
Final simplification80.9%
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 (<=
(/ (cos (* 2.0 x)) (* (pow c_m 2.0) (* x (* x (pow s 2.0)))))
-2e-199)
(/
(fma
x
(*
x
(fma
(* x x)
(fma x (* x -0.08888888888888889) 0.6666666666666666)
-2.0))
1.0)
(* (* x s) (* s (* x (* c_m c_m)))))
(/ (/ 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);
double tmp;
if ((cos((2.0 * x)) / (pow(c_m, 2.0) * (x * (x * pow(s, 2.0))))) <= -2e-199) {
tmp = fma(x, (x * fma((x * x), fma(x, (x * -0.08888888888888889), 0.6666666666666666), -2.0)), 1.0) / ((x * s) * (s * (x * (c_m * c_m))));
} else {
tmp = (1.0 / t_0) / 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 (Float64(cos(Float64(2.0 * x)) / Float64((c_m ^ 2.0) * Float64(x * Float64(x * (s ^ 2.0))))) <= -2e-199) tmp = Float64(fma(x, Float64(x * fma(Float64(x * x), fma(x, Float64(x * -0.08888888888888889), 0.6666666666666666), -2.0)), 1.0) / Float64(Float64(x * s) * Float64(s * Float64(x * Float64(c_m * c_m))))); else tmp = Float64(Float64(1.0 / t_0) / t_0); end return 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[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c$95$m, 2.0], $MachinePrecision] * N[(x * N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-199], N[(N[(x * N[(x * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * -0.08888888888888889), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[(x * s), $MachinePrecision] * N[(s * N[(x * N[(c$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$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 := c\_m \cdot \left(x \cdot s\right)\\
\mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{{c\_m}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq -2 \cdot 10^{-199}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot -0.08888888888888889, 0.6666666666666666\right), -2\right), 1\right)}{\left(x \cdot s\right) \cdot \left(s \cdot \left(x \cdot \left(c\_m \cdot c\_m\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < -1.99999999999999996e-199Initial program 52.1%
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f6466.4
Applied egg-rr66.4%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6429.0
Simplified29.0%
if -1.99999999999999996e-199 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) Initial program 62.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6475.8
Simplified75.8%
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
swap-sqrN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6485.3
Applied egg-rr85.3%
Final simplification80.9%
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 (<=
(/ (cos (* 2.0 x)) (* (pow c_m 2.0) (* x (* x (pow s 2.0)))))
-2e-199)
(/ (/ (fma x (* x -2.0) 1.0) t_0) t_0)
(/ (/ 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);
double tmp;
if ((cos((2.0 * x)) / (pow(c_m, 2.0) * (x * (x * pow(s, 2.0))))) <= -2e-199) {
tmp = (fma(x, (x * -2.0), 1.0) / t_0) / t_0;
} else {
tmp = (1.0 / t_0) / 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 (Float64(cos(Float64(2.0 * x)) / Float64((c_m ^ 2.0) * Float64(x * Float64(x * (s ^ 2.0))))) <= -2e-199) tmp = Float64(Float64(fma(x, Float64(x * -2.0), 1.0) / t_0) / t_0); else tmp = Float64(Float64(1.0 / t_0) / t_0); end return 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[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c$95$m, 2.0], $MachinePrecision] * N[(x * N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-199], N[(N[(N[(x * N[(x * -2.0), $MachinePrecision] + 1.0), $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$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 := c\_m \cdot \left(x \cdot s\right)\\
\mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{{c\_m}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq -2 \cdot 10^{-199}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x, x \cdot -2, 1\right)}{t\_0}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < -1.99999999999999996e-199Initial program 52.1%
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
pow-prod-downN/A
pow2N/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6494.6
Applied egg-rr94.6%
count-2N/A
+-lowering-+.f6494.6
Applied egg-rr94.6%
count-2N/A
unpow2N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6499.0
Applied egg-rr99.0%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6429.3
Simplified29.3%
if -1.99999999999999996e-199 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) Initial program 62.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6475.8
Simplified75.8%
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
swap-sqrN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6485.3
Applied egg-rr85.3%
Final simplification80.9%
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 (<=
(/ (cos (* 2.0 x)) (* (pow c_m 2.0) (* x (* x (pow s 2.0)))))
-2e-199)
(/ (fma x (* x -2.0) 1.0) (* x (* x (* s (* c_m (* c_m 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);
double tmp;
if ((cos((2.0 * x)) / (pow(c_m, 2.0) * (x * (x * pow(s, 2.0))))) <= -2e-199) {
tmp = fma(x, (x * -2.0), 1.0) / (x * (x * (s * (c_m * (c_m * s)))));
} else {
tmp = (1.0 / t_0) / 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 (Float64(cos(Float64(2.0 * x)) / Float64((c_m ^ 2.0) * Float64(x * Float64(x * (s ^ 2.0))))) <= -2e-199) tmp = Float64(fma(x, Float64(x * -2.0), 1.0) / Float64(x * Float64(x * Float64(s * Float64(c_m * Float64(c_m * s)))))); else tmp = Float64(Float64(1.0 / t_0) / t_0); end return 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[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c$95$m, 2.0], $MachinePrecision] * N[(x * N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-199], N[(N[(x * N[(x * -2.0), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x * N[(x * N[(s * N[(c$95$m * N[(c$95$m * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$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 := c\_m \cdot \left(x \cdot s\right)\\
\mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{{c\_m}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq -2 \cdot 10^{-199}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x \cdot -2, 1\right)}{x \cdot \left(x \cdot \left(s \cdot \left(c\_m \cdot \left(c\_m \cdot s\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < -1.99999999999999996e-199Initial program 52.1%
Taylor expanded in x around inf
/-lowering-/.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6452.0
Simplified52.0%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6429.2
Simplified29.2%
if -1.99999999999999996e-199 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) Initial program 62.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6475.8
Simplified75.8%
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
swap-sqrN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6485.3
Applied egg-rr85.3%
Final simplification80.9%
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 (+ x x))) (t_1 (* c_m (* x s))))
(if (<= x 1.1e-145)
(/ 1.0 (* (* x s) (* c_m t_1)))
(if (<= x 5e+127)
(/ t_0 (* (* c_m s) (* (* c_m s) (* x x))))
(/ t_0 (* s (* c_m (* x t_1))))))))c_m = fabs(c);
assert(x < c_m && c_m < s);
double code(double x, double c_m, double s) {
double t_0 = cos((x + x));
double t_1 = c_m * (x * s);
double tmp;
if (x <= 1.1e-145) {
tmp = 1.0 / ((x * s) * (c_m * t_1));
} else if (x <= 5e+127) {
tmp = t_0 / ((c_m * s) * ((c_m * s) * (x * x)));
} else {
tmp = t_0 / (s * (c_m * (x * t_1)));
}
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((x + x))
t_1 = c_m * (x * s)
if (x <= 1.1d-145) then
tmp = 1.0d0 / ((x * s) * (c_m * t_1))
else if (x <= 5d+127) then
tmp = t_0 / ((c_m * s) * ((c_m * s) * (x * x)))
else
tmp = t_0 / (s * (c_m * (x * t_1)))
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((x + x));
double t_1 = c_m * (x * s);
double tmp;
if (x <= 1.1e-145) {
tmp = 1.0 / ((x * s) * (c_m * t_1));
} else if (x <= 5e+127) {
tmp = t_0 / ((c_m * s) * ((c_m * s) * (x * x)));
} else {
tmp = t_0 / (s * (c_m * (x * t_1)));
}
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((x + x)) t_1 = c_m * (x * s) tmp = 0 if x <= 1.1e-145: tmp = 1.0 / ((x * s) * (c_m * t_1)) elif x <= 5e+127: tmp = t_0 / ((c_m * s) * ((c_m * s) * (x * x))) else: tmp = t_0 / (s * (c_m * (x * t_1))) 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(x + x)) t_1 = Float64(c_m * Float64(x * s)) tmp = 0.0 if (x <= 1.1e-145) tmp = Float64(1.0 / Float64(Float64(x * s) * Float64(c_m * t_1))); elseif (x <= 5e+127) tmp = Float64(t_0 / Float64(Float64(c_m * s) * Float64(Float64(c_m * s) * Float64(x * x)))); else tmp = Float64(t_0 / Float64(s * Float64(c_m * Float64(x * t_1)))); 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((x + x));
t_1 = c_m * (x * s);
tmp = 0.0;
if (x <= 1.1e-145)
tmp = 1.0 / ((x * s) * (c_m * t_1));
elseif (x <= 5e+127)
tmp = t_0 / ((c_m * s) * ((c_m * s) * (x * x)));
else
tmp = t_0 / (s * (c_m * (x * t_1)));
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[(x + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.1e-145], N[(1.0 / N[(N[(x * s), $MachinePrecision] * N[(c$95$m * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5e+127], N[(t$95$0 / N[(N[(c$95$m * s), $MachinePrecision] * N[(N[(c$95$m * s), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(s * N[(c$95$m * N[(x * t$95$1), $MachinePrecision]), $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 := \cos \left(x + x\right)\\
t_1 := c\_m \cdot \left(x \cdot s\right)\\
\mathbf{if}\;x \leq 1.1 \cdot 10^{-145}:\\
\;\;\;\;\frac{1}{\left(x \cdot s\right) \cdot \left(c\_m \cdot t\_1\right)}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+127}:\\
\;\;\;\;\frac{t\_0}{\left(c\_m \cdot s\right) \cdot \left(\left(c\_m \cdot s\right) \cdot \left(x \cdot x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{s \cdot \left(c\_m \cdot \left(x \cdot t\_1\right)\right)}\\
\end{array}
\end{array}
if x < 1.1e-145Initial program 59.8%
Taylor expanded in x around 0
/-lowering-/.f64N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6471.8
Simplified71.8%
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
swap-sqrN/A
associate-*l*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6481.1
Applied egg-rr81.1%
if 1.1e-145 < x < 5.0000000000000004e127Initial program 66.3%
unpow2N/A
associate-*l*N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6470.7
Applied egg-rr70.7%
count-2N/A
associate-/l/N/A
/-lowering-/.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6499.4
Applied egg-rr99.4%
if 5.0000000000000004e127 < x Initial program 60.8%
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
pow-prod-downN/A
pow2N/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6497.4
Applied egg-rr97.4%
count-2N/A
+-lowering-+.f6497.4
Applied egg-rr97.4%
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6495.8
Applied egg-rr95.8%
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6487.8
Applied egg-rr87.8%
Final simplification85.5%
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 (+ x x))) (t_1 (* c_m (* x s))))
(if (<= x 2.7e+50)
(/ t_0 (* t_1 t_1))
(/ t_0 (* 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 t_0 = cos((x + x));
double t_1 = c_m * (x * s);
double tmp;
if (x <= 2.7e+50) {
tmp = t_0 / (t_1 * t_1);
} else {
tmp = t_0 / (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((x + x))
t_1 = c_m * (x * s)
if (x <= 2.7d+50) then
tmp = t_0 / (t_1 * t_1)
else
tmp = t_0 / (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 t_0 = Math.cos((x + x));
double t_1 = c_m * (x * s);
double tmp;
if (x <= 2.7e+50) {
tmp = t_0 / (t_1 * t_1);
} else {
tmp = t_0 / (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): t_0 = math.cos((x + x)) t_1 = c_m * (x * s) tmp = 0 if x <= 2.7e+50: tmp = t_0 / (t_1 * t_1) else: tmp = t_0 / (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) t_0 = cos(Float64(x + x)) t_1 = Float64(c_m * Float64(x * s)) tmp = 0.0 if (x <= 2.7e+50) tmp = Float64(t_0 / Float64(t_1 * t_1)); else tmp = Float64(t_0 / Float64(s * Float64(x * Float64(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)
t_0 = cos((x + x));
t_1 = c_m * (x * s);
tmp = 0.0;
if (x <= 2.7e+50)
tmp = t_0 / (t_1 * t_1);
else
tmp = t_0 / (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_] := Block[{t$95$0 = N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.7e+50], N[(t$95$0 / N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(s * N[(x * N[(N[(c$95$m * s), $MachinePrecision] * N[(x * c$95$m), $MachinePrecision]), $MachinePrecision]), $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 := \cos \left(x + x\right)\\
t_1 := c\_m \cdot \left(x \cdot s\right)\\
\mathbf{if}\;x \leq 2.7 \cdot 10^{+50}:\\
\;\;\;\;\frac{t\_0}{t\_1 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{s \cdot \left(x \cdot \left(\left(c\_m \cdot s\right) \cdot \left(x \cdot c\_m\right)\right)\right)}\\
\end{array}
\end{array}
if x < 2.7e50Initial program 62.2%
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
pow-prod-downN/A
pow2N/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6498.0
Applied egg-rr98.0%
unpow2N/A
swap-sqrN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
/-lowering-/.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
swap-sqrN/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6497.9
Applied egg-rr97.9%
if 2.7e50 < x Initial program 57.4%
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
pow-prod-downN/A
pow2N/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6497.8
Applied egg-rr97.8%
count-2N/A
+-lowering-+.f6497.8
Applied egg-rr97.8%
unpow2N/A
associate-*l*N/A
associate-*l*N/A
swap-sqrN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6477.3
Applied egg-rr77.3%
Final simplification93.7%
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 (<= x 1.65e-176)
(/ 1.0 (* (* x s) (* c_m t_0)))
(/ (cos (+ x x)) (* (* 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 (x <= 1.65e-176) {
tmp = 1.0 / ((x * s) * (c_m * t_0));
} else {
tmp = cos((x + x)) / ((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 (x <= 1.65d-176) then
tmp = 1.0d0 / ((x * s) * (c_m * t_0))
else
tmp = cos((x + x)) / ((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 (x <= 1.65e-176) {
tmp = 1.0 / ((x * s) * (c_m * t_0));
} else {
tmp = Math.cos((x + x)) / ((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 x <= 1.65e-176: tmp = 1.0 / ((x * s) * (c_m * t_0)) else: tmp = math.cos((x + x)) / ((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 (x <= 1.65e-176) tmp = Float64(1.0 / Float64(Float64(x * s) * Float64(c_m * t_0))); else tmp = Float64(cos(Float64(x + x)) / 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 (x <= 1.65e-176)
tmp = 1.0 / ((x * s) * (c_m * t_0));
else
tmp = cos((x + x)) / ((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[x, 1.65e-176], N[(1.0 / N[(N[(x * s), $MachinePrecision] * N[(c$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / 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}\;x \leq 1.65 \cdot 10^{-176}:\\
\;\;\;\;\frac{1}{\left(x \cdot s\right) \cdot \left(c\_m \cdot t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x + x\right)}{\left(c\_m \cdot s\right) \cdot \left(x \cdot t\_0\right)}\\
\end{array}
\end{array}
if x < 1.65000000000000006e-176Initial program 59.8%
Taylor expanded in x around 0
/-lowering-/.f64N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6470.1
Simplified70.1%
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
swap-sqrN/A
associate-*l*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6479.9
Applied egg-rr79.9%
if 1.65000000000000006e-176 < x Initial program 63.5%
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
pow-prod-downN/A
pow2N/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6498.6
Applied egg-rr98.6%
count-2N/A
+-lowering-+.f6498.6
Applied egg-rr98.6%
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6494.6
Applied egg-rr94.6%
Final simplification85.5%
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 (<= x 1.3e-11)
(/ (/ 1.0 t_0) t_0)
(/ (cos (+ x x)) (* s (* c_m (* 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 (x <= 1.3e-11) {
tmp = (1.0 / t_0) / t_0;
} else {
tmp = cos((x + x)) / (s * (c_m * (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 (x <= 1.3d-11) then
tmp = (1.0d0 / t_0) / t_0
else
tmp = cos((x + x)) / (s * (c_m * (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 (x <= 1.3e-11) {
tmp = (1.0 / t_0) / t_0;
} else {
tmp = Math.cos((x + x)) / (s * (c_m * (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 x <= 1.3e-11: tmp = (1.0 / t_0) / t_0 else: tmp = math.cos((x + x)) / (s * (c_m * (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 (x <= 1.3e-11) tmp = Float64(Float64(1.0 / t_0) / t_0); else tmp = Float64(cos(Float64(x + x)) / Float64(s * Float64(c_m * 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 (x <= 1.3e-11)
tmp = (1.0 / t_0) / t_0;
else
tmp = cos((x + x)) / (s * (c_m * (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[x, 1.3e-11], N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / N[(s * N[(c$95$m * N[(x * t$95$0), $MachinePrecision]), $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}\;x \leq 1.3 \cdot 10^{-11}:\\
\;\;\;\;\frac{\frac{1}{t\_0}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x + x\right)}{s \cdot \left(c\_m \cdot \left(x \cdot t\_0\right)\right)}\\
\end{array}
\end{array}
if x < 1.3e-11Initial program 63.2%
Taylor expanded in x around 0
/-lowering-/.f64N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6473.9
Simplified73.9%
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
swap-sqrN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6484.8
Applied egg-rr84.8%
if 1.3e-11 < x Initial program 55.4%
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
pow-prod-downN/A
pow2N/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6498.1
Applied egg-rr98.1%
count-2N/A
+-lowering-+.f6498.1
Applied egg-rr98.1%
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6492.4
Applied egg-rr92.4%
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6485.3
Applied egg-rr85.3%
Final simplification84.9%
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)))) (/ (/ (cos (+ x x)) 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 (cos((x + x)) / 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 = (cos((x + x)) / 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 (Math.cos((x + x)) / 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 (math.cos((x + x)) / 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(Float64(cos(Float64(x + x)) / 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 = (cos((x + x)) / 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[(N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$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 := c\_m \cdot \left(x \cdot s\right)\\
\frac{\frac{\cos \left(x + x\right)}{t\_0}}{t\_0}
\end{array}
\end{array}
Initial program 61.2%
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
pow-prod-downN/A
pow2N/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6497.9
Applied egg-rr97.9%
count-2N/A
+-lowering-+.f6497.9
Applied egg-rr97.9%
count-2N/A
unpow2N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6498.4
Applied egg-rr98.4%
Final simplification98.4%
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)))) (/ (cos (+ x x)) (* 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 cos((x + x)) / (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 = cos((x + x)) / (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 Math.cos((x + x)) / (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 math.cos((x + x)) / (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(cos(Float64(x + x)) / 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 = cos((x + x)) / (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[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / 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{\cos \left(x + x\right)}{t\_0 \cdot t\_0}
\end{array}
\end{array}
Initial program 61.2%
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
pow-prod-downN/A
pow2N/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6497.9
Applied egg-rr97.9%
unpow2N/A
swap-sqrN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
/-lowering-/.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
swap-sqrN/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6498.3
Applied egg-rr98.3%
Final simplification98.3%
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(Float64(1.0 / 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[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$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 := c\_m \cdot \left(x \cdot s\right)\\
\frac{\frac{1}{t\_0}}{t\_0}
\end{array}
\end{array}
Initial program 61.2%
Taylor expanded in x around 0
/-lowering-/.f64N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6469.9
Simplified69.9%
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
swap-sqrN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6478.7
Applied egg-rr78.7%
Final simplification78.7%
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) (* 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) * (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) * (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) * (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) * (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(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 = 1.0 / (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[(1.0 / N[(c$95$m * N[(N[(x * s), $MachinePrecision] * 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}{c\_m \cdot \left(\left(x \cdot s\right) \cdot \left(c\_m \cdot \left(x \cdot s\right)\right)\right)}
\end{array}
Initial program 61.2%
Taylor expanded in x around 0
/-lowering-/.f64N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6469.9
Simplified69.9%
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
swap-sqrN/A
associate-*l*N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6476.4
Applied egg-rr76.4%
Final simplification76.4%
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 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 * (s * ((x * 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 * (s * ((x * 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 * (s * ((x * 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 * (s * ((x * 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(1.0 / Float64(c_m * Float64(s * Float64(Float64(x * s) * Float64(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 * (s * ((x * 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[(1.0 / N[(c$95$m * N[(s * N[(N[(x * s), $MachinePrecision] * N[(x * c$95$m), $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}{c\_m \cdot \left(s \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot c\_m\right)\right)\right)}
\end{array}
Initial program 61.2%
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
pow-prod-downN/A
pow2N/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6497.9
Applied egg-rr97.9%
Taylor expanded in x around 0
/-lowering-/.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6465.0
Simplified65.0%
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6473.1
Applied egg-rr73.1%
Final simplification73.1%
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 (* s (* c_m (* x x)))))))
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 * (s * (c_m * (x * x)))));
}
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 * (s * (c_m * (x * x)))))
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 * (s * (c_m * (x * x)))));
}
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 * (s * (c_m * (x * x)))))
c_m = abs(c) x, c_m, s = sort([x, c_m, s]) function code(x, c_m, s) return Float64(1.0 / Float64(c_m * Float64(s * Float64(s * Float64(c_m * Float64(x * x)))))) 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 * (s * (c_m * (x * x)))));
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[(c$95$m * N[(s * N[(s * N[(c$95$m * N[(x * x), $MachinePrecision]), $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}{c\_m \cdot \left(s \cdot \left(s \cdot \left(c\_m \cdot \left(x \cdot x\right)\right)\right)\right)}
\end{array}
Initial program 61.2%
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
pow-prod-downN/A
pow2N/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6497.9
Applied egg-rr97.9%
Taylor expanded in x around 0
/-lowering-/.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6465.0
Simplified65.0%
herbie shell --seed 2024199
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))