
(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 9 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) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (* (/ (/ 1.0 c_m) (* s_m x)) (/ (/ (cos (* x 2.0)) (* s_m x)) c_m)))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
return ((1.0 / c_m) / (s_m * x)) * ((cos((x * 2.0)) / (s_m * x)) / c_m);
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = ((1.0d0 / c_m) / (s_m * x)) * ((cos((x * 2.0d0)) / (s_m * x)) / c_m)
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
return ((1.0 / c_m) / (s_m * x)) * ((Math.cos((x * 2.0)) / (s_m * x)) / c_m);
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): return ((1.0 / c_m) / (s_m * x)) * ((math.cos((x * 2.0)) / (s_m * x)) / c_m)
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) return Float64(Float64(Float64(1.0 / c_m) / Float64(s_m * x)) * Float64(Float64(cos(Float64(x * 2.0)) / Float64(s_m * x)) / c_m)) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
tmp = ((1.0 / c_m) / (s_m * x)) * ((cos((x * 2.0)) / (s_m * x)) / c_m);
end
c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. code[x_, c$95$m_, s$95$m_] := N[(N[(N[(1.0 / c$95$m), $MachinePrecision] / N[(s$95$m * x), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s$95$m * x), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\frac{\frac{1}{c\_m}}{s\_m \cdot x} \cdot \frac{\frac{\cos \left(x \cdot 2\right)}{s\_m \cdot x}}{c\_m}
\end{array}
Initial program 65.8%
associate-/r*65.6%
cos-neg65.6%
distribute-rgt-neg-out65.6%
distribute-rgt-neg-out65.6%
*-commutative65.6%
distribute-rgt-neg-in65.6%
metadata-eval65.6%
*-commutative65.6%
associate-*l*59.1%
unpow259.1%
Simplified59.1%
Applied egg-rr95.7%
Taylor expanded in c around 0 95.7%
associate-/r*95.7%
Simplified95.7%
associate-/r*95.6%
div-inv95.6%
*-commutative95.6%
Applied egg-rr95.6%
associate-*l/95.6%
un-div-inv95.6%
Applied egg-rr95.6%
Final simplification95.6%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (* (/ (/ 1.0 c_m) (* s_m x)) (/ (cos (* x 2.0)) (* c_m (* s_m x)))))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
return ((1.0 / c_m) / (s_m * x)) * (cos((x * 2.0)) / (c_m * (s_m * x)));
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = ((1.0d0 / c_m) / (s_m * x)) * (cos((x * 2.0d0)) / (c_m * (s_m * x)))
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
return ((1.0 / c_m) / (s_m * x)) * (Math.cos((x * 2.0)) / (c_m * (s_m * x)));
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): return ((1.0 / c_m) / (s_m * x)) * (math.cos((x * 2.0)) / (c_m * (s_m * x)))
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) return Float64(Float64(Float64(1.0 / c_m) / Float64(s_m * x)) * Float64(cos(Float64(x * 2.0)) / Float64(c_m * Float64(s_m * x)))) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
tmp = ((1.0 / c_m) / (s_m * x)) * (cos((x * 2.0)) / (c_m * (s_m * x)));
end
c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. code[x_, c$95$m_, s$95$m_] := N[(N[(N[(1.0 / c$95$m), $MachinePrecision] / N[(s$95$m * x), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\frac{\frac{1}{c\_m}}{s\_m \cdot x} \cdot \frac{\cos \left(x \cdot 2\right)}{c\_m \cdot \left(s\_m \cdot x\right)}
\end{array}
Initial program 65.8%
associate-/r*65.6%
cos-neg65.6%
distribute-rgt-neg-out65.6%
distribute-rgt-neg-out65.6%
*-commutative65.6%
distribute-rgt-neg-in65.6%
metadata-eval65.6%
*-commutative65.6%
associate-*l*59.1%
unpow259.1%
Simplified59.1%
Applied egg-rr95.7%
Taylor expanded in c around 0 95.7%
associate-/r*95.7%
Simplified95.7%
Final simplification95.7%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (let* ((t_0 (* c_m (* s_m x)))) (* (/ (cos (* x 2.0)) t_0) (/ 1.0 t_0))))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
double t_0 = c_m * (s_m * x);
return (cos((x * 2.0)) / t_0) * (1.0 / t_0);
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
t_0 = c_m * (s_m * x)
code = (cos((x * 2.0d0)) / t_0) * (1.0d0 / t_0)
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
double t_0 = c_m * (s_m * x);
return (Math.cos((x * 2.0)) / t_0) * (1.0 / t_0);
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): t_0 = c_m * (s_m * x) return (math.cos((x * 2.0)) / t_0) * (1.0 / t_0)
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) t_0 = Float64(c_m * Float64(s_m * x)) return Float64(Float64(cos(Float64(x * 2.0)) / t_0) * Float64(1.0 / t_0)) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
t_0 = c_m * (s_m * x);
tmp = (cos((x * 2.0)) / t_0) * (1.0 / t_0);
end
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := c\_m \cdot \left(s\_m \cdot x\right)\\
\frac{\cos \left(x \cdot 2\right)}{t\_0} \cdot \frac{1}{t\_0}
\end{array}
\end{array}
Initial program 65.8%
associate-/r*65.6%
cos-neg65.6%
distribute-rgt-neg-out65.6%
distribute-rgt-neg-out65.6%
*-commutative65.6%
distribute-rgt-neg-in65.6%
metadata-eval65.6%
*-commutative65.6%
associate-*l*59.1%
unpow259.1%
Simplified59.1%
Applied egg-rr95.7%
Final simplification95.7%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (let* ((t_0 (* x (* c_m s_m)))) (/ (/ (cos (* x 2.0)) t_0) t_0)))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
double t_0 = x * (c_m * s_m);
return (cos((x * 2.0)) / t_0) / t_0;
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
t_0 = x * (c_m * s_m)
code = (cos((x * 2.0d0)) / t_0) / t_0
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
double t_0 = x * (c_m * s_m);
return (Math.cos((x * 2.0)) / t_0) / t_0;
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): t_0 = x * (c_m * s_m) return (math.cos((x * 2.0)) / t_0) / t_0
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) t_0 = Float64(x * Float64(c_m * s_m)) return Float64(Float64(cos(Float64(x * 2.0)) / t_0) / t_0) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
t_0 = x * (c_m * s_m);
tmp = (cos((x * 2.0)) / t_0) / t_0;
end
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(x * N[(c$95$m * s$95$m), $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|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := x \cdot \left(c\_m \cdot s\_m\right)\\
\frac{\frac{\cos \left(x \cdot 2\right)}{t\_0}}{t\_0}
\end{array}
\end{array}
Initial program 65.8%
associate-/r*65.6%
cos-neg65.6%
distribute-rgt-neg-out65.6%
distribute-rgt-neg-out65.6%
*-commutative65.6%
distribute-rgt-neg-in65.6%
metadata-eval65.6%
*-commutative65.6%
associate-*l*59.1%
unpow259.1%
Simplified59.1%
Applied egg-rr95.2%
unpow-195.2%
clear-num95.2%
unpow295.2%
associate-/r*95.8%
*-commutative95.8%
*-commutative95.8%
associate-*l*93.7%
*-commutative93.7%
*-commutative93.7%
associate-*l*97.1%
*-commutative97.1%
Applied egg-rr97.1%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (pow (* c_m (* s_m x)) -2.0))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
return pow((c_m * (s_m * x)), -2.0);
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = (c_m * (s_m * x)) ** (-2.0d0)
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
return Math.pow((c_m * (s_m * x)), -2.0);
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): return math.pow((c_m * (s_m * x)), -2.0)
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) return Float64(c_m * Float64(s_m * x)) ^ -2.0 end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
tmp = (c_m * (s_m * x)) ^ -2.0;
end
c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. code[x_, c$95$m_, s$95$m_] := N[Power[N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
{\left(c\_m \cdot \left(s\_m \cdot x\right)\right)}^{-2}
\end{array}
Initial program 65.8%
associate-/r*65.6%
cos-neg65.6%
distribute-rgt-neg-out65.6%
distribute-rgt-neg-out65.6%
*-commutative65.6%
distribute-rgt-neg-in65.6%
metadata-eval65.6%
*-commutative65.6%
associate-*l*59.1%
unpow259.1%
Simplified59.1%
Taylor expanded in x around 0 56.3%
associate-/r*55.5%
*-commutative55.5%
unpow255.5%
unpow255.5%
swap-sqr68.0%
unpow268.0%
associate-/r*68.8%
unpow268.8%
unpow268.8%
swap-sqr80.6%
unpow280.6%
Simplified80.6%
Taylor expanded in c around 0 56.3%
associate-*r*56.8%
unpow256.8%
unpow256.8%
swap-sqr68.9%
unpow268.9%
*-commutative68.9%
unpow268.9%
unpow268.9%
swap-sqr81.9%
associate-/l/81.9%
*-rgt-identity81.9%
associate-*r/81.9%
unpow-181.9%
unpow-181.9%
pow-sqr81.9%
metadata-eval81.9%
*-commutative81.9%
associate-*r*80.6%
Simplified80.6%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (/ (/ (/ 1.0 c_m) (* s_m x)) (* c_m (* s_m x))))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
return ((1.0 / c_m) / (s_m * x)) / (c_m * (s_m * x));
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = ((1.0d0 / c_m) / (s_m * x)) / (c_m * (s_m * x))
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
return ((1.0 / c_m) / (s_m * x)) / (c_m * (s_m * x));
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): return ((1.0 / c_m) / (s_m * x)) / (c_m * (s_m * x))
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) return Float64(Float64(Float64(1.0 / c_m) / Float64(s_m * x)) / Float64(c_m * Float64(s_m * x))) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
tmp = ((1.0 / c_m) / (s_m * x)) / (c_m * (s_m * x));
end
c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. code[x_, c$95$m_, s$95$m_] := N[(N[(N[(1.0 / c$95$m), $MachinePrecision] / N[(s$95$m * x), $MachinePrecision]), $MachinePrecision] / N[(c$95$m * N[(s$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\frac{\frac{\frac{1}{c\_m}}{s\_m \cdot x}}{c\_m \cdot \left(s\_m \cdot x\right)}
\end{array}
Initial program 65.8%
associate-/r*65.6%
cos-neg65.6%
distribute-rgt-neg-out65.6%
distribute-rgt-neg-out65.6%
*-commutative65.6%
distribute-rgt-neg-in65.6%
metadata-eval65.6%
*-commutative65.6%
associate-*l*59.1%
unpow259.1%
Simplified59.1%
Applied egg-rr95.7%
Taylor expanded in x around 0 80.5%
un-div-inv80.5%
*-commutative80.5%
associate-/r*80.5%
*-commutative80.5%
Applied egg-rr80.5%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (let* ((t_0 (* x (* c_m s_m)))) (/ (/ 1.0 t_0) t_0)))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
double t_0 = x * (c_m * s_m);
return (1.0 / t_0) / t_0;
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
t_0 = x * (c_m * s_m)
code = (1.0d0 / t_0) / t_0
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
double t_0 = x * (c_m * s_m);
return (1.0 / t_0) / t_0;
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): t_0 = x * (c_m * s_m) return (1.0 / t_0) / t_0
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) t_0 = Float64(x * Float64(c_m * s_m)) return Float64(Float64(1.0 / t_0) / t_0) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
t_0 = x * (c_m * s_m);
tmp = (1.0 / t_0) / t_0;
end
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(x * N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := x \cdot \left(c\_m \cdot s\_m\right)\\
\frac{\frac{1}{t\_0}}{t\_0}
\end{array}
\end{array}
Initial program 65.8%
associate-/r*65.6%
cos-neg65.6%
distribute-rgt-neg-out65.6%
distribute-rgt-neg-out65.6%
*-commutative65.6%
distribute-rgt-neg-in65.6%
metadata-eval65.6%
*-commutative65.6%
associate-*l*59.1%
unpow259.1%
Simplified59.1%
Taylor expanded in x around 0 56.3%
associate-/r*55.5%
*-commutative55.5%
unpow255.5%
unpow255.5%
swap-sqr68.0%
unpow268.0%
associate-/r*68.8%
unpow268.8%
unpow268.8%
swap-sqr80.6%
unpow280.6%
Simplified80.6%
unpow280.6%
associate-*r*79.5%
associate-*l*79.0%
*-commutative79.0%
associate-*l*80.7%
*-commutative80.7%
Applied egg-rr80.7%
associate-*r*80.9%
associate-*r*79.8%
associate-*r*79.5%
*-commutative79.5%
associate-*r*80.6%
associate-/r*80.5%
*-rgt-identity80.5%
associate-*r*79.5%
times-frac77.2%
*-commutative77.2%
associate-/r*77.2%
Applied egg-rr77.2%
frac-times79.5%
*-commutative79.5%
associate-*r*79.8%
*-rgt-identity79.8%
associate-/l/79.8%
*-commutative79.8%
associate-*r*81.9%
*-commutative81.9%
Applied egg-rr81.9%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (let* ((t_0 (* x (* c_m s_m)))) (/ 1.0 (* t_0 t_0))))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
double t_0 = x * (c_m * s_m);
return 1.0 / (t_0 * t_0);
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
real(8) :: t_0
t_0 = x * (c_m * s_m)
code = 1.0d0 / (t_0 * t_0)
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
double t_0 = x * (c_m * s_m);
return 1.0 / (t_0 * t_0);
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): t_0 = x * (c_m * s_m) return 1.0 / (t_0 * t_0)
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) t_0 = Float64(x * Float64(c_m * s_m)) return Float64(1.0 / Float64(t_0 * t_0)) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
t_0 = x * (c_m * s_m);
tmp = 1.0 / (t_0 * t_0);
end
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
code[x_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(x * N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]}, N[(1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := x \cdot \left(c\_m \cdot s\_m\right)\\
\frac{1}{t\_0 \cdot t\_0}
\end{array}
\end{array}
Initial program 65.8%
associate-/r*65.6%
cos-neg65.6%
distribute-rgt-neg-out65.6%
distribute-rgt-neg-out65.6%
*-commutative65.6%
distribute-rgt-neg-in65.6%
metadata-eval65.6%
*-commutative65.6%
associate-*l*59.1%
unpow259.1%
Simplified59.1%
Taylor expanded in x around 0 56.3%
associate-/r*55.5%
*-commutative55.5%
unpow255.5%
unpow255.5%
swap-sqr68.0%
unpow268.0%
associate-/r*68.8%
unpow268.8%
unpow268.8%
swap-sqr80.6%
unpow280.6%
Simplified80.6%
unpow280.6%
*-commutative80.6%
associate-*l*79.8%
*-commutative79.8%
*-commutative79.8%
associate-*l*81.9%
*-commutative81.9%
Applied egg-rr81.9%
c_m = (fabs.f64 c) s_m = (fabs.f64 s) NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. (FPCore (x c_m s_m) :precision binary64 (/ 1.0 (* (* c_m x) (* s_m (* x (* c_m s_m))))))
c_m = fabs(c);
s_m = fabs(s);
assert(x < c_m && c_m < s_m);
double code(double x, double c_m, double s_m) {
return 1.0 / ((c_m * x) * (s_m * (x * (c_m * s_m))));
}
c_m = abs(c)
s_m = abs(s)
NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x, c_m, s_m)
real(8), intent (in) :: x
real(8), intent (in) :: c_m
real(8), intent (in) :: s_m
code = 1.0d0 / ((c_m * x) * (s_m * (x * (c_m * s_m))))
end function
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x < c_m && c_m < s_m;
public static double code(double x, double c_m, double s_m) {
return 1.0 / ((c_m * x) * (s_m * (x * (c_m * s_m))));
}
c_m = math.fabs(c) s_m = math.fabs(s) [x, c_m, s_m] = sort([x, c_m, s_m]) def code(x, c_m, s_m): return 1.0 / ((c_m * x) * (s_m * (x * (c_m * s_m))))
c_m = abs(c) s_m = abs(s) x, c_m, s_m = sort([x, c_m, s_m]) function code(x, c_m, s_m) return Float64(1.0 / Float64(Float64(c_m * x) * Float64(s_m * Float64(x * Float64(c_m * s_m))))) end
c_m = abs(c);
s_m = abs(s);
x, c_m, s_m = num2cell(sort([x, c_m, s_m])){:}
function tmp = code(x, c_m, s_m)
tmp = 1.0 / ((c_m * x) * (s_m * (x * (c_m * s_m))));
end
c_m = N[Abs[c], $MachinePrecision] s_m = N[Abs[s], $MachinePrecision] NOTE: x, c_m, and s_m should be sorted in increasing order before calling this function. code[x_, c$95$m_, s$95$m_] := N[(1.0 / N[(N[(c$95$m * x), $MachinePrecision] * N[(s$95$m * N[(x * N[(c$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x, c_m, s_m] = \mathsf{sort}([x, c_m, s_m])\\
\\
\frac{1}{\left(c\_m \cdot x\right) \cdot \left(s\_m \cdot \left(x \cdot \left(c\_m \cdot s\_m\right)\right)\right)}
\end{array}
Initial program 65.8%
associate-/r*65.6%
cos-neg65.6%
distribute-rgt-neg-out65.6%
distribute-rgt-neg-out65.6%
*-commutative65.6%
distribute-rgt-neg-in65.6%
metadata-eval65.6%
*-commutative65.6%
associate-*l*59.1%
unpow259.1%
Simplified59.1%
Taylor expanded in x around 0 56.3%
associate-/r*55.5%
*-commutative55.5%
unpow255.5%
unpow255.5%
swap-sqr68.0%
unpow268.0%
associate-/r*68.8%
unpow268.8%
unpow268.8%
swap-sqr80.6%
unpow280.6%
Simplified80.6%
unpow280.6%
associate-*r*79.5%
associate-*l*79.0%
*-commutative79.0%
associate-*l*80.7%
*-commutative80.7%
Applied egg-rr80.7%
herbie shell --seed 2024143
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))