
(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 10 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 (* (/ 1.0 (* c_m (* x s))) (pow (* (* x s) (/ c_m (cos (* x 2.0)))) -1.0)))
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))) * pow(((x * s) * (c_m / cos((x * 2.0)))), -1.0);
}
c_m = abs(c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s
code = (1.0d0 / (c_m * (x * s))) * (((x * s) * (c_m / cos((x * 2.0d0)))) ** (-1.0d0))
end function
c_m = Math.abs(c);
assert x < c_m && c_m < s;
public static double code(double x, double c_m, double s) {
return (1.0 / (c_m * (x * s))) * Math.pow(((x * s) * (c_m / Math.cos((x * 2.0)))), -1.0);
}
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))) * math.pow(((x * s) * (c_m / math.cos((x * 2.0)))), -1.0)
c_m = abs(c) x, c_m, s = sort([x, c_m, s]) function code(x, c_m, s) return Float64(Float64(1.0 / Float64(c_m * Float64(x * s))) * (Float64(Float64(x * s) * Float64(c_m / cos(Float64(x * 2.0)))) ^ -1.0)) 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))) * (((x * s) * (c_m / cos((x * 2.0)))) ^ -1.0);
end
c_m = N[Abs[c], $MachinePrecision] NOTE: x, c_m, and s should be sorted in increasing order before calling this function. code[x_, c$95$m_, s_] := N[(N[(1.0 / N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(x * s), $MachinePrecision] * N[(c$95$m / N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\frac{1}{c\_m \cdot \left(x \cdot s\right)} \cdot {\left(\left(x \cdot s\right) \cdot \frac{c\_m}{\cos \left(x \cdot 2\right)}\right)}^{-1}
\end{array}
Initial program 68.5%
associate-/r*68.6%
cos-neg68.6%
distribute-rgt-neg-out68.6%
distribute-rgt-neg-out68.6%
*-commutative68.6%
distribute-rgt-neg-in68.6%
metadata-eval68.6%
*-commutative68.6%
associate-*l*62.3%
unpow262.3%
Simplified62.3%
Applied egg-rr97.3%
clear-num97.3%
inv-pow97.3%
*-commutative97.3%
associate-/l*97.3%
*-commutative97.3%
Applied egg-rr97.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) (/ (cos (* x 2.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) * (cos((x * 2.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) * (cos((x * 2.0d0)) / 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) * (Math.cos((x * 2.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) * (math.cos((x * 2.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) * Float64(cos(Float64(x * 2.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) * (cos((x * 2.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] * N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\begin{array}{l}
t_0 := c\_m \cdot \left(x \cdot s\right)\\
\frac{1}{t\_0} \cdot \frac{\cos \left(x \cdot 2\right)}{t\_0}
\end{array}
\end{array}
Initial program 68.5%
associate-/r*68.6%
cos-neg68.6%
distribute-rgt-neg-out68.6%
distribute-rgt-neg-out68.6%
*-commutative68.6%
distribute-rgt-neg-in68.6%
metadata-eval68.6%
*-commutative68.6%
associate-*l*62.3%
unpow262.3%
Simplified62.3%
Applied egg-rr97.3%
Final simplification97.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 (* x (* c_m s)))) (/ (/ (cos (* x 2.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 = x * (c_m * s);
return (cos((x * 2.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 = x * (c_m * s)
code = (cos((x * 2.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 = x * (c_m * s);
return (Math.cos((x * 2.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 = x * (c_m * s) return (math.cos((x * 2.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(x * Float64(c_m * s)) return Float64(Float64(cos(Float64(x * 2.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 = x * (c_m * s);
tmp = (cos((x * 2.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[(x * N[(c$95$m * s), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Cos[N[(x * 2.0), $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 := x \cdot \left(c\_m \cdot s\right)\\
\frac{\frac{\cos \left(x \cdot 2\right)}{t\_0}}{t\_0}
\end{array}
\end{array}
Initial program 68.5%
associate-/r*68.6%
cos-neg68.6%
distribute-rgt-neg-out68.6%
distribute-rgt-neg-out68.6%
*-commutative68.6%
distribute-rgt-neg-in68.6%
metadata-eval68.6%
*-commutative68.6%
associate-*l*62.3%
unpow262.3%
Simplified62.3%
Applied egg-rr97.1%
associate-*l/97.1%
*-un-lft-identity97.1%
unpow297.1%
associate-/r*97.4%
*-commutative97.4%
*-commutative97.4%
associate-*l*95.4%
*-commutative95.4%
associate-*l*97.6%
Applied egg-rr97.6%
Final simplification97.6%
c_m = (fabs.f64 c) NOTE: x, c_m, and s should be sorted in increasing order before calling this function. (FPCore (x c_m s) :precision binary64 (/ (/ (cos (* x 2.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 (cos((x * 2.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 = (cos((x * 2.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 (Math.cos((x * 2.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 (math.cos((x * 2.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(Float64(cos(Float64(x * 2.0)) / c_m) / Float64(Float64(x * s) * Float64(c_m * Float64(x * s)))) end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp = code(x, c_m, s)
tmp = (cos((x * 2.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[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / c$95$m), $MachinePrecision] / N[(N[(x * s), $MachinePrecision] * N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\frac{\frac{\cos \left(x \cdot 2\right)}{c\_m}}{\left(x \cdot s\right) \cdot \left(c\_m \cdot \left(x \cdot s\right)\right)}
\end{array}
Initial program 68.5%
associate-/r*68.6%
cos-neg68.6%
distribute-rgt-neg-out68.6%
distribute-rgt-neg-out68.6%
*-commutative68.6%
distribute-rgt-neg-in68.6%
metadata-eval68.6%
*-commutative68.6%
associate-*l*62.3%
unpow262.3%
Simplified62.3%
Applied egg-rr97.3%
clear-num97.3%
inv-pow97.3%
*-commutative97.3%
associate-/l*97.3%
*-commutative97.3%
Applied egg-rr97.3%
*-commutative97.3%
unpow-197.3%
associate-*r/97.3%
associate-*r*95.4%
clear-num95.4%
associate-/r*95.4%
associate-*r*97.4%
*-commutative97.4%
associate-*r*96.3%
frac-times93.8%
div-inv93.8%
associate-*r*94.9%
Applied egg-rr94.9%
Final simplification94.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 (pow (* c_m (* x s)) -2.0))
c_m = fabs(c);
assert(x < c_m && c_m < s);
double code(double x, double c_m, double s) {
return pow((c_m * (x * s)), -2.0);
}
c_m = abs(c)
NOTE: x, c_m, and s should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s
code = (c_m * (x * s)) ** (-2.0d0)
end function
c_m = Math.abs(c);
assert x < c_m && c_m < s;
public static double code(double x, double c_m, double s) {
return Math.pow((c_m * (x * s)), -2.0);
}
c_m = math.fabs(c) [x, c_m, s] = sort([x, c_m, s]) def code(x, c_m, s): return math.pow((c_m * (x * s)), -2.0)
c_m = abs(c) x, c_m, s = sort([x, c_m, s]) function code(x, c_m, s) return Float64(c_m * Float64(x * s)) ^ -2.0 end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp = code(x, c_m, s)
tmp = (c_m * (x * s)) ^ -2.0;
end
c_m = N[Abs[c], $MachinePrecision] NOTE: x, c_m, and s should be sorted in increasing order before calling this function. code[x_, c$95$m_, s_] := N[Power[N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
{\left(c\_m \cdot \left(x \cdot s\right)\right)}^{-2}
\end{array}
Initial program 68.5%
associate-/r*68.6%
cos-neg68.6%
distribute-rgt-neg-out68.6%
distribute-rgt-neg-out68.6%
*-commutative68.6%
distribute-rgt-neg-in68.6%
metadata-eval68.6%
*-commutative68.6%
associate-*l*62.3%
unpow262.3%
Simplified62.3%
Taylor expanded in x around 0 56.4%
associate-/r*56.5%
*-commutative56.5%
unpow256.5%
unpow256.5%
swap-sqr68.8%
unpow268.8%
associate-/r*68.7%
unpow268.7%
unpow268.7%
swap-sqr78.9%
unpow278.9%
Simplified78.9%
Taylor expanded in c around 0 56.4%
*-commutative56.4%
*-commutative56.4%
unpow256.4%
unpow256.4%
swap-sqr68.7%
unpow268.7%
swap-sqr78.9%
associate-*r*77.4%
associate-*r*78.6%
associate-/l/78.8%
*-lft-identity78.8%
associate-*l/78.8%
unpow-178.8%
unpow-178.8%
pow-sqr78.8%
metadata-eval78.8%
associate-*r*79.1%
*-commutative79.1%
*-commutative79.1%
Simplified79.1%
Final simplification79.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 (/ 1.0 (* c_m (* x s))))) (* 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 = 1.0 / (c_m * (x * s));
return 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 = 1.0d0 / (c_m * (x * s))
code = 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 = 1.0 / (c_m * (x * s));
return 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 = 1.0 / (c_m * (x * s)) return 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(1.0 / Float64(c_m * Float64(x * s))) return 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 = 1.0 / (c_m * (x * s));
tmp = 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[(1.0 / N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * 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 := \frac{1}{c\_m \cdot \left(x \cdot s\right)}\\
t\_0 \cdot t\_0
\end{array}
\end{array}
Initial program 68.5%
associate-/r*68.6%
cos-neg68.6%
distribute-rgt-neg-out68.6%
distribute-rgt-neg-out68.6%
*-commutative68.6%
distribute-rgt-neg-in68.6%
metadata-eval68.6%
*-commutative68.6%
associate-*l*62.3%
unpow262.3%
Simplified62.3%
Applied egg-rr97.3%
Taylor expanded in x around 0 79.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 (* 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(Float64(-1.0 / Float64(c_m * Float64(x * s))) / Float64(c_m * Float64(x * Float64(-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[(N[(-1.0 / N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c$95$m * N[(x * (-s)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\frac{\frac{-1}{c\_m \cdot \left(x \cdot s\right)}}{c\_m \cdot \left(x \cdot \left(-s\right)\right)}
\end{array}
Initial program 68.5%
associate-/r*68.6%
cos-neg68.6%
distribute-rgt-neg-out68.6%
distribute-rgt-neg-out68.6%
*-commutative68.6%
distribute-rgt-neg-in68.6%
metadata-eval68.6%
*-commutative68.6%
associate-*l*62.3%
unpow262.3%
Simplified62.3%
Taylor expanded in x around 0 56.4%
associate-/r*56.5%
*-commutative56.5%
unpow256.5%
unpow256.5%
swap-sqr68.8%
unpow268.8%
associate-/r*68.7%
unpow268.7%
unpow268.7%
swap-sqr78.9%
unpow278.9%
Simplified78.9%
clear-num78.9%
add-sqr-sqrt78.9%
sqrt-div78.9%
metadata-eval78.9%
/-rgt-identity78.9%
sqrt-pow163.0%
metadata-eval63.0%
pow163.0%
*-commutative63.0%
associate-*l*62.3%
sqrt-div62.2%
metadata-eval62.2%
/-rgt-identity62.2%
sqrt-pow177.6%
metadata-eval77.6%
pow177.6%
*-commutative77.6%
associate-*l*78.8%
Applied egg-rr78.8%
un-div-inv78.8%
associate-*r*77.6%
*-commutative77.6%
associate-*r*78.1%
associate-*r*78.4%
*-commutative78.4%
*-commutative78.4%
frac-2neg78.4%
distribute-neg-frac78.4%
metadata-eval78.4%
associate-*r*79.1%
*-commutative79.1%
distribute-rgt-neg-in79.1%
Applied egg-rr79.1%
Final simplification79.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) (* (* 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(Float64(1.0 / 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[(N[(1.0 / c$95$m), $MachinePrecision] / N[(N[(x * s), $MachinePrecision] * N[(c$95$m * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\frac{\frac{1}{c\_m}}{\left(x \cdot s\right) \cdot \left(c\_m \cdot \left(x \cdot s\right)\right)}
\end{array}
Initial program 68.5%
associate-/r*68.6%
cos-neg68.6%
distribute-rgt-neg-out68.6%
distribute-rgt-neg-out68.6%
*-commutative68.6%
distribute-rgt-neg-in68.6%
metadata-eval68.6%
*-commutative68.6%
associate-*l*62.3%
unpow262.3%
Simplified62.3%
Taylor expanded in x around 0 56.4%
associate-/r*56.5%
*-commutative56.5%
unpow256.5%
unpow256.5%
swap-sqr68.8%
unpow268.8%
associate-/r*68.7%
unpow268.7%
unpow268.7%
swap-sqr78.9%
unpow278.9%
Simplified78.9%
clear-num78.9%
add-sqr-sqrt78.9%
sqrt-div78.9%
metadata-eval78.9%
/-rgt-identity78.9%
sqrt-pow163.0%
metadata-eval63.0%
pow163.0%
*-commutative63.0%
associate-*l*62.3%
sqrt-div62.2%
metadata-eval62.2%
/-rgt-identity62.2%
sqrt-pow177.6%
metadata-eval77.6%
pow177.6%
*-commutative77.6%
associate-*l*78.8%
Applied egg-rr78.8%
un-div-inv78.8%
associate-*r*77.6%
associate-/l/77.6%
associate-*r*79.1%
*-commutative79.1%
associate-*r*78.4%
associate-/l/77.8%
associate-*r*78.5%
Applied egg-rr78.5%
Final simplification78.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 (* x (* 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 = x * (c_m * 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 = x * (c_m * 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 = x * (c_m * 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 = x * (c_m * 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(x * Float64(c_m * s)) return Float64(1.0 / Float64(t_0 * t_0)) end
c_m = abs(c);
x, c_m, s = num2cell(sort([x, c_m, s])){:}
function tmp = code(x, c_m, s)
t_0 = x * (c_m * 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[(x * N[(c$95$m * s), $MachinePrecision]), $MachinePrecision]}, N[(1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
c_m = \left|c\right|
\\
[x, c_m, s] = \mathsf{sort}([x, c_m, s])\\
\\
\begin{array}{l}
t_0 := x \cdot \left(c\_m \cdot s\right)\\
\frac{1}{t\_0 \cdot t\_0}
\end{array}
\end{array}
Initial program 68.5%
associate-/r*68.6%
cos-neg68.6%
distribute-rgt-neg-out68.6%
distribute-rgt-neg-out68.6%
*-commutative68.6%
distribute-rgt-neg-in68.6%
metadata-eval68.6%
*-commutative68.6%
associate-*l*62.3%
unpow262.3%
Simplified62.3%
Taylor expanded in x around 0 56.4%
associate-/r*56.5%
*-commutative56.5%
unpow256.5%
unpow256.5%
swap-sqr68.8%
unpow268.8%
associate-/r*68.7%
unpow268.7%
unpow268.7%
swap-sqr78.9%
unpow278.9%
Simplified78.9%
unpow278.9%
*-commutative78.9%
associate-*l*77.4%
*-commutative77.4%
associate-*l*78.6%
Applied egg-rr78.6%
Final simplification78.6%
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) (* c_m 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 * ((x * s) * (c_m * 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 * ((x * s) * (c_m * 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 * ((x * s) * (c_m * 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 * ((x * s) * (c_m * 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(Float64(x * s) * Float64(c_m * 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 * ((x * s) * (c_m * 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[(N[(x * s), $MachinePrecision] * N[(c$95$m * x), $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(c\_m \cdot x\right)\right)\right)}
\end{array}
Initial program 68.5%
associate-/r*68.6%
cos-neg68.6%
distribute-rgt-neg-out68.6%
distribute-rgt-neg-out68.6%
*-commutative68.6%
distribute-rgt-neg-in68.6%
metadata-eval68.6%
*-commutative68.6%
associate-*l*62.3%
unpow262.3%
Simplified62.3%
Taylor expanded in x around 0 56.4%
associate-/r*56.5%
*-commutative56.5%
unpow256.5%
unpow256.5%
swap-sqr68.8%
unpow268.8%
associate-/r*68.7%
unpow268.7%
unpow268.7%
swap-sqr78.9%
unpow278.9%
Simplified78.9%
unpow278.9%
associate-*r*78.2%
associate-*l*76.7%
*-commutative76.7%
associate-*l*76.1%
Applied egg-rr76.1%
associate-*r*77.9%
/-rgt-identity77.9%
associate-*r*78.2%
*-commutative78.2%
associate-*r*79.4%
associate-/r/79.4%
associate-*r*78.2%
associate-/r*78.2%
*-commutative78.2%
associate-/r*78.2%
Applied egg-rr78.2%
associate-/l*77.5%
associate-/r/76.8%
associate-/l/76.8%
associate-/r/76.8%
/-rgt-identity76.8%
*-commutative76.8%
Simplified76.8%
Final simplification76.8%
herbie shell --seed 2024144
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))