
(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}
(FPCore (x c s) :precision binary64 (let* ((t_0 (* s (* x c)))) (/ (cos (* 2.0 x)) (* t_0 t_0))))
double code(double x, double c, double s) {
double t_0 = s * (x * c);
return cos((2.0 * x)) / (t_0 * t_0);
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = s * (x * c)
code = cos((2.0d0 * x)) / (t_0 * t_0)
end function
public static double code(double x, double c, double s) {
double t_0 = s * (x * c);
return Math.cos((2.0 * x)) / (t_0 * t_0);
}
def code(x, c, s): t_0 = s * (x * c) return math.cos((2.0 * x)) / (t_0 * t_0)
function code(x, c, s) t_0 = Float64(s * Float64(x * c)) return Float64(cos(Float64(2.0 * x)) / Float64(t_0 * t_0)) end
function tmp = code(x, c, s) t_0 = s * (x * c); tmp = cos((2.0 * x)) / (t_0 * t_0); end
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]}, N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := s \cdot \left(x \cdot c\right)\\
\frac{\cos \left(2 \cdot x\right)}{t_0 \cdot t_0}
\end{array}
\end{array}
Initial program 70.3%
*-commutative70.3%
associate-*r*62.4%
associate-*r*61.7%
unpow261.7%
unswap-sqr79.8%
unpow279.8%
swap-sqr98.8%
*-commutative98.8%
*-commutative98.8%
*-commutative98.8%
*-commutative98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x c s) :precision binary64 (if (<= (pow s 2.0) 5e+153) (/ (cos (* 2.0 x)) (* s (* (* c c) (* s (* x x))))) (pow (/ 1.0 (* c (* x s))) 2.0)))
double code(double x, double c, double s) {
double tmp;
if (pow(s, 2.0) <= 5e+153) {
tmp = cos((2.0 * x)) / (s * ((c * c) * (s * (x * x))));
} else {
tmp = pow((1.0 / (c * (x * s))), 2.0);
}
return tmp;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if ((s ** 2.0d0) <= 5d+153) then
tmp = cos((2.0d0 * x)) / (s * ((c * c) * (s * (x * x))))
else
tmp = (1.0d0 / (c * (x * s))) ** 2.0d0
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (Math.pow(s, 2.0) <= 5e+153) {
tmp = Math.cos((2.0 * x)) / (s * ((c * c) * (s * (x * x))));
} else {
tmp = Math.pow((1.0 / (c * (x * s))), 2.0);
}
return tmp;
}
def code(x, c, s): tmp = 0 if math.pow(s, 2.0) <= 5e+153: tmp = math.cos((2.0 * x)) / (s * ((c * c) * (s * (x * x)))) else: tmp = math.pow((1.0 / (c * (x * s))), 2.0) return tmp
function code(x, c, s) tmp = 0.0 if ((s ^ 2.0) <= 5e+153) tmp = Float64(cos(Float64(2.0 * x)) / Float64(s * Float64(Float64(c * c) * Float64(s * Float64(x * x))))); else tmp = Float64(1.0 / Float64(c * Float64(x * s))) ^ 2.0; end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if ((s ^ 2.0) <= 5e+153) tmp = cos((2.0 * x)) / (s * ((c * c) * (s * (x * x)))); else tmp = (1.0 / (c * (x * s))) ^ 2.0; end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[N[Power[s, 2.0], $MachinePrecision], 5e+153], N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(s * N[(N[(c * c), $MachinePrecision] * N[(s * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{s}^{2} \leq 5 \cdot 10^{+153}:\\
\;\;\;\;\frac{\cos \left(2 \cdot x\right)}{s \cdot \left(\left(c \cdot c\right) \cdot \left(s \cdot \left(x \cdot x\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{1}{c \cdot \left(x \cdot s\right)}\right)}^{2}\\
\end{array}
\end{array}
if (pow.f64 s 2) < 5.00000000000000018e153Initial program 74.2%
*-commutative74.2%
associate-*l*67.7%
associate-*r*66.6%
*-commutative66.6%
unpow266.6%
associate-*r*71.5%
associate-*r*72.7%
*-commutative72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in x around 0 72.7%
*-commutative72.7%
unpow272.7%
associate-*r*73.8%
unpow273.8%
*-commutative73.8%
Simplified73.8%
if 5.00000000000000018e153 < (pow.f64 s 2) Initial program 62.7%
*-commutative62.7%
associate-*l*52.0%
associate-*r*51.1%
*-commutative51.1%
unpow251.1%
associate-*r*59.4%
associate-*r*59.9%
*-commutative59.9%
unpow259.9%
Simplified59.9%
Taylor expanded in x around 0 51.0%
associate-/r*51.0%
unpow251.0%
*-commutative51.0%
unpow251.0%
swap-sqr72.7%
unpow272.7%
associate-/l/72.7%
unpow272.7%
swap-sqr51.0%
unpow251.0%
*-commutative51.0%
associate-*r*52.0%
unpow252.0%
*-commutative52.0%
unpow252.0%
Simplified52.0%
inv-pow52.0%
associate-*r*51.1%
pow251.1%
pow251.1%
unpow-prod-down70.6%
pow270.6%
pow-prod-down90.0%
associate-*r*91.9%
pow291.9%
pow-prod-down91.9%
metadata-eval91.9%
metadata-eval91.9%
pow291.9%
metadata-eval91.9%
unpow-191.9%
Applied egg-rr91.9%
Final simplification79.9%
(FPCore (x c s) :precision binary64 (if (<= s 1.08e+123) (/ (cos (* 2.0 x)) (* x (* x (* (* s s) (* c c))))) (pow (* c (* x s)) -2.0)))
double code(double x, double c, double s) {
double tmp;
if (s <= 1.08e+123) {
tmp = cos((2.0 * x)) / (x * (x * ((s * s) * (c * c))));
} else {
tmp = pow((c * (x * s)), -2.0);
}
return tmp;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (s <= 1.08d+123) then
tmp = cos((2.0d0 * x)) / (x * (x * ((s * s) * (c * c))))
else
tmp = (c * (x * s)) ** (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (s <= 1.08e+123) {
tmp = Math.cos((2.0 * x)) / (x * (x * ((s * s) * (c * c))));
} else {
tmp = Math.pow((c * (x * s)), -2.0);
}
return tmp;
}
def code(x, c, s): tmp = 0 if s <= 1.08e+123: tmp = math.cos((2.0 * x)) / (x * (x * ((s * s) * (c * c)))) else: tmp = math.pow((c * (x * s)), -2.0) return tmp
function code(x, c, s) tmp = 0.0 if (s <= 1.08e+123) tmp = Float64(cos(Float64(2.0 * x)) / Float64(x * Float64(x * Float64(Float64(s * s) * Float64(c * c))))); else tmp = Float64(c * Float64(x * s)) ^ -2.0; end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (s <= 1.08e+123) tmp = cos((2.0 * x)) / (x * (x * ((s * s) * (c * c)))); else tmp = (c * (x * s)) ^ -2.0; end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[s, 1.08e+123], N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(x * N[(x * N[(N[(s * s), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;s \leq 1.08 \cdot 10^{+123}:\\
\;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(x \cdot \left(\left(s \cdot s\right) \cdot \left(c \cdot c\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\end{array}
\end{array}
if s < 1.0799999999999999e123Initial program 71.0%
associate-*r*70.7%
*-commutative70.7%
*-commutative70.7%
associate-*r*69.8%
*-commutative69.8%
unpow269.8%
unpow269.8%
Simplified69.8%
if 1.0799999999999999e123 < s Initial program 65.1%
*-commutative65.1%
associate-*l*54.9%
associate-*r*54.9%
*-commutative54.9%
unpow254.9%
associate-*r*59.0%
associate-*r*58.6%
*-commutative58.6%
unpow258.6%
Simplified58.6%
Taylor expanded in x around 0 54.8%
associate-/r*54.8%
unpow254.8%
*-commutative54.8%
unpow254.8%
swap-sqr82.3%
unpow282.3%
associate-/l/82.5%
unpow282.5%
swap-sqr54.8%
unpow254.8%
*-commutative54.8%
associate-*r*54.9%
unpow254.9%
*-commutative54.9%
unpow254.9%
Simplified54.9%
inv-pow54.9%
associate-*r*54.9%
pow254.9%
pow254.9%
unpow-prod-down76.2%
unpow-prod-down72.9%
inv-pow72.9%
pow-flip72.9%
metadata-eval72.9%
pow272.9%
pow-pow72.9%
metadata-eval72.9%
unpow-prod-down95.3%
associate-*r*98.5%
Applied egg-rr98.5%
Final simplification73.3%
(FPCore (x c s) :precision binary64 (if (<= s 1.9e+144) (/ (cos (* 2.0 x)) (* x (* (* c (* x c)) (* s s)))) (pow (/ 1.0 (* c (* x s))) 2.0)))
double code(double x, double c, double s) {
double tmp;
if (s <= 1.9e+144) {
tmp = cos((2.0 * x)) / (x * ((c * (x * c)) * (s * s)));
} else {
tmp = pow((1.0 / (c * (x * s))), 2.0);
}
return tmp;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (s <= 1.9d+144) then
tmp = cos((2.0d0 * x)) / (x * ((c * (x * c)) * (s * s)))
else
tmp = (1.0d0 / (c * (x * s))) ** 2.0d0
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (s <= 1.9e+144) {
tmp = Math.cos((2.0 * x)) / (x * ((c * (x * c)) * (s * s)));
} else {
tmp = Math.pow((1.0 / (c * (x * s))), 2.0);
}
return tmp;
}
def code(x, c, s): tmp = 0 if s <= 1.9e+144: tmp = math.cos((2.0 * x)) / (x * ((c * (x * c)) * (s * s))) else: tmp = math.pow((1.0 / (c * (x * s))), 2.0) return tmp
function code(x, c, s) tmp = 0.0 if (s <= 1.9e+144) tmp = Float64(cos(Float64(2.0 * x)) / Float64(x * Float64(Float64(c * Float64(x * c)) * Float64(s * s)))); else tmp = Float64(1.0 / Float64(c * Float64(x * s))) ^ 2.0; end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (s <= 1.9e+144) tmp = cos((2.0 * x)) / (x * ((c * (x * c)) * (s * s))); else tmp = (1.0 / (c * (x * s))) ^ 2.0; end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[s, 1.9e+144], N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(x * N[(N[(c * N[(x * c), $MachinePrecision]), $MachinePrecision] * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;s \leq 1.9 \cdot 10^{+144}:\\
\;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(c \cdot \left(x \cdot c\right)\right) \cdot \left(s \cdot s\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{1}{c \cdot \left(x \cdot s\right)}\right)}^{2}\\
\end{array}
\end{array}
if s < 1.90000000000000013e144Initial program 70.9%
associate-*r*70.6%
*-commutative70.6%
associate-*r*70.3%
unpow270.3%
unpow270.3%
Simplified70.3%
Taylor expanded in c around 0 70.3%
unpow270.3%
associate-*r*76.6%
Simplified76.6%
if 1.90000000000000013e144 < s Initial program 64.9%
*-commutative64.9%
associate-*l*53.7%
associate-*r*53.7%
*-commutative53.7%
unpow253.7%
associate-*r*58.2%
associate-*r*57.8%
*-commutative57.8%
unpow257.8%
Simplified57.8%
Taylor expanded in x around 0 53.6%
associate-/r*53.6%
unpow253.6%
*-commutative53.6%
unpow253.6%
swap-sqr82.1%
unpow282.1%
associate-/l/82.1%
unpow282.1%
swap-sqr53.6%
unpow253.6%
*-commutative53.6%
associate-*r*53.7%
unpow253.7%
*-commutative53.7%
unpow253.7%
Simplified53.7%
inv-pow53.7%
associate-*r*53.7%
pow253.7%
pow253.7%
unpow-prod-down75.1%
pow275.1%
pow-prod-down96.5%
associate-*r*99.8%
pow299.8%
pow-prod-down99.9%
metadata-eval99.9%
metadata-eval99.9%
pow299.9%
metadata-eval99.9%
unpow-199.9%
Applied egg-rr99.9%
Final simplification79.1%
(FPCore (x c s) :precision binary64 (/ (cos (* 2.0 x)) (* (* s (* x c)) (* c (* x s)))))
double code(double x, double c, double s) {
return cos((2.0 * x)) / ((s * (x * c)) * (c * (x * s)));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = cos((2.0d0 * x)) / ((s * (x * c)) * (c * (x * s)))
end function
public static double code(double x, double c, double s) {
return Math.cos((2.0 * x)) / ((s * (x * c)) * (c * (x * s)));
}
def code(x, c, s): return math.cos((2.0 * x)) / ((s * (x * c)) * (c * (x * s)))
function code(x, c, s) return Float64(cos(Float64(2.0 * x)) / Float64(Float64(s * Float64(x * c)) * Float64(c * Float64(x * s)))) end
function tmp = code(x, c, s) tmp = cos((2.0 * x)) / ((s * (x * c)) * (c * (x * s))); end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision] * N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(x \cdot c\right)\right) \cdot \left(c \cdot \left(x \cdot s\right)\right)}
\end{array}
Initial program 70.3%
*-commutative70.3%
associate-*r*62.4%
associate-*r*61.7%
unpow261.7%
unswap-sqr79.8%
unpow279.8%
swap-sqr98.8%
*-commutative98.8%
*-commutative98.8%
*-commutative98.8%
*-commutative98.8%
Simplified98.8%
Taylor expanded in s around 0 96.6%
Final simplification96.6%
(FPCore (x c s) :precision binary64 (pow (/ 1.0 (* c (* x s))) 2.0))
double code(double x, double c, double s) {
return pow((1.0 / (c * (x * s))), 2.0);
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = (1.0d0 / (c * (x * s))) ** 2.0d0
end function
public static double code(double x, double c, double s) {
return Math.pow((1.0 / (c * (x * s))), 2.0);
}
def code(x, c, s): return math.pow((1.0 / (c * (x * s))), 2.0)
function code(x, c, s) return Float64(1.0 / Float64(c * Float64(x * s))) ^ 2.0 end
function tmp = code(x, c, s) tmp = (1.0 / (c * (x * s))) ^ 2.0; end
code[x_, c_, s_] := N[Power[N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{1}{c \cdot \left(x \cdot s\right)}\right)}^{2}
\end{array}
Initial program 70.3%
*-commutative70.3%
associate-*l*62.4%
associate-*r*61.3%
*-commutative61.3%
unpow261.3%
associate-*r*67.4%
associate-*r*68.3%
*-commutative68.3%
unpow268.3%
Simplified68.3%
Taylor expanded in x around 0 55.6%
associate-/r*55.5%
unpow255.5%
*-commutative55.5%
unpow255.5%
swap-sqr69.0%
unpow269.0%
associate-/l/69.0%
unpow269.0%
swap-sqr55.6%
unpow255.6%
*-commutative55.6%
associate-*r*55.5%
unpow255.5%
*-commutative55.5%
unpow255.5%
Simplified55.5%
inv-pow55.5%
associate-*r*55.6%
pow255.6%
pow255.6%
unpow-prod-down67.0%
pow267.0%
pow-prod-down79.6%
associate-*r*79.5%
pow279.5%
pow-prod-down79.7%
metadata-eval79.7%
metadata-eval79.7%
pow279.7%
metadata-eval79.7%
unpow-179.7%
Applied egg-rr79.7%
Final simplification79.7%
(FPCore (x c s) :precision binary64 (pow (* c (* x s)) -2.0))
double code(double x, double c, double s) {
return pow((c * (x * s)), -2.0);
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = (c * (x * s)) ** (-2.0d0)
end function
public static double code(double x, double c, double s) {
return Math.pow((c * (x * s)), -2.0);
}
def code(x, c, s): return math.pow((c * (x * s)), -2.0)
function code(x, c, s) return Float64(c * Float64(x * s)) ^ -2.0 end
function tmp = code(x, c, s) tmp = (c * (x * s)) ^ -2.0; end
code[x_, c_, s_] := N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}
\end{array}
Initial program 70.3%
*-commutative70.3%
associate-*l*62.4%
associate-*r*61.3%
*-commutative61.3%
unpow261.3%
associate-*r*67.4%
associate-*r*68.3%
*-commutative68.3%
unpow268.3%
Simplified68.3%
Taylor expanded in x around 0 55.6%
associate-/r*55.5%
unpow255.5%
*-commutative55.5%
unpow255.5%
swap-sqr69.0%
unpow269.0%
associate-/l/69.0%
unpow269.0%
swap-sqr55.6%
unpow255.6%
*-commutative55.6%
associate-*r*55.5%
unpow255.5%
*-commutative55.5%
unpow255.5%
Simplified55.5%
inv-pow55.5%
associate-*r*55.6%
pow255.6%
pow255.6%
unpow-prod-down67.0%
unpow-prod-down66.5%
inv-pow66.5%
pow-flip66.5%
metadata-eval66.5%
pow266.5%
pow-pow66.5%
metadata-eval66.5%
unpow-prod-down79.6%
associate-*r*79.7%
Applied egg-rr79.7%
Final simplification79.7%
(FPCore (x c s) :precision binary64 (/ 1.0 (* (* c c) (* (* s s) (* x x)))))
double code(double x, double c, double s) {
return 1.0 / ((c * c) * ((s * s) * (x * x)));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / ((c * c) * ((s * s) * (x * x)))
end function
public static double code(double x, double c, double s) {
return 1.0 / ((c * c) * ((s * s) * (x * x)));
}
def code(x, c, s): return 1.0 / ((c * c) * ((s * s) * (x * x)))
function code(x, c, s) return Float64(1.0 / Float64(Float64(c * c) * Float64(Float64(s * s) * Float64(x * x)))) end
function tmp = code(x, c, s) tmp = 1.0 / ((c * c) * ((s * s) * (x * x))); end
code[x_, c_, s_] := N[(1.0 / N[(N[(c * c), $MachinePrecision] * N[(N[(s * s), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\left(c \cdot c\right) \cdot \left(\left(s \cdot s\right) \cdot \left(x \cdot x\right)\right)}
\end{array}
Initial program 70.3%
*-commutative70.3%
associate-*l*62.4%
associate-*r*61.3%
*-commutative61.3%
unpow261.3%
associate-*r*67.4%
associate-*r*68.3%
*-commutative68.3%
unpow268.3%
Simplified68.3%
Taylor expanded in x around 0 55.6%
associate-/r*55.5%
unpow255.5%
*-commutative55.5%
unpow255.5%
swap-sqr69.0%
unpow269.0%
associate-/l/69.0%
unpow269.0%
swap-sqr55.6%
unpow255.6%
*-commutative55.6%
associate-*r*55.5%
unpow255.5%
*-commutative55.5%
unpow255.5%
Simplified55.5%
Final simplification55.5%
(FPCore (x c s) :precision binary64 (/ 1.0 (* (* c (* x s)) (* x (* s c)))))
double code(double x, double c, double s) {
return 1.0 / ((c * (x * s)) * (x * (s * c)));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / ((c * (x * s)) * (x * (s * c)))
end function
public static double code(double x, double c, double s) {
return 1.0 / ((c * (x * s)) * (x * (s * c)));
}
def code(x, c, s): return 1.0 / ((c * (x * s)) * (x * (s * c)))
function code(x, c, s) return Float64(1.0 / Float64(Float64(c * Float64(x * s)) * Float64(x * Float64(s * c)))) end
function tmp = code(x, c, s) tmp = 1.0 / ((c * (x * s)) * (x * (s * c))); end
code[x_, c_, s_] := N[(1.0 / N[(N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision] * N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(x \cdot \left(s \cdot c\right)\right)}
\end{array}
Initial program 70.3%
*-commutative70.3%
associate-*l*62.4%
associate-*r*61.3%
*-commutative61.3%
unpow261.3%
associate-*r*67.4%
associate-*r*68.3%
*-commutative68.3%
unpow268.3%
Simplified68.3%
Taylor expanded in x around 0 55.6%
associate-/r*55.5%
unpow255.5%
*-commutative55.5%
unpow255.5%
swap-sqr69.0%
unpow269.0%
associate-/l/69.0%
unpow269.0%
swap-sqr55.6%
unpow255.6%
*-commutative55.6%
associate-*r*55.5%
unpow255.5%
*-commutative55.5%
unpow255.5%
Simplified55.5%
Taylor expanded in c around 0 55.6%
*-commutative55.6%
unpow255.6%
associate-*r*55.5%
unpow255.5%
*-commutative55.5%
unpow255.5%
swap-sqr66.4%
swap-sqr79.5%
unpow279.5%
associate-*r*79.6%
*-commutative79.6%
associate-*r*80.3%
Simplified80.3%
*-commutative80.3%
*-commutative80.3%
associate-*r*79.6%
pow279.6%
Applied egg-rr79.6%
Taylor expanded in x around 0 79.6%
associate-*r*79.6%
*-commutative79.6%
associate-*r*78.7%
Simplified78.7%
Final simplification78.7%
(FPCore (x c s) :precision binary64 (let* ((t_0 (* x (* s c)))) (/ 1.0 (* t_0 t_0))))
double code(double x, double c, double s) {
double t_0 = x * (s * c);
return 1.0 / (t_0 * t_0);
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = x * (s * c)
code = 1.0d0 / (t_0 * t_0)
end function
public static double code(double x, double c, double s) {
double t_0 = x * (s * c);
return 1.0 / (t_0 * t_0);
}
def code(x, c, s): t_0 = x * (s * c) return 1.0 / (t_0 * t_0)
function code(x, c, s) t_0 = Float64(x * Float64(s * c)) return Float64(1.0 / Float64(t_0 * t_0)) end
function tmp = code(x, c, s) t_0 = x * (s * c); tmp = 1.0 / (t_0 * t_0); end
code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(s * c), $MachinePrecision]), $MachinePrecision]}, N[(1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(s \cdot c\right)\\
\frac{1}{t_0 \cdot t_0}
\end{array}
\end{array}
Initial program 70.3%
*-commutative70.3%
associate-*l*62.4%
associate-*r*61.3%
*-commutative61.3%
unpow261.3%
associate-*r*67.4%
associate-*r*68.3%
*-commutative68.3%
unpow268.3%
Simplified68.3%
Taylor expanded in x around 0 55.6%
associate-/r*55.5%
unpow255.5%
*-commutative55.5%
unpow255.5%
swap-sqr69.0%
unpow269.0%
associate-/l/69.0%
unpow269.0%
swap-sqr55.6%
unpow255.6%
*-commutative55.6%
associate-*r*55.5%
unpow255.5%
*-commutative55.5%
unpow255.5%
Simplified55.5%
Taylor expanded in c around 0 55.6%
*-commutative55.6%
unpow255.6%
associate-*r*55.5%
unpow255.5%
*-commutative55.5%
unpow255.5%
swap-sqr66.4%
swap-sqr79.5%
unpow279.5%
associate-*r*79.6%
*-commutative79.6%
associate-*r*80.3%
Simplified80.3%
*-commutative80.3%
*-commutative80.3%
associate-*r*79.6%
pow279.6%
Applied egg-rr79.6%
Final simplification79.6%
herbie shell --seed 2023203
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))