
(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 15 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 (* x (* c s)))) (* (/ 1.0 t_0) (/ (cos (* x 2.0)) t_0))))
double code(double x, double c, double s) {
double t_0 = x * (c * s);
return (1.0 / t_0) * (cos((x * 2.0)) / t_0);
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = x * (c * s)
code = (1.0d0 / t_0) * (cos((x * 2.0d0)) / t_0)
end function
public static double code(double x, double c, double s) {
double t_0 = x * (c * s);
return (1.0 / t_0) * (Math.cos((x * 2.0)) / t_0);
}
def code(x, c, s): t_0 = x * (c * s) return (1.0 / t_0) * (math.cos((x * 2.0)) / t_0)
function code(x, c, s) t_0 = Float64(x * Float64(c * s)) return Float64(Float64(1.0 / t_0) * Float64(cos(Float64(x * 2.0)) / t_0)) end
function tmp = code(x, c, s) t_0 = x * (c * s); tmp = (1.0 / t_0) * (cos((x * 2.0)) / t_0); end
code[x_, c_, s_] := Block[{t$95$0 = N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(c \cdot s\right)\\
\frac{1}{t_0} \cdot \frac{\cos \left(x \cdot 2\right)}{t_0}
\end{array}
\end{array}
Initial program 67.0%
associate-/r*66.6%
remove-double-neg66.6%
distribute-lft-neg-out66.6%
distribute-lft-neg-out66.6%
distribute-rgt-neg-out66.6%
associate-/l/67.0%
distribute-rgt-neg-out67.0%
distribute-lft-neg-out67.0%
associate-*l*68.6%
distribute-lft-neg-in68.6%
distribute-lft-neg-out68.6%
remove-double-neg68.6%
associate-*r*68.7%
*-commutative68.7%
associate-*r*69.0%
Simplified72.7%
Taylor expanded in c around 0 72.7%
unpow272.7%
associate-*r*84.0%
Simplified84.0%
*-commutative84.0%
*-un-lft-identity84.0%
add-sqr-sqrt83.9%
times-frac83.9%
Applied egg-rr97.7%
Final simplification97.7%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (cos (* x 2.0))))
(if (<= x 3.1e-5)
(*
(/ 1.0 (* c (* x s)))
(* (/ 1.0 c) (+ (* -2.0 (/ x s)) (/ 1.0 (* x s)))))
(if (<= x 2.6e+166)
(/ t_0 (* x (* x (* c (* s (* c s))))))
(/ t_0 (* x (* (* s s) (* c (* x c)))))))))
double code(double x, double c, double s) {
double t_0 = cos((x * 2.0));
double tmp;
if (x <= 3.1e-5) {
tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * ((-2.0 * (x / s)) + (1.0 / (x * s))));
} else if (x <= 2.6e+166) {
tmp = t_0 / (x * (x * (c * (s * (c * s)))));
} else {
tmp = t_0 / (x * ((s * s) * (c * (x * c))));
}
return tmp;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
real(8) :: tmp
t_0 = cos((x * 2.0d0))
if (x <= 3.1d-5) then
tmp = (1.0d0 / (c * (x * s))) * ((1.0d0 / c) * (((-2.0d0) * (x / s)) + (1.0d0 / (x * s))))
else if (x <= 2.6d+166) then
tmp = t_0 / (x * (x * (c * (s * (c * s)))))
else
tmp = t_0 / (x * ((s * s) * (c * (x * c))))
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double t_0 = Math.cos((x * 2.0));
double tmp;
if (x <= 3.1e-5) {
tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * ((-2.0 * (x / s)) + (1.0 / (x * s))));
} else if (x <= 2.6e+166) {
tmp = t_0 / (x * (x * (c * (s * (c * s)))));
} else {
tmp = t_0 / (x * ((s * s) * (c * (x * c))));
}
return tmp;
}
def code(x, c, s): t_0 = math.cos((x * 2.0)) tmp = 0 if x <= 3.1e-5: tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * ((-2.0 * (x / s)) + (1.0 / (x * s)))) elif x <= 2.6e+166: tmp = t_0 / (x * (x * (c * (s * (c * s))))) else: tmp = t_0 / (x * ((s * s) * (c * (x * c)))) return tmp
function code(x, c, s) t_0 = cos(Float64(x * 2.0)) tmp = 0.0 if (x <= 3.1e-5) tmp = Float64(Float64(1.0 / Float64(c * Float64(x * s))) * Float64(Float64(1.0 / c) * Float64(Float64(-2.0 * Float64(x / s)) + Float64(1.0 / Float64(x * s))))); elseif (x <= 2.6e+166) tmp = Float64(t_0 / Float64(x * Float64(x * Float64(c * Float64(s * Float64(c * s)))))); else tmp = Float64(t_0 / Float64(x * Float64(Float64(s * s) * Float64(c * Float64(x * c))))); end return tmp end
function tmp_2 = code(x, c, s) t_0 = cos((x * 2.0)); tmp = 0.0; if (x <= 3.1e-5) tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * ((-2.0 * (x / s)) + (1.0 / (x * s)))); elseif (x <= 2.6e+166) tmp = t_0 / (x * (x * (c * (s * (c * s))))); else tmp = t_0 / (x * ((s * s) * (c * (x * c)))); end tmp_2 = tmp; end
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 3.1e-5], N[(N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] * N[(N[(-2.0 * N[(x / s), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.6e+166], N[(t$95$0 / N[(x * N[(x * N[(c * N[(s * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(x * N[(N[(s * s), $MachinePrecision] * N[(c * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(x \cdot 2\right)\\
\mathbf{if}\;x \leq 3.1 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{c \cdot \left(x \cdot s\right)} \cdot \left(\frac{1}{c} \cdot \left(-2 \cdot \frac{x}{s} + \frac{1}{x \cdot s}\right)\right)\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+166}:\\
\;\;\;\;\frac{t_0}{x \cdot \left(x \cdot \left(c \cdot \left(s \cdot \left(c \cdot s\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{x \cdot \left(\left(s \cdot s\right) \cdot \left(c \cdot \left(x \cdot c\right)\right)\right)}\\
\end{array}
\end{array}
if x < 3.10000000000000014e-5Initial program 66.0%
associate-/r*65.6%
remove-double-neg65.6%
distribute-lft-neg-out65.6%
distribute-lft-neg-out65.6%
distribute-rgt-neg-out65.6%
associate-/r*66.0%
unpow266.0%
*-commutative66.0%
associate-*r*63.2%
sqr-neg63.2%
associate-*r*66.0%
unpow266.0%
Simplified66.0%
*-commutative66.0%
associate-*r*63.2%
associate-*l*64.4%
*-commutative64.4%
swap-sqr80.4%
add-sqr-sqrt80.4%
*-un-lft-identity80.4%
times-frac80.4%
Applied egg-rr98.4%
*-un-lft-identity98.4%
times-frac98.3%
Applied egg-rr98.3%
Taylor expanded in x around 0 77.6%
if 3.10000000000000014e-5 < x < 2.5999999999999999e166Initial program 84.1%
associate-/r*84.0%
remove-double-neg84.0%
distribute-lft-neg-out84.0%
distribute-lft-neg-out84.0%
distribute-rgt-neg-out84.0%
associate-/l/84.1%
distribute-rgt-neg-out84.1%
distribute-lft-neg-out84.1%
associate-*l*84.0%
distribute-lft-neg-in84.0%
distribute-lft-neg-out84.0%
remove-double-neg84.0%
associate-*r*84.0%
*-commutative84.0%
associate-*r*84.1%
Simplified84.2%
Taylor expanded in c around 0 84.2%
unpow284.2%
associate-*r*91.9%
Simplified91.9%
if 2.5999999999999999e166 < x Initial program 55.9%
associate-/r*55.9%
remove-double-neg55.9%
distribute-lft-neg-out55.9%
distribute-lft-neg-out55.9%
distribute-rgt-neg-out55.9%
associate-/l/55.9%
distribute-rgt-neg-out55.9%
distribute-lft-neg-out55.9%
associate-*l*59.1%
distribute-lft-neg-in59.1%
distribute-lft-neg-out59.1%
remove-double-neg59.1%
associate-*r*59.2%
*-commutative59.2%
associate-*r*59.4%
Simplified63.1%
Taylor expanded in x around 0 59.2%
unpow259.2%
unpow259.2%
associate-*r*62.5%
Simplified62.5%
Final simplification77.6%
(FPCore (x c s)
:precision binary64
(let* ((t_0 (cos (* x 2.0))))
(if (<= x 1.05e-25)
(* (/ 1.0 (* c (* x s))) (* (/ 1.0 c) (/ 1.0 (* x s))))
(if (<= x 1.35e+154)
(/ (/ t_0 (* c s)) (* s (* c (* x x))))
(/ t_0 (* x (* (* s s) (* c (* x c)))))))))
double code(double x, double c, double s) {
double t_0 = cos((x * 2.0));
double tmp;
if (x <= 1.05e-25) {
tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * (1.0 / (x * s)));
} else if (x <= 1.35e+154) {
tmp = (t_0 / (c * s)) / (s * (c * (x * x)));
} else {
tmp = t_0 / (x * ((s * s) * (c * (x * c))));
}
return tmp;
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
real(8) :: tmp
t_0 = cos((x * 2.0d0))
if (x <= 1.05d-25) then
tmp = (1.0d0 / (c * (x * s))) * ((1.0d0 / c) * (1.0d0 / (x * s)))
else if (x <= 1.35d+154) then
tmp = (t_0 / (c * s)) / (s * (c * (x * x)))
else
tmp = t_0 / (x * ((s * s) * (c * (x * c))))
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double t_0 = Math.cos((x * 2.0));
double tmp;
if (x <= 1.05e-25) {
tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * (1.0 / (x * s)));
} else if (x <= 1.35e+154) {
tmp = (t_0 / (c * s)) / (s * (c * (x * x)));
} else {
tmp = t_0 / (x * ((s * s) * (c * (x * c))));
}
return tmp;
}
def code(x, c, s): t_0 = math.cos((x * 2.0)) tmp = 0 if x <= 1.05e-25: tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * (1.0 / (x * s))) elif x <= 1.35e+154: tmp = (t_0 / (c * s)) / (s * (c * (x * x))) else: tmp = t_0 / (x * ((s * s) * (c * (x * c)))) return tmp
function code(x, c, s) t_0 = cos(Float64(x * 2.0)) tmp = 0.0 if (x <= 1.05e-25) tmp = Float64(Float64(1.0 / Float64(c * Float64(x * s))) * Float64(Float64(1.0 / c) * Float64(1.0 / Float64(x * s)))); elseif (x <= 1.35e+154) tmp = Float64(Float64(t_0 / Float64(c * s)) / Float64(s * Float64(c * Float64(x * x)))); else tmp = Float64(t_0 / Float64(x * Float64(Float64(s * s) * Float64(c * Float64(x * c))))); end return tmp end
function tmp_2 = code(x, c, s) t_0 = cos((x * 2.0)); tmp = 0.0; if (x <= 1.05e-25) tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * (1.0 / (x * s))); elseif (x <= 1.35e+154) tmp = (t_0 / (c * s)) / (s * (c * (x * x))); else tmp = t_0 / (x * ((s * s) * (c * (x * c)))); end tmp_2 = tmp; end
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.05e-25], N[(N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] * N[(1.0 / N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.35e+154], N[(N[(t$95$0 / N[(c * s), $MachinePrecision]), $MachinePrecision] / N[(s * N[(c * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(x * N[(N[(s * s), $MachinePrecision] * N[(c * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(x \cdot 2\right)\\
\mathbf{if}\;x \leq 1.05 \cdot 10^{-25}:\\
\;\;\;\;\frac{1}{c \cdot \left(x \cdot s\right)} \cdot \left(\frac{1}{c} \cdot \frac{1}{x \cdot s}\right)\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{\frac{t_0}{c \cdot s}}{s \cdot \left(c \cdot \left(x \cdot x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{x \cdot \left(\left(s \cdot s\right) \cdot \left(c \cdot \left(x \cdot c\right)\right)\right)}\\
\end{array}
\end{array}
if x < 1.05000000000000001e-25Initial program 65.8%
associate-/r*65.3%
remove-double-neg65.3%
distribute-lft-neg-out65.3%
distribute-lft-neg-out65.3%
distribute-rgt-neg-out65.3%
associate-/r*65.8%
unpow265.8%
*-commutative65.8%
associate-*r*63.0%
sqr-neg63.0%
associate-*r*65.8%
unpow265.8%
Simplified65.8%
*-commutative65.8%
associate-*r*63.0%
associate-*l*64.6%
*-commutative64.6%
swap-sqr81.0%
add-sqr-sqrt80.9%
*-un-lft-identity80.9%
times-frac80.9%
Applied egg-rr98.4%
*-un-lft-identity98.4%
times-frac98.2%
Applied egg-rr98.2%
Taylor expanded in x around 0 86.0%
*-commutative86.0%
Simplified86.0%
if 1.05000000000000001e-25 < x < 1.35000000000000003e154Initial program 82.7%
associate-/r*82.7%
remove-double-neg82.7%
distribute-lft-neg-out82.7%
distribute-lft-neg-out82.7%
distribute-rgt-neg-out82.7%
associate-/r*82.7%
unpow282.7%
*-commutative82.7%
associate-*r*82.8%
sqr-neg82.8%
associate-*r*82.7%
unpow282.7%
Simplified82.7%
*-un-lft-identity82.7%
associate-*r*82.8%
*-commutative82.8%
associate-*l*79.9%
swap-sqr90.3%
*-commutative90.3%
associate-*r*98.5%
times-frac99.7%
*-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-un-lft-identity99.8%
associate-*r*93.7%
Applied egg-rr93.7%
if 1.35000000000000003e154 < x Initial program 57.4%
associate-/r*57.4%
remove-double-neg57.4%
distribute-lft-neg-out57.4%
distribute-lft-neg-out57.4%
distribute-rgt-neg-out57.4%
associate-/l/57.4%
distribute-rgt-neg-out57.4%
distribute-lft-neg-out57.4%
associate-*l*60.5%
distribute-lft-neg-in60.5%
distribute-lft-neg-out60.5%
remove-double-neg60.5%
associate-*r*60.5%
*-commutative60.5%
associate-*r*60.8%
Simplified64.4%
Taylor expanded in x around 0 60.5%
unpow260.5%
unpow260.5%
associate-*r*63.8%
Simplified63.8%
Final simplification84.4%
(FPCore (x c s) :precision binary64 (if (<= x 3.1e-5) (* (/ 1.0 (* c (* x s))) (* (/ 1.0 c) (+ (* -2.0 (/ x s)) (/ 1.0 (* x s))))) (/ (cos (* x 2.0)) (* x (* x (* c (* c (* s s))))))))
double code(double x, double c, double s) {
double tmp;
if (x <= 3.1e-5) {
tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * ((-2.0 * (x / s)) + (1.0 / (x * s))));
} else {
tmp = cos((x * 2.0)) / (x * (x * (c * (c * (s * s)))));
}
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 (x <= 3.1d-5) then
tmp = (1.0d0 / (c * (x * s))) * ((1.0d0 / c) * (((-2.0d0) * (x / s)) + (1.0d0 / (x * s))))
else
tmp = cos((x * 2.0d0)) / (x * (x * (c * (c * (s * s)))))
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (x <= 3.1e-5) {
tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * ((-2.0 * (x / s)) + (1.0 / (x * s))));
} else {
tmp = Math.cos((x * 2.0)) / (x * (x * (c * (c * (s * s)))));
}
return tmp;
}
def code(x, c, s): tmp = 0 if x <= 3.1e-5: tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * ((-2.0 * (x / s)) + (1.0 / (x * s)))) else: tmp = math.cos((x * 2.0)) / (x * (x * (c * (c * (s * s))))) return tmp
function code(x, c, s) tmp = 0.0 if (x <= 3.1e-5) tmp = Float64(Float64(1.0 / Float64(c * Float64(x * s))) * Float64(Float64(1.0 / c) * Float64(Float64(-2.0 * Float64(x / s)) + Float64(1.0 / Float64(x * s))))); else tmp = Float64(cos(Float64(x * 2.0)) / Float64(x * Float64(x * Float64(c * Float64(c * Float64(s * s)))))); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (x <= 3.1e-5) tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * ((-2.0 * (x / s)) + (1.0 / (x * s)))); else tmp = cos((x * 2.0)) / (x * (x * (c * (c * (s * s))))); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[x, 3.1e-5], N[(N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] * N[(N[(-2.0 * N[(x / s), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x * N[(x * N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.1 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{c \cdot \left(x \cdot s\right)} \cdot \left(\frac{1}{c} \cdot \left(-2 \cdot \frac{x}{s} + \frac{1}{x \cdot s}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(x \cdot \left(c \cdot \left(c \cdot \left(s \cdot s\right)\right)\right)\right)}\\
\end{array}
\end{array}
if x < 3.10000000000000014e-5Initial program 66.0%
associate-/r*65.6%
remove-double-neg65.6%
distribute-lft-neg-out65.6%
distribute-lft-neg-out65.6%
distribute-rgt-neg-out65.6%
associate-/r*66.0%
unpow266.0%
*-commutative66.0%
associate-*r*63.2%
sqr-neg63.2%
associate-*r*66.0%
unpow266.0%
Simplified66.0%
*-commutative66.0%
associate-*r*63.2%
associate-*l*64.4%
*-commutative64.4%
swap-sqr80.4%
add-sqr-sqrt80.4%
*-un-lft-identity80.4%
times-frac80.4%
Applied egg-rr98.4%
*-un-lft-identity98.4%
times-frac98.3%
Applied egg-rr98.3%
Taylor expanded in x around 0 77.6%
if 3.10000000000000014e-5 < x Initial program 70.3%
associate-/r*70.2%
remove-double-neg70.2%
distribute-lft-neg-out70.2%
distribute-lft-neg-out70.2%
distribute-rgt-neg-out70.2%
associate-/l/70.3%
distribute-rgt-neg-out70.3%
distribute-lft-neg-out70.3%
associate-*l*71.8%
distribute-lft-neg-in71.8%
distribute-lft-neg-out71.8%
remove-double-neg71.8%
associate-*r*71.8%
*-commutative71.8%
associate-*r*72.0%
Simplified73.8%
Final simplification76.8%
(FPCore (x c s) :precision binary64 (if (<= x 6.8e-6) (* (/ 1.0 (* c (* x s))) (* (/ 1.0 c) (+ (* -2.0 (/ x s)) (/ 1.0 (* x s))))) (/ (cos (* x 2.0)) (* x (* x (* c (* s (* c s))))))))
double code(double x, double c, double s) {
double tmp;
if (x <= 6.8e-6) {
tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * ((-2.0 * (x / s)) + (1.0 / (x * s))));
} else {
tmp = cos((x * 2.0)) / (x * (x * (c * (s * (c * s)))));
}
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 (x <= 6.8d-6) then
tmp = (1.0d0 / (c * (x * s))) * ((1.0d0 / c) * (((-2.0d0) * (x / s)) + (1.0d0 / (x * s))))
else
tmp = cos((x * 2.0d0)) / (x * (x * (c * (s * (c * s)))))
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (x <= 6.8e-6) {
tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * ((-2.0 * (x / s)) + (1.0 / (x * s))));
} else {
tmp = Math.cos((x * 2.0)) / (x * (x * (c * (s * (c * s)))));
}
return tmp;
}
def code(x, c, s): tmp = 0 if x <= 6.8e-6: tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * ((-2.0 * (x / s)) + (1.0 / (x * s)))) else: tmp = math.cos((x * 2.0)) / (x * (x * (c * (s * (c * s))))) return tmp
function code(x, c, s) tmp = 0.0 if (x <= 6.8e-6) tmp = Float64(Float64(1.0 / Float64(c * Float64(x * s))) * Float64(Float64(1.0 / c) * Float64(Float64(-2.0 * Float64(x / s)) + Float64(1.0 / Float64(x * s))))); else tmp = Float64(cos(Float64(x * 2.0)) / Float64(x * Float64(x * Float64(c * Float64(s * Float64(c * s)))))); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (x <= 6.8e-6) tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * ((-2.0 * (x / s)) + (1.0 / (x * s)))); else tmp = cos((x * 2.0)) / (x * (x * (c * (s * (c * s))))); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[x, 6.8e-6], N[(N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] * N[(N[(-2.0 * N[(x / s), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x * N[(x * N[(c * N[(s * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.8 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{c \cdot \left(x \cdot s\right)} \cdot \left(\frac{1}{c} \cdot \left(-2 \cdot \frac{x}{s} + \frac{1}{x \cdot s}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(x \cdot \left(c \cdot \left(s \cdot \left(c \cdot s\right)\right)\right)\right)}\\
\end{array}
\end{array}
if x < 6.80000000000000012e-6Initial program 66.0%
associate-/r*65.6%
remove-double-neg65.6%
distribute-lft-neg-out65.6%
distribute-lft-neg-out65.6%
distribute-rgt-neg-out65.6%
associate-/r*66.0%
unpow266.0%
*-commutative66.0%
associate-*r*63.2%
sqr-neg63.2%
associate-*r*66.0%
unpow266.0%
Simplified66.0%
*-commutative66.0%
associate-*r*63.2%
associate-*l*64.4%
*-commutative64.4%
swap-sqr80.4%
add-sqr-sqrt80.4%
*-un-lft-identity80.4%
times-frac80.4%
Applied egg-rr98.4%
*-un-lft-identity98.4%
times-frac98.3%
Applied egg-rr98.3%
Taylor expanded in x around 0 77.6%
if 6.80000000000000012e-6 < x Initial program 70.3%
associate-/r*70.2%
remove-double-neg70.2%
distribute-lft-neg-out70.2%
distribute-lft-neg-out70.2%
distribute-rgt-neg-out70.2%
associate-/l/70.3%
distribute-rgt-neg-out70.3%
distribute-lft-neg-out70.3%
associate-*l*71.8%
distribute-lft-neg-in71.8%
distribute-lft-neg-out71.8%
remove-double-neg71.8%
associate-*r*71.8%
*-commutative71.8%
associate-*r*72.0%
Simplified73.8%
Taylor expanded in c around 0 73.8%
unpow273.8%
associate-*r*82.7%
Simplified82.7%
Final simplification78.8%
(FPCore (x c s) :precision binary64 (let* ((t_0 (* c (* x s)))) (* (/ 1.0 t_0) (/ (cos (* x 2.0)) t_0))))
double code(double x, double c, double s) {
double t_0 = c * (x * s);
return (1.0 / t_0) * (cos((x * 2.0)) / t_0);
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = c * (x * s)
code = (1.0d0 / t_0) * (cos((x * 2.0d0)) / t_0)
end function
public static double code(double x, double c, double s) {
double t_0 = c * (x * s);
return (1.0 / t_0) * (Math.cos((x * 2.0)) / t_0);
}
def code(x, c, s): t_0 = c * (x * s) return (1.0 / t_0) * (math.cos((x * 2.0)) / t_0)
function code(x, c, s) t_0 = Float64(c * Float64(x * s)) return Float64(Float64(1.0 / t_0) * Float64(cos(Float64(x * 2.0)) / t_0)) end
function tmp = code(x, c, s) t_0 = c * (x * s); tmp = (1.0 / t_0) * (cos((x * 2.0)) / t_0); end
code[x_, c_, s_] := Block[{t$95$0 = N[(c * 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}
\\
\begin{array}{l}
t_0 := c \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 67.0%
associate-/r*66.6%
remove-double-neg66.6%
distribute-lft-neg-out66.6%
distribute-lft-neg-out66.6%
distribute-rgt-neg-out66.6%
associate-/r*67.0%
unpow267.0%
*-commutative67.0%
associate-*r*64.1%
sqr-neg64.1%
associate-*r*67.0%
unpow267.0%
Simplified67.0%
*-commutative67.0%
associate-*r*64.1%
associate-*l*65.0%
*-commutative65.0%
swap-sqr79.8%
add-sqr-sqrt79.7%
*-un-lft-identity79.7%
times-frac79.7%
Applied egg-rr98.0%
Final simplification98.0%
(FPCore (x c s) :precision binary64 (if (<= s 2.6e-177) (* (/ 1.0 c) (/ (- (/ 1.0 (* c (* x x))) (/ 2.0 c)) (* s s))) (pow (* c (* x s)) -2.0)))
double code(double x, double c, double s) {
double tmp;
if (s <= 2.6e-177) {
tmp = (1.0 / c) * (((1.0 / (c * (x * x))) - (2.0 / c)) / (s * s));
} 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 <= 2.6d-177) then
tmp = (1.0d0 / c) * (((1.0d0 / (c * (x * x))) - (2.0d0 / c)) / (s * s))
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 <= 2.6e-177) {
tmp = (1.0 / c) * (((1.0 / (c * (x * x))) - (2.0 / c)) / (s * s));
} else {
tmp = Math.pow((c * (x * s)), -2.0);
}
return tmp;
}
def code(x, c, s): tmp = 0 if s <= 2.6e-177: tmp = (1.0 / c) * (((1.0 / (c * (x * x))) - (2.0 / c)) / (s * s)) else: tmp = math.pow((c * (x * s)), -2.0) return tmp
function code(x, c, s) tmp = 0.0 if (s <= 2.6e-177) tmp = Float64(Float64(1.0 / c) * Float64(Float64(Float64(1.0 / Float64(c * Float64(x * x))) - Float64(2.0 / c)) / Float64(s * s))); 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 <= 2.6e-177) tmp = (1.0 / c) * (((1.0 / (c * (x * x))) - (2.0 / c)) / (s * s)); else tmp = (c * (x * s)) ^ -2.0; end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[s, 2.6e-177], N[(N[(1.0 / c), $MachinePrecision] * N[(N[(N[(1.0 / N[(c * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(2.0 / c), $MachinePrecision]), $MachinePrecision] / N[(s * s), $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 2.6 \cdot 10^{-177}:\\
\;\;\;\;\frac{1}{c} \cdot \frac{\frac{1}{c \cdot \left(x \cdot x\right)} - \frac{2}{c}}{s \cdot s}\\
\mathbf{else}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\end{array}
\end{array}
if s < 2.6000000000000001e-177Initial program 64.8%
associate-/r*64.3%
remove-double-neg64.3%
distribute-lft-neg-out64.3%
distribute-lft-neg-out64.3%
distribute-rgt-neg-out64.3%
associate-/r*64.8%
unpow264.8%
*-commutative64.8%
associate-*r*60.8%
sqr-neg60.8%
associate-*r*64.8%
unpow264.8%
Simplified64.8%
*-un-lft-identity64.8%
associate-*l*69.0%
times-frac69.4%
*-commutative69.4%
associate-*r*64.8%
pow264.8%
pow264.8%
pow-prod-down84.6%
*-commutative84.6%
Applied egg-rr84.6%
Taylor expanded in x around 0 30.8%
associate-/r*30.6%
unpow230.6%
unpow230.6%
associate-*r/30.6%
metadata-eval30.6%
unpow230.6%
associate-*l*33.3%
*-commutative33.3%
*-commutative33.3%
Simplified33.3%
Taylor expanded in s around 0 53.4%
unpow253.4%
associate-*r/53.4%
metadata-eval53.4%
unpow253.4%
Simplified53.4%
if 2.6000000000000001e-177 < s Initial program 70.5%
associate-/r*70.4%
remove-double-neg70.4%
distribute-lft-neg-out70.4%
distribute-lft-neg-out70.4%
distribute-rgt-neg-out70.4%
associate-/r*70.5%
unpow270.5%
*-commutative70.5%
associate-*r*69.2%
sqr-neg69.2%
associate-*r*70.5%
unpow270.5%
Simplified70.5%
Taylor expanded in x around 0 63.0%
unpow263.0%
associate-/r*62.9%
unpow262.9%
unpow262.9%
swap-sqr78.0%
unpow278.0%
associate-/r*77.9%
unpow277.9%
swap-sqr90.9%
unpow290.9%
associate-*r*90.0%
*-commutative90.0%
associate-*l*87.6%
Simplified87.6%
pow-flip87.7%
associate-*r*90.1%
*-commutative90.1%
associate-*r*91.0%
metadata-eval91.0%
Applied egg-rr91.0%
Final simplification67.9%
(FPCore (x c s) :precision binary64 (if (<= s 1.8e-179) (* (/ 1.0 c) (/ (- (/ 1.0 (* c (* x x))) (/ 2.0 c)) (* s s))) (* (/ 1.0 (* c (* x s))) (* (/ 1.0 c) (/ 1.0 (* x s))))))
double code(double x, double c, double s) {
double tmp;
if (s <= 1.8e-179) {
tmp = (1.0 / c) * (((1.0 / (c * (x * x))) - (2.0 / c)) / (s * s));
} else {
tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * (1.0 / (x * s)));
}
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.8d-179) then
tmp = (1.0d0 / c) * (((1.0d0 / (c * (x * x))) - (2.0d0 / c)) / (s * s))
else
tmp = (1.0d0 / (c * (x * s))) * ((1.0d0 / c) * (1.0d0 / (x * s)))
end if
code = tmp
end function
public static double code(double x, double c, double s) {
double tmp;
if (s <= 1.8e-179) {
tmp = (1.0 / c) * (((1.0 / (c * (x * x))) - (2.0 / c)) / (s * s));
} else {
tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * (1.0 / (x * s)));
}
return tmp;
}
def code(x, c, s): tmp = 0 if s <= 1.8e-179: tmp = (1.0 / c) * (((1.0 / (c * (x * x))) - (2.0 / c)) / (s * s)) else: tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * (1.0 / (x * s))) return tmp
function code(x, c, s) tmp = 0.0 if (s <= 1.8e-179) tmp = Float64(Float64(1.0 / c) * Float64(Float64(Float64(1.0 / Float64(c * Float64(x * x))) - Float64(2.0 / c)) / Float64(s * s))); else tmp = Float64(Float64(1.0 / Float64(c * Float64(x * s))) * Float64(Float64(1.0 / c) * Float64(1.0 / Float64(x * s)))); end return tmp end
function tmp_2 = code(x, c, s) tmp = 0.0; if (s <= 1.8e-179) tmp = (1.0 / c) * (((1.0 / (c * (x * x))) - (2.0 / c)) / (s * s)); else tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * (1.0 / (x * s))); end tmp_2 = tmp; end
code[x_, c_, s_] := If[LessEqual[s, 1.8e-179], N[(N[(1.0 / c), $MachinePrecision] * N[(N[(N[(1.0 / N[(c * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(2.0 / c), $MachinePrecision]), $MachinePrecision] / N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] * N[(1.0 / N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;s \leq 1.8 \cdot 10^{-179}:\\
\;\;\;\;\frac{1}{c} \cdot \frac{\frac{1}{c \cdot \left(x \cdot x\right)} - \frac{2}{c}}{s \cdot s}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{c \cdot \left(x \cdot s\right)} \cdot \left(\frac{1}{c} \cdot \frac{1}{x \cdot s}\right)\\
\end{array}
\end{array}
if s < 1.80000000000000004e-179Initial program 64.8%
associate-/r*64.3%
remove-double-neg64.3%
distribute-lft-neg-out64.3%
distribute-lft-neg-out64.3%
distribute-rgt-neg-out64.3%
associate-/r*64.8%
unpow264.8%
*-commutative64.8%
associate-*r*60.8%
sqr-neg60.8%
associate-*r*64.8%
unpow264.8%
Simplified64.8%
*-un-lft-identity64.8%
associate-*l*69.0%
times-frac69.4%
*-commutative69.4%
associate-*r*64.8%
pow264.8%
pow264.8%
pow-prod-down84.6%
*-commutative84.6%
Applied egg-rr84.6%
Taylor expanded in x around 0 30.8%
associate-/r*30.6%
unpow230.6%
unpow230.6%
associate-*r/30.6%
metadata-eval30.6%
unpow230.6%
associate-*l*33.3%
*-commutative33.3%
*-commutative33.3%
Simplified33.3%
Taylor expanded in s around 0 53.4%
unpow253.4%
associate-*r/53.4%
metadata-eval53.4%
unpow253.4%
Simplified53.4%
if 1.80000000000000004e-179 < s Initial program 70.5%
associate-/r*70.4%
remove-double-neg70.4%
distribute-lft-neg-out70.4%
distribute-lft-neg-out70.4%
distribute-rgt-neg-out70.4%
associate-/r*70.5%
unpow270.5%
*-commutative70.5%
associate-*r*69.2%
sqr-neg69.2%
associate-*r*70.5%
unpow270.5%
Simplified70.5%
*-commutative70.5%
associate-*r*69.2%
associate-*l*71.3%
*-commutative71.3%
swap-sqr85.8%
add-sqr-sqrt85.8%
*-un-lft-identity85.8%
times-frac85.7%
Applied egg-rr98.6%
*-un-lft-identity98.6%
times-frac98.7%
Applied egg-rr98.7%
Taylor expanded in x around 0 91.0%
*-commutative91.0%
Simplified91.0%
Final simplification68.0%
(FPCore (x c s) :precision binary64 (* (/ 1.0 (* c (* x s))) (* (/ 1.0 c) (/ 1.0 (* x s)))))
double code(double x, double c, double s) {
return (1.0 / (c * (x * s))) * ((1.0 / c) * (1.0 / (x * s)));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = (1.0d0 / (c * (x * s))) * ((1.0d0 / c) * (1.0d0 / (x * s)))
end function
public static double code(double x, double c, double s) {
return (1.0 / (c * (x * s))) * ((1.0 / c) * (1.0 / (x * s)));
}
def code(x, c, s): return (1.0 / (c * (x * s))) * ((1.0 / c) * (1.0 / (x * s)))
function code(x, c, s) return Float64(Float64(1.0 / Float64(c * Float64(x * s))) * Float64(Float64(1.0 / c) * Float64(1.0 / Float64(x * s)))) end
function tmp = code(x, c, s) tmp = (1.0 / (c * (x * s))) * ((1.0 / c) * (1.0 / (x * s))); end
code[x_, c_, s_] := N[(N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / c), $MachinePrecision] * N[(1.0 / N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{c \cdot \left(x \cdot s\right)} \cdot \left(\frac{1}{c} \cdot \frac{1}{x \cdot s}\right)
\end{array}
Initial program 67.0%
associate-/r*66.6%
remove-double-neg66.6%
distribute-lft-neg-out66.6%
distribute-lft-neg-out66.6%
distribute-rgt-neg-out66.6%
associate-/r*67.0%
unpow267.0%
*-commutative67.0%
associate-*r*64.1%
sqr-neg64.1%
associate-*r*67.0%
unpow267.0%
Simplified67.0%
*-commutative67.0%
associate-*r*64.1%
associate-*l*65.0%
*-commutative65.0%
swap-sqr79.8%
add-sqr-sqrt79.7%
*-un-lft-identity79.7%
times-frac79.7%
Applied egg-rr98.0%
*-un-lft-identity98.0%
times-frac97.8%
Applied egg-rr97.8%
Taylor expanded in x around 0 80.6%
*-commutative80.6%
Simplified80.6%
Final simplification80.6%
(FPCore (x c s) :precision binary64 (let* ((t_0 (/ 1.0 (* c (* x s))))) (* t_0 t_0)))
double code(double x, double c, double s) {
double t_0 = 1.0 / (c * (x * s));
return 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 = 1.0d0 / (c * (x * s))
code = t_0 * t_0
end function
public static double code(double x, double c, double s) {
double t_0 = 1.0 / (c * (x * s));
return t_0 * t_0;
}
def code(x, c, s): t_0 = 1.0 / (c * (x * s)) return t_0 * t_0
function code(x, c, s) t_0 = Float64(1.0 / Float64(c * Float64(x * s))) return Float64(t_0 * t_0) end
function tmp = code(x, c, s) t_0 = 1.0 / (c * (x * s)); tmp = t_0 * t_0; end
code[x_, c_, s_] := Block[{t$95$0 = N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{c \cdot \left(x \cdot s\right)}\\
t_0 \cdot t_0
\end{array}
\end{array}
Initial program 67.0%
associate-/r*66.6%
remove-double-neg66.6%
distribute-lft-neg-out66.6%
distribute-lft-neg-out66.6%
distribute-rgt-neg-out66.6%
associate-/r*67.0%
unpow267.0%
*-commutative67.0%
associate-*r*64.1%
sqr-neg64.1%
associate-*r*67.0%
unpow267.0%
Simplified67.0%
*-commutative67.0%
associate-*r*64.1%
associate-*l*65.0%
*-commutative65.0%
swap-sqr79.8%
add-sqr-sqrt79.7%
*-un-lft-identity79.7%
times-frac79.7%
Applied egg-rr98.0%
Taylor expanded in x around 0 80.8%
Final simplification80.8%
(FPCore (x c s) :precision binary64 (/ 1.0 (* x (* x (* c (* c (* s s)))))))
double code(double x, double c, double s) {
return 1.0 / (x * (x * (c * (c * (s * s)))));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / (x * (x * (c * (c * (s * s)))))
end function
public static double code(double x, double c, double s) {
return 1.0 / (x * (x * (c * (c * (s * s)))));
}
def code(x, c, s): return 1.0 / (x * (x * (c * (c * (s * s)))))
function code(x, c, s) return Float64(1.0 / Float64(x * Float64(x * Float64(c * Float64(c * Float64(s * s)))))) end
function tmp = code(x, c, s) tmp = 1.0 / (x * (x * (c * (c * (s * s))))); end
code[x_, c_, s_] := N[(1.0 / N[(x * N[(x * N[(c * N[(c * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x \cdot \left(x \cdot \left(c \cdot \left(c \cdot \left(s \cdot s\right)\right)\right)\right)}
\end{array}
Initial program 67.0%
associate-/r*66.6%
remove-double-neg66.6%
distribute-lft-neg-out66.6%
distribute-lft-neg-out66.6%
distribute-rgt-neg-out66.6%
associate-/l/67.0%
distribute-rgt-neg-out67.0%
distribute-lft-neg-out67.0%
associate-*l*68.6%
distribute-lft-neg-in68.6%
distribute-lft-neg-out68.6%
remove-double-neg68.6%
associate-*r*68.7%
*-commutative68.7%
associate-*r*69.0%
Simplified72.7%
Taylor expanded in x around 0 63.5%
Final simplification63.5%
(FPCore (x c s) :precision binary64 (/ 1.0 (* x (* x (* c (* s (* c s)))))))
double code(double x, double c, double s) {
return 1.0 / (x * (x * (c * (s * (c * s)))));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / (x * (x * (c * (s * (c * s)))))
end function
public static double code(double x, double c, double s) {
return 1.0 / (x * (x * (c * (s * (c * s)))));
}
def code(x, c, s): return 1.0 / (x * (x * (c * (s * (c * s)))))
function code(x, c, s) return Float64(1.0 / Float64(x * Float64(x * Float64(c * Float64(s * Float64(c * s)))))) end
function tmp = code(x, c, s) tmp = 1.0 / (x * (x * (c * (s * (c * s))))); end
code[x_, c_, s_] := N[(1.0 / N[(x * N[(x * N[(c * N[(s * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x \cdot \left(x \cdot \left(c \cdot \left(s \cdot \left(c \cdot s\right)\right)\right)\right)}
\end{array}
Initial program 67.0%
associate-/r*66.6%
remove-double-neg66.6%
distribute-lft-neg-out66.6%
distribute-lft-neg-out66.6%
distribute-rgt-neg-out66.6%
associate-/l/67.0%
distribute-rgt-neg-out67.0%
distribute-lft-neg-out67.0%
associate-*l*68.6%
distribute-lft-neg-in68.6%
distribute-lft-neg-out68.6%
remove-double-neg68.6%
associate-*r*68.7%
*-commutative68.7%
associate-*r*69.0%
Simplified72.7%
Taylor expanded in x around 0 63.5%
Taylor expanded in c around 0 63.5%
unpow272.7%
associate-*r*84.0%
Simplified71.9%
Final simplification71.9%
(FPCore (x c s) :precision binary64 (let* ((t_0 (* c (* x s)))) (/ 1.0 (* t_0 t_0))))
double code(double x, double c, double s) {
double t_0 = c * (x * s);
return 1.0 / (t_0 * t_0);
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = c * (x * s)
code = 1.0d0 / (t_0 * t_0)
end function
public static double code(double x, double c, double s) {
double t_0 = c * (x * s);
return 1.0 / (t_0 * t_0);
}
def code(x, c, s): t_0 = c * (x * s) return 1.0 / (t_0 * t_0)
function code(x, c, s) t_0 = Float64(c * Float64(x * s)) return Float64(1.0 / Float64(t_0 * t_0)) end
function tmp = code(x, c, s) t_0 = c * (x * s); tmp = 1.0 / (t_0 * t_0); end
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, N[(1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\frac{1}{t_0 \cdot t_0}
\end{array}
\end{array}
Initial program 67.0%
associate-/r*66.6%
remove-double-neg66.6%
distribute-lft-neg-out66.6%
distribute-lft-neg-out66.6%
distribute-rgt-neg-out66.6%
associate-/r*67.0%
unpow267.0%
*-commutative67.0%
associate-*r*64.1%
sqr-neg64.1%
associate-*r*67.0%
unpow267.0%
Simplified67.0%
Taylor expanded in x around 0 56.6%
unpow256.6%
associate-/r*55.9%
unpow255.9%
unpow255.9%
swap-sqr67.7%
unpow267.7%
associate-/r*68.4%
unpow268.4%
swap-sqr80.5%
unpow280.5%
associate-*r*79.6%
*-commutative79.6%
associate-*l*79.1%
Simplified79.1%
associate-*r*79.6%
*-commutative79.6%
associate-*r*80.5%
pow280.5%
Applied egg-rr80.5%
Final simplification80.5%
(FPCore (x c s) :precision binary64 (* (/ 1.0 c) (/ (/ -2.0 c) (* s s))))
double code(double x, double c, double s) {
return (1.0 / c) * ((-2.0 / c) / (s * s));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = (1.0d0 / c) * (((-2.0d0) / c) / (s * s))
end function
public static double code(double x, double c, double s) {
return (1.0 / c) * ((-2.0 / c) / (s * s));
}
def code(x, c, s): return (1.0 / c) * ((-2.0 / c) / (s * s))
function code(x, c, s) return Float64(Float64(1.0 / c) * Float64(Float64(-2.0 / c) / Float64(s * s))) end
function tmp = code(x, c, s) tmp = (1.0 / c) * ((-2.0 / c) / (s * s)); end
code[x_, c_, s_] := N[(N[(1.0 / c), $MachinePrecision] * N[(N[(-2.0 / c), $MachinePrecision] / N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{c} \cdot \frac{\frac{-2}{c}}{s \cdot s}
\end{array}
Initial program 67.0%
associate-/r*66.6%
remove-double-neg66.6%
distribute-lft-neg-out66.6%
distribute-lft-neg-out66.6%
distribute-rgt-neg-out66.6%
associate-/r*67.0%
unpow267.0%
*-commutative67.0%
associate-*r*64.1%
sqr-neg64.1%
associate-*r*67.0%
unpow267.0%
Simplified67.0%
*-un-lft-identity67.0%
associate-*l*70.8%
times-frac71.1%
*-commutative71.1%
associate-*r*67.8%
pow267.8%
pow267.8%
pow-prod-down85.8%
*-commutative85.8%
Applied egg-rr85.8%
Taylor expanded in x around 0 39.5%
associate-/r*39.4%
unpow239.4%
unpow239.4%
associate-*r/39.4%
metadata-eval39.4%
unpow239.4%
associate-*l*40.6%
*-commutative40.6%
*-commutative40.6%
Simplified40.6%
Taylor expanded in x around inf 28.0%
associate-/r*28.0%
unpow228.0%
Simplified28.0%
Final simplification28.0%
(FPCore (x c s) :precision binary64 (/ (/ -2.0 (* s s)) (* c c)))
double code(double x, double c, double s) {
return (-2.0 / (s * s)) / (c * c);
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = ((-2.0d0) / (s * s)) / (c * c)
end function
public static double code(double x, double c, double s) {
return (-2.0 / (s * s)) / (c * c);
}
def code(x, c, s): return (-2.0 / (s * s)) / (c * c)
function code(x, c, s) return Float64(Float64(-2.0 / Float64(s * s)) / Float64(c * c)) end
function tmp = code(x, c, s) tmp = (-2.0 / (s * s)) / (c * c); end
code[x_, c_, s_] := N[(N[(-2.0 / N[(s * s), $MachinePrecision]), $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{-2}{s \cdot s}}{c \cdot c}
\end{array}
Initial program 67.0%
associate-/r*66.6%
remove-double-neg66.6%
distribute-lft-neg-out66.6%
distribute-lft-neg-out66.6%
distribute-rgt-neg-out66.6%
associate-/r*67.0%
unpow267.0%
*-commutative67.0%
associate-*r*64.1%
sqr-neg64.1%
associate-*r*67.0%
unpow267.0%
Simplified67.0%
*-un-lft-identity67.0%
associate-*l*70.8%
times-frac71.1%
*-commutative71.1%
associate-*r*67.8%
pow267.8%
pow267.8%
pow-prod-down85.8%
*-commutative85.8%
Applied egg-rr85.8%
Taylor expanded in x around 0 39.5%
associate-/r*39.4%
unpow239.4%
unpow239.4%
associate-*r/39.4%
metadata-eval39.4%
unpow239.4%
associate-*l*40.6%
*-commutative40.6%
*-commutative40.6%
Simplified40.6%
Taylor expanded in x around inf 28.4%
associate-/r*28.4%
unpow228.4%
unpow228.4%
Simplified28.4%
Final simplification28.4%
herbie shell --seed 2023274
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))