
(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 13 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}
x_m = (fabs.f64 x)
(FPCore (x_m c s)
:precision binary64
(let* ((t_0 (* c (* x_m s)))
(t_1 (cos (* 2.0 x_m)))
(t_2 (* (* c s) (sqrt x_m))))
(if (<= (/ t_1 (* (pow c 2.0) (* x_m (* x_m (pow s 2.0))))) INFINITY)
(* (/ 1.0 t_0) (/ t_1 t_0))
(/ (/ (/ t_1 x_m) t_2) t_2))))x_m = fabs(x);
double code(double x_m, double c, double s) {
double t_0 = c * (x_m * s);
double t_1 = cos((2.0 * x_m));
double t_2 = (c * s) * sqrt(x_m);
double tmp;
if ((t_1 / (pow(c, 2.0) * (x_m * (x_m * pow(s, 2.0))))) <= ((double) INFINITY)) {
tmp = (1.0 / t_0) * (t_1 / t_0);
} else {
tmp = ((t_1 / x_m) / t_2) / t_2;
}
return tmp;
}
x_m = Math.abs(x);
public static double code(double x_m, double c, double s) {
double t_0 = c * (x_m * s);
double t_1 = Math.cos((2.0 * x_m));
double t_2 = (c * s) * Math.sqrt(x_m);
double tmp;
if ((t_1 / (Math.pow(c, 2.0) * (x_m * (x_m * Math.pow(s, 2.0))))) <= Double.POSITIVE_INFINITY) {
tmp = (1.0 / t_0) * (t_1 / t_0);
} else {
tmp = ((t_1 / x_m) / t_2) / t_2;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, c, s): t_0 = c * (x_m * s) t_1 = math.cos((2.0 * x_m)) t_2 = (c * s) * math.sqrt(x_m) tmp = 0 if (t_1 / (math.pow(c, 2.0) * (x_m * (x_m * math.pow(s, 2.0))))) <= math.inf: tmp = (1.0 / t_0) * (t_1 / t_0) else: tmp = ((t_1 / x_m) / t_2) / t_2 return tmp
x_m = abs(x) function code(x_m, c, s) t_0 = Float64(c * Float64(x_m * s)) t_1 = cos(Float64(2.0 * x_m)) t_2 = Float64(Float64(c * s) * sqrt(x_m)) tmp = 0.0 if (Float64(t_1 / Float64((c ^ 2.0) * Float64(x_m * Float64(x_m * (s ^ 2.0))))) <= Inf) tmp = Float64(Float64(1.0 / t_0) * Float64(t_1 / t_0)); else tmp = Float64(Float64(Float64(t_1 / x_m) / t_2) / t_2); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, c, s) t_0 = c * (x_m * s); t_1 = cos((2.0 * x_m)); t_2 = (c * s) * sqrt(x_m); tmp = 0.0; if ((t_1 / ((c ^ 2.0) * (x_m * (x_m * (s ^ 2.0))))) <= Inf) tmp = (1.0 / t_0) * (t_1 / t_0); else tmp = ((t_1 / x_m) / t_2) / t_2; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, c_, s_] := Block[{t$95$0 = N[(c * N[(x$95$m * s), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(2.0 * x$95$m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * s), $MachinePrecision] * N[Sqrt[x$95$m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 / N[(N[Power[c, 2.0], $MachinePrecision] * N[(x$95$m * N[(x$95$m * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(t$95$1 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 / x$95$m), $MachinePrecision] / t$95$2), $MachinePrecision] / t$95$2), $MachinePrecision]]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := c \cdot \left(x\_m \cdot s\right)\\
t_1 := \cos \left(2 \cdot x\_m\right)\\
t_2 := \left(c \cdot s\right) \cdot \sqrt{x\_m}\\
\mathbf{if}\;\frac{t\_1}{{c}^{2} \cdot \left(x\_m \cdot \left(x\_m \cdot {s}^{2}\right)\right)} \leq \infty:\\
\;\;\;\;\frac{1}{t\_0} \cdot \frac{t\_1}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{t\_1}{x\_m}}{t\_2}}{t\_2}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < +inf.0Initial program 80.6%
*-un-lft-identity80.6%
add-sqr-sqrt80.6%
times-frac80.6%
sqrt-prod80.6%
sqrt-pow160.0%
metadata-eval60.0%
pow160.0%
*-commutative60.0%
associate-*r*54.5%
unpow254.5%
pow-prod-down60.0%
sqrt-pow157.0%
metadata-eval57.0%
pow157.0%
*-commutative57.0%
Applied egg-rr99.6%
if +inf.0 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) Initial program 0.0%
*-un-lft-identity0.0%
add-sqr-sqrt0.0%
times-frac0.0%
sqrt-prod0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
associate-*r*0.0%
unpow20.0%
pow-prod-down0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
Applied egg-rr76.5%
frac-times76.6%
*-un-lft-identity76.6%
unpow276.6%
*-commutative76.6%
*-commutative76.6%
*-commutative76.6%
associate-*r*97.1%
unpow-prod-down67.2%
pow267.2%
associate-*l*79.9%
associate-/l/79.7%
add-sqr-sqrt39.6%
associate-/r*39.6%
Applied egg-rr44.2%
Final simplification89.9%
x_m = (fabs.f64 x)
(FPCore (x_m c s)
:precision binary64
(let* ((t_0 (* c (* x_m s))) (t_1 (cos (* 2.0 x_m))))
(if (<= (/ t_1 (* (pow c 2.0) (* x_m (* x_m (pow s 2.0))))) INFINITY)
(* (/ 1.0 t_0) (/ t_1 t_0))
(* (pow (/ 1.0 (* (* c s) (sqrt x_m))) 2.0) (/ t_1 x_m)))))x_m = fabs(x);
double code(double x_m, double c, double s) {
double t_0 = c * (x_m * s);
double t_1 = cos((2.0 * x_m));
double tmp;
if ((t_1 / (pow(c, 2.0) * (x_m * (x_m * pow(s, 2.0))))) <= ((double) INFINITY)) {
tmp = (1.0 / t_0) * (t_1 / t_0);
} else {
tmp = pow((1.0 / ((c * s) * sqrt(x_m))), 2.0) * (t_1 / x_m);
}
return tmp;
}
x_m = Math.abs(x);
public static double code(double x_m, double c, double s) {
double t_0 = c * (x_m * s);
double t_1 = Math.cos((2.0 * x_m));
double tmp;
if ((t_1 / (Math.pow(c, 2.0) * (x_m * (x_m * Math.pow(s, 2.0))))) <= Double.POSITIVE_INFINITY) {
tmp = (1.0 / t_0) * (t_1 / t_0);
} else {
tmp = Math.pow((1.0 / ((c * s) * Math.sqrt(x_m))), 2.0) * (t_1 / x_m);
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, c, s): t_0 = c * (x_m * s) t_1 = math.cos((2.0 * x_m)) tmp = 0 if (t_1 / (math.pow(c, 2.0) * (x_m * (x_m * math.pow(s, 2.0))))) <= math.inf: tmp = (1.0 / t_0) * (t_1 / t_0) else: tmp = math.pow((1.0 / ((c * s) * math.sqrt(x_m))), 2.0) * (t_1 / x_m) return tmp
x_m = abs(x) function code(x_m, c, s) t_0 = Float64(c * Float64(x_m * s)) t_1 = cos(Float64(2.0 * x_m)) tmp = 0.0 if (Float64(t_1 / Float64((c ^ 2.0) * Float64(x_m * Float64(x_m * (s ^ 2.0))))) <= Inf) tmp = Float64(Float64(1.0 / t_0) * Float64(t_1 / t_0)); else tmp = Float64((Float64(1.0 / Float64(Float64(c * s) * sqrt(x_m))) ^ 2.0) * Float64(t_1 / x_m)); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, c, s) t_0 = c * (x_m * s); t_1 = cos((2.0 * x_m)); tmp = 0.0; if ((t_1 / ((c ^ 2.0) * (x_m * (x_m * (s ^ 2.0))))) <= Inf) tmp = (1.0 / t_0) * (t_1 / t_0); else tmp = ((1.0 / ((c * s) * sqrt(x_m))) ^ 2.0) * (t_1 / x_m); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, c_, s_] := Block[{t$95$0 = N[(c * N[(x$95$m * s), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(2.0 * x$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 / N[(N[Power[c, 2.0], $MachinePrecision] * N[(x$95$m * N[(x$95$m * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(t$95$1 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(1.0 / N[(N[(c * s), $MachinePrecision] * N[Sqrt[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(t$95$1 / x$95$m), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := c \cdot \left(x\_m \cdot s\right)\\
t_1 := \cos \left(2 \cdot x\_m\right)\\
\mathbf{if}\;\frac{t\_1}{{c}^{2} \cdot \left(x\_m \cdot \left(x\_m \cdot {s}^{2}\right)\right)} \leq \infty:\\
\;\;\;\;\frac{1}{t\_0} \cdot \frac{t\_1}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{1}{\left(c \cdot s\right) \cdot \sqrt{x\_m}}\right)}^{2} \cdot \frac{t\_1}{x\_m}\\
\end{array}
\end{array}
if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < +inf.0Initial program 80.6%
*-un-lft-identity80.6%
add-sqr-sqrt80.6%
times-frac80.6%
sqrt-prod80.6%
sqrt-pow160.0%
metadata-eval60.0%
pow160.0%
*-commutative60.0%
associate-*r*54.5%
unpow254.5%
pow-prod-down60.0%
sqrt-pow157.0%
metadata-eval57.0%
pow157.0%
*-commutative57.0%
Applied egg-rr99.6%
if +inf.0 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) Initial program 0.0%
*-un-lft-identity0.0%
associate-*r*0.5%
times-frac0.5%
*-commutative0.5%
associate-*r*0.9%
pow-prod-down79.8%
Applied egg-rr79.8%
add-sqr-sqrt44.3%
pow244.3%
sqrt-div39.6%
metadata-eval39.6%
sqrt-prod39.5%
sqrt-pow144.1%
metadata-eval44.1%
pow144.1%
Applied egg-rr44.1%
Final simplification89.9%
x_m = (fabs.f64 x)
(FPCore (x_m c s)
:precision binary64
(let* ((t_0 (/ (/ 1.0 c) (* x_m s))))
(if (<= x_m 4.4e-45)
(* t_0 t_0)
(/ (/ (cos (* 2.0 x_m)) (* c (* (* x_m s) (* x_m c)))) s))))x_m = fabs(x);
double code(double x_m, double c, double s) {
double t_0 = (1.0 / c) / (x_m * s);
double tmp;
if (x_m <= 4.4e-45) {
tmp = t_0 * t_0;
} else {
tmp = (cos((2.0 * x_m)) / (c * ((x_m * s) * (x_m * c)))) / s;
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m, c, s)
real(8), intent (in) :: x_m
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 / c) / (x_m * s)
if (x_m <= 4.4d-45) then
tmp = t_0 * t_0
else
tmp = (cos((2.0d0 * x_m)) / (c * ((x_m * s) * (x_m * c)))) / s
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double c, double s) {
double t_0 = (1.0 / c) / (x_m * s);
double tmp;
if (x_m <= 4.4e-45) {
tmp = t_0 * t_0;
} else {
tmp = (Math.cos((2.0 * x_m)) / (c * ((x_m * s) * (x_m * c)))) / s;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, c, s): t_0 = (1.0 / c) / (x_m * s) tmp = 0 if x_m <= 4.4e-45: tmp = t_0 * t_0 else: tmp = (math.cos((2.0 * x_m)) / (c * ((x_m * s) * (x_m * c)))) / s return tmp
x_m = abs(x) function code(x_m, c, s) t_0 = Float64(Float64(1.0 / c) / Float64(x_m * s)) tmp = 0.0 if (x_m <= 4.4e-45) tmp = Float64(t_0 * t_0); else tmp = Float64(Float64(cos(Float64(2.0 * x_m)) / Float64(c * Float64(Float64(x_m * s) * Float64(x_m * c)))) / s); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, c, s) t_0 = (1.0 / c) / (x_m * s); tmp = 0.0; if (x_m <= 4.4e-45) tmp = t_0 * t_0; else tmp = (cos((2.0 * x_m)) / (c * ((x_m * s) * (x_m * c)))) / s; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, c_, s_] := Block[{t$95$0 = N[(N[(1.0 / c), $MachinePrecision] / N[(x$95$m * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$95$m, 4.4e-45], N[(t$95$0 * t$95$0), $MachinePrecision], N[(N[(N[Cos[N[(2.0 * x$95$m), $MachinePrecision]], $MachinePrecision] / N[(c * N[(N[(x$95$m * s), $MachinePrecision] * N[(x$95$m * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / s), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{c}}{x\_m \cdot s}\\
\mathbf{if}\;x\_m \leq 4.4 \cdot 10^{-45}:\\
\;\;\;\;t\_0 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(2 \cdot x\_m\right)}{c \cdot \left(\left(x\_m \cdot s\right) \cdot \left(x\_m \cdot c\right)\right)}}{s}\\
\end{array}
\end{array}
if x < 4.39999999999999987e-45Initial program 64.6%
Taylor expanded in x around 0 52.7%
associate-/r*52.7%
*-commutative52.7%
unpow252.7%
unpow252.7%
swap-sqr67.1%
unpow267.1%
associate-/r*67.0%
unpow267.0%
unpow267.0%
swap-sqr79.1%
unpow279.1%
*-commutative79.1%
Simplified79.1%
pow-flip79.4%
*-commutative79.4%
pow-flip79.1%
unpow279.1%
metadata-eval79.1%
frac-times79.4%
associate-/r*79.4%
associate-/r*79.4%
Applied egg-rr79.4%
if 4.39999999999999987e-45 < x Initial program 70.5%
*-un-lft-identity70.5%
add-sqr-sqrt70.5%
times-frac70.5%
sqrt-prod70.5%
sqrt-pow157.8%
metadata-eval57.8%
pow157.8%
*-commutative57.8%
associate-*r*52.7%
unpow252.7%
pow-prod-down57.9%
sqrt-pow158.4%
metadata-eval58.4%
pow158.4%
*-commutative58.4%
Applied egg-rr97.4%
associate-*l/97.4%
*-un-lft-identity97.4%
associate-*r*96.4%
associate-/r*95.2%
*-commutative95.2%
Applied egg-rr95.2%
*-un-lft-identity95.2%
associate-/l/95.1%
*-commutative95.1%
Applied egg-rr95.1%
*-lft-identity95.1%
*-commutative95.1%
associate-*l*92.9%
associate-*r*92.9%
*-commutative92.9%
Simplified92.9%
Final simplification83.8%
x_m = (fabs.f64 x)
(FPCore (x_m c s)
:precision binary64
(let* ((t_0 (/ (/ 1.0 c) (* x_m s))))
(if (<= x_m 6.8e-46)
(* t_0 t_0)
(/ (/ (/ (cos (* 2.0 x_m)) (* c (* x_m (* c s)))) x_m) s))))x_m = fabs(x);
double code(double x_m, double c, double s) {
double t_0 = (1.0 / c) / (x_m * s);
double tmp;
if (x_m <= 6.8e-46) {
tmp = t_0 * t_0;
} else {
tmp = ((cos((2.0 * x_m)) / (c * (x_m * (c * s)))) / x_m) / s;
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m, c, s)
real(8), intent (in) :: x_m
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 / c) / (x_m * s)
if (x_m <= 6.8d-46) then
tmp = t_0 * t_0
else
tmp = ((cos((2.0d0 * x_m)) / (c * (x_m * (c * s)))) / x_m) / s
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double c, double s) {
double t_0 = (1.0 / c) / (x_m * s);
double tmp;
if (x_m <= 6.8e-46) {
tmp = t_0 * t_0;
} else {
tmp = ((Math.cos((2.0 * x_m)) / (c * (x_m * (c * s)))) / x_m) / s;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, c, s): t_0 = (1.0 / c) / (x_m * s) tmp = 0 if x_m <= 6.8e-46: tmp = t_0 * t_0 else: tmp = ((math.cos((2.0 * x_m)) / (c * (x_m * (c * s)))) / x_m) / s return tmp
x_m = abs(x) function code(x_m, c, s) t_0 = Float64(Float64(1.0 / c) / Float64(x_m * s)) tmp = 0.0 if (x_m <= 6.8e-46) tmp = Float64(t_0 * t_0); else tmp = Float64(Float64(Float64(cos(Float64(2.0 * x_m)) / Float64(c * Float64(x_m * Float64(c * s)))) / x_m) / s); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, c, s) t_0 = (1.0 / c) / (x_m * s); tmp = 0.0; if (x_m <= 6.8e-46) tmp = t_0 * t_0; else tmp = ((cos((2.0 * x_m)) / (c * (x_m * (c * s)))) / x_m) / s; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, c_, s_] := Block[{t$95$0 = N[(N[(1.0 / c), $MachinePrecision] / N[(x$95$m * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$95$m, 6.8e-46], N[(t$95$0 * t$95$0), $MachinePrecision], N[(N[(N[(N[Cos[N[(2.0 * x$95$m), $MachinePrecision]], $MachinePrecision] / N[(c * N[(x$95$m * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x$95$m), $MachinePrecision] / s), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{c}}{x\_m \cdot s}\\
\mathbf{if}\;x\_m \leq 6.8 \cdot 10^{-46}:\\
\;\;\;\;t\_0 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\cos \left(2 \cdot x\_m\right)}{c \cdot \left(x\_m \cdot \left(c \cdot s\right)\right)}}{x\_m}}{s}\\
\end{array}
\end{array}
if x < 6.79999999999999992e-46Initial program 64.6%
Taylor expanded in x around 0 52.7%
associate-/r*52.7%
*-commutative52.7%
unpow252.7%
unpow252.7%
swap-sqr67.1%
unpow267.1%
associate-/r*67.0%
unpow267.0%
unpow267.0%
swap-sqr79.1%
unpow279.1%
*-commutative79.1%
Simplified79.1%
pow-flip79.4%
*-commutative79.4%
pow-flip79.1%
unpow279.1%
metadata-eval79.1%
frac-times79.4%
associate-/r*79.4%
associate-/r*79.4%
Applied egg-rr79.4%
if 6.79999999999999992e-46 < x Initial program 70.5%
*-un-lft-identity70.5%
add-sqr-sqrt70.5%
times-frac70.5%
sqrt-prod70.5%
sqrt-pow157.8%
metadata-eval57.8%
pow157.8%
*-commutative57.8%
associate-*r*52.7%
unpow252.7%
pow-prod-down57.9%
sqrt-pow158.4%
metadata-eval58.4%
pow158.4%
*-commutative58.4%
Applied egg-rr97.4%
associate-*l/97.4%
*-un-lft-identity97.4%
associate-*r*96.4%
associate-/r*95.2%
*-commutative95.2%
Applied egg-rr95.2%
*-un-lft-identity95.2%
*-commutative95.2%
times-frac91.9%
*-commutative91.9%
Applied egg-rr91.9%
associate-*l/91.9%
*-rgt-identity91.9%
associate-*r/91.9%
associate-*l/91.8%
*-lft-identity91.8%
associate-*l/91.9%
associate-*r/91.9%
*-rgt-identity91.9%
associate-/l/91.9%
*-commutative91.9%
associate-*r*93.0%
*-commutative93.0%
Simplified93.0%
Final simplification83.8%
x_m = (fabs.f64 x)
(FPCore (x_m c s)
:precision binary64
(let* ((t_0 (/ (/ 1.0 c) (* x_m s))))
(if (<= x_m 1.02e-20)
(* t_0 t_0)
(/ (/ (/ (cos (* 2.0 x_m)) (* x_m (* c s))) (* x_m c)) s))))x_m = fabs(x);
double code(double x_m, double c, double s) {
double t_0 = (1.0 / c) / (x_m * s);
double tmp;
if (x_m <= 1.02e-20) {
tmp = t_0 * t_0;
} else {
tmp = ((cos((2.0 * x_m)) / (x_m * (c * s))) / (x_m * c)) / s;
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m, c, s)
real(8), intent (in) :: x_m
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 / c) / (x_m * s)
if (x_m <= 1.02d-20) then
tmp = t_0 * t_0
else
tmp = ((cos((2.0d0 * x_m)) / (x_m * (c * s))) / (x_m * c)) / s
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double c, double s) {
double t_0 = (1.0 / c) / (x_m * s);
double tmp;
if (x_m <= 1.02e-20) {
tmp = t_0 * t_0;
} else {
tmp = ((Math.cos((2.0 * x_m)) / (x_m * (c * s))) / (x_m * c)) / s;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, c, s): t_0 = (1.0 / c) / (x_m * s) tmp = 0 if x_m <= 1.02e-20: tmp = t_0 * t_0 else: tmp = ((math.cos((2.0 * x_m)) / (x_m * (c * s))) / (x_m * c)) / s return tmp
x_m = abs(x) function code(x_m, c, s) t_0 = Float64(Float64(1.0 / c) / Float64(x_m * s)) tmp = 0.0 if (x_m <= 1.02e-20) tmp = Float64(t_0 * t_0); else tmp = Float64(Float64(Float64(cos(Float64(2.0 * x_m)) / Float64(x_m * Float64(c * s))) / Float64(x_m * c)) / s); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, c, s) t_0 = (1.0 / c) / (x_m * s); tmp = 0.0; if (x_m <= 1.02e-20) tmp = t_0 * t_0; else tmp = ((cos((2.0 * x_m)) / (x_m * (c * s))) / (x_m * c)) / s; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, c_, s_] := Block[{t$95$0 = N[(N[(1.0 / c), $MachinePrecision] / N[(x$95$m * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$95$m, 1.02e-20], N[(t$95$0 * t$95$0), $MachinePrecision], N[(N[(N[(N[Cos[N[(2.0 * x$95$m), $MachinePrecision]], $MachinePrecision] / N[(x$95$m * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$95$m * c), $MachinePrecision]), $MachinePrecision] / s), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{c}}{x\_m \cdot s}\\
\mathbf{if}\;x\_m \leq 1.02 \cdot 10^{-20}:\\
\;\;\;\;t\_0 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\cos \left(2 \cdot x\_m\right)}{x\_m \cdot \left(c \cdot s\right)}}{x\_m \cdot c}}{s}\\
\end{array}
\end{array}
if x < 1.02000000000000001e-20Initial program 64.8%
Taylor expanded in x around 0 53.3%
associate-/r*53.3%
*-commutative53.3%
unpow253.3%
unpow253.3%
swap-sqr67.3%
unpow267.3%
associate-/r*67.2%
unpow267.2%
unpow267.2%
swap-sqr79.5%
unpow279.5%
*-commutative79.5%
Simplified79.5%
pow-flip79.9%
*-commutative79.9%
pow-flip79.5%
unpow279.5%
metadata-eval79.5%
frac-times79.9%
associate-/r*79.9%
associate-/r*79.9%
Applied egg-rr79.9%
if 1.02000000000000001e-20 < x Initial program 70.2%
*-un-lft-identity70.2%
add-sqr-sqrt70.2%
times-frac70.2%
sqrt-prod70.2%
sqrt-pow158.2%
metadata-eval58.2%
pow158.2%
*-commutative58.2%
associate-*r*52.7%
unpow252.7%
pow-prod-down58.2%
sqrt-pow158.7%
metadata-eval58.7%
pow158.7%
*-commutative58.7%
Applied egg-rr97.3%
associate-*l/97.3%
*-un-lft-identity97.3%
associate-*r*96.2%
associate-/r*94.9%
*-commutative94.9%
Applied egg-rr94.9%
Taylor expanded in x around inf 94.9%
associate-*r*92.7%
*-commutative92.7%
Simplified92.7%
Final simplification83.8%
x_m = (fabs.f64 x) (FPCore (x_m c s) :precision binary64 (let* ((t_0 (* c (* x_m s)))) (* (/ 1.0 t_0) (/ (cos (* 2.0 x_m)) t_0))))
x_m = fabs(x);
double code(double x_m, double c, double s) {
double t_0 = c * (x_m * s);
return (1.0 / t_0) * (cos((2.0 * x_m)) / t_0);
}
x_m = abs(x)
real(8) function code(x_m, c, s)
real(8), intent (in) :: x_m
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = c * (x_m * s)
code = (1.0d0 / t_0) * (cos((2.0d0 * x_m)) / t_0)
end function
x_m = Math.abs(x);
public static double code(double x_m, double c, double s) {
double t_0 = c * (x_m * s);
return (1.0 / t_0) * (Math.cos((2.0 * x_m)) / t_0);
}
x_m = math.fabs(x) def code(x_m, c, s): t_0 = c * (x_m * s) return (1.0 / t_0) * (math.cos((2.0 * x_m)) / t_0)
x_m = abs(x) function code(x_m, c, s) t_0 = Float64(c * Float64(x_m * s)) return Float64(Float64(1.0 / t_0) * Float64(cos(Float64(2.0 * x_m)) / t_0)) end
x_m = abs(x); function tmp = code(x_m, c, s) t_0 = c * (x_m * s); tmp = (1.0 / t_0) * (cos((2.0 * x_m)) / t_0); end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, c_, s_] := Block[{t$95$0 = N[(c * N[(x$95$m * s), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[Cos[N[(2.0 * x$95$m), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := c \cdot \left(x\_m \cdot s\right)\\
\frac{1}{t\_0} \cdot \frac{\cos \left(2 \cdot x\_m\right)}{t\_0}
\end{array}
\end{array}
Initial program 66.5%
*-un-lft-identity66.5%
add-sqr-sqrt66.5%
times-frac66.4%
sqrt-prod66.4%
sqrt-pow149.5%
metadata-eval49.5%
pow149.5%
*-commutative49.5%
associate-*r*45.0%
unpow245.0%
pow-prod-down49.5%
sqrt-pow147.0%
metadata-eval47.0%
pow147.0%
*-commutative47.0%
Applied egg-rr95.6%
Final simplification95.6%
x_m = (fabs.f64 x) (FPCore (x_m c s) :precision binary64 (/ (/ (cos (* 2.0 x_m)) c) (* (* x_m s) (* c (* x_m s)))))
x_m = fabs(x);
double code(double x_m, double c, double s) {
return (cos((2.0 * x_m)) / c) / ((x_m * s) * (c * (x_m * s)));
}
x_m = abs(x)
real(8) function code(x_m, c, s)
real(8), intent (in) :: x_m
real(8), intent (in) :: c
real(8), intent (in) :: s
code = (cos((2.0d0 * x_m)) / c) / ((x_m * s) * (c * (x_m * s)))
end function
x_m = Math.abs(x);
public static double code(double x_m, double c, double s) {
return (Math.cos((2.0 * x_m)) / c) / ((x_m * s) * (c * (x_m * s)));
}
x_m = math.fabs(x) def code(x_m, c, s): return (math.cos((2.0 * x_m)) / c) / ((x_m * s) * (c * (x_m * s)))
x_m = abs(x) function code(x_m, c, s) return Float64(Float64(cos(Float64(2.0 * x_m)) / c) / Float64(Float64(x_m * s) * Float64(c * Float64(x_m * s)))) end
x_m = abs(x); function tmp = code(x_m, c, s) tmp = (cos((2.0 * x_m)) / c) / ((x_m * s) * (c * (x_m * s))); end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, c_, s_] := N[(N[(N[Cos[N[(2.0 * x$95$m), $MachinePrecision]], $MachinePrecision] / c), $MachinePrecision] / N[(N[(x$95$m * s), $MachinePrecision] * N[(c * N[(x$95$m * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{\frac{\cos \left(2 \cdot x\_m\right)}{c}}{\left(x\_m \cdot s\right) \cdot \left(c \cdot \left(x\_m \cdot s\right)\right)}
\end{array}
Initial program 66.5%
*-un-lft-identity66.5%
add-sqr-sqrt66.5%
times-frac66.4%
sqrt-prod66.4%
sqrt-pow149.5%
metadata-eval49.5%
pow149.5%
*-commutative49.5%
associate-*r*45.0%
unpow245.0%
pow-prod-down49.5%
sqrt-pow147.0%
metadata-eval47.0%
pow147.0%
*-commutative47.0%
Applied egg-rr95.6%
*-commutative95.6%
associate-/r*95.6%
frac-times92.5%
div-inv92.5%
*-commutative92.5%
Applied egg-rr92.5%
Final simplification92.5%
x_m = (fabs.f64 x) (FPCore (x_m c s) :precision binary64 (if (<= s 1.2e+224) (/ 1.0 (* (* x_m c) (* s (* c (* x_m s))))) (/ 1.0 (* (* c s) (* x_m (* x_m (* c s)))))))
x_m = fabs(x);
double code(double x_m, double c, double s) {
double tmp;
if (s <= 1.2e+224) {
tmp = 1.0 / ((x_m * c) * (s * (c * (x_m * s))));
} else {
tmp = 1.0 / ((c * s) * (x_m * (x_m * (c * s))));
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m, c, s)
real(8), intent (in) :: x_m
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (s <= 1.2d+224) then
tmp = 1.0d0 / ((x_m * c) * (s * (c * (x_m * s))))
else
tmp = 1.0d0 / ((c * s) * (x_m * (x_m * (c * s))))
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double c, double s) {
double tmp;
if (s <= 1.2e+224) {
tmp = 1.0 / ((x_m * c) * (s * (c * (x_m * s))));
} else {
tmp = 1.0 / ((c * s) * (x_m * (x_m * (c * s))));
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, c, s): tmp = 0 if s <= 1.2e+224: tmp = 1.0 / ((x_m * c) * (s * (c * (x_m * s)))) else: tmp = 1.0 / ((c * s) * (x_m * (x_m * (c * s)))) return tmp
x_m = abs(x) function code(x_m, c, s) tmp = 0.0 if (s <= 1.2e+224) tmp = Float64(1.0 / Float64(Float64(x_m * c) * Float64(s * Float64(c * Float64(x_m * s))))); else tmp = Float64(1.0 / Float64(Float64(c * s) * Float64(x_m * Float64(x_m * Float64(c * s))))); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, c, s) tmp = 0.0; if (s <= 1.2e+224) tmp = 1.0 / ((x_m * c) * (s * (c * (x_m * s)))); else tmp = 1.0 / ((c * s) * (x_m * (x_m * (c * s)))); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, c_, s_] := If[LessEqual[s, 1.2e+224], N[(1.0 / N[(N[(x$95$m * c), $MachinePrecision] * N[(s * N[(c * N[(x$95$m * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(c * s), $MachinePrecision] * N[(x$95$m * N[(x$95$m * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;s \leq 1.2 \cdot 10^{+224}:\\
\;\;\;\;\frac{1}{\left(x\_m \cdot c\right) \cdot \left(s \cdot \left(c \cdot \left(x\_m \cdot s\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(c \cdot s\right) \cdot \left(x\_m \cdot \left(x\_m \cdot \left(c \cdot s\right)\right)\right)}\\
\end{array}
\end{array}
if s < 1.2e224Initial program 67.0%
Taylor expanded in x around 0 52.8%
associate-/r*52.7%
*-commutative52.7%
unpow252.7%
unpow252.7%
swap-sqr65.1%
unpow265.1%
associate-/r*65.3%
unpow265.3%
unpow265.3%
swap-sqr73.5%
unpow273.5%
*-commutative73.5%
Simplified73.5%
*-commutative73.5%
*-commutative73.5%
*-commutative73.5%
unpow273.5%
associate-*r*73.1%
associate-*l*72.6%
Applied egg-rr72.6%
if 1.2e224 < s Initial program 61.2%
Taylor expanded in x around 0 52.5%
associate-/r*52.5%
*-commutative52.5%
unpow252.5%
unpow252.5%
swap-sqr61.4%
unpow261.4%
associate-/r*61.4%
unpow261.4%
unpow261.4%
swap-sqr88.3%
unpow288.3%
*-commutative88.3%
Simplified88.3%
unpow288.3%
associate-*r*88.3%
*-commutative88.3%
associate-*l*88.4%
Applied egg-rr88.4%
pow188.4%
*-commutative88.4%
Applied egg-rr88.4%
unpow188.4%
associate-*r*88.3%
*-commutative88.3%
Simplified88.3%
Final simplification74.0%
x_m = (fabs.f64 x) (FPCore (x_m c s) :precision binary64 (let* ((t_0 (/ (/ 1.0 c) (* x_m s)))) (* t_0 t_0)))
x_m = fabs(x);
double code(double x_m, double c, double s) {
double t_0 = (1.0 / c) / (x_m * s);
return t_0 * t_0;
}
x_m = abs(x)
real(8) function code(x_m, c, s)
real(8), intent (in) :: x_m
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = (1.0d0 / c) / (x_m * s)
code = t_0 * t_0
end function
x_m = Math.abs(x);
public static double code(double x_m, double c, double s) {
double t_0 = (1.0 / c) / (x_m * s);
return t_0 * t_0;
}
x_m = math.fabs(x) def code(x_m, c, s): t_0 = (1.0 / c) / (x_m * s) return t_0 * t_0
x_m = abs(x) function code(x_m, c, s) t_0 = Float64(Float64(1.0 / c) / Float64(x_m * s)) return Float64(t_0 * t_0) end
x_m = abs(x); function tmp = code(x_m, c, s) t_0 = (1.0 / c) / (x_m * s); tmp = t_0 * t_0; end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, c_, s_] := Block[{t$95$0 = N[(N[(1.0 / c), $MachinePrecision] / N[(x$95$m * s), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{c}}{x\_m \cdot s}\\
t\_0 \cdot t\_0
\end{array}
\end{array}
Initial program 66.5%
Taylor expanded in x around 0 52.8%
associate-/r*52.6%
*-commutative52.6%
unpow252.6%
unpow252.6%
swap-sqr64.8%
unpow264.8%
associate-/r*65.0%
unpow265.0%
unpow265.0%
swap-sqr74.9%
unpow274.9%
*-commutative74.9%
Simplified74.9%
pow-flip75.1%
*-commutative75.1%
pow-flip74.9%
unpow274.9%
metadata-eval74.9%
frac-times75.1%
associate-/r*75.1%
associate-/r*75.1%
Applied egg-rr75.1%
Final simplification75.1%
x_m = (fabs.f64 x) (FPCore (x_m c s) :precision binary64 (/ 1.0 (* (* c s) (* x_m (* c (* x_m s))))))
x_m = fabs(x);
double code(double x_m, double c, double s) {
return 1.0 / ((c * s) * (x_m * (c * (x_m * s))));
}
x_m = abs(x)
real(8) function code(x_m, c, s)
real(8), intent (in) :: x_m
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / ((c * s) * (x_m * (c * (x_m * s))))
end function
x_m = Math.abs(x);
public static double code(double x_m, double c, double s) {
return 1.0 / ((c * s) * (x_m * (c * (x_m * s))));
}
x_m = math.fabs(x) def code(x_m, c, s): return 1.0 / ((c * s) * (x_m * (c * (x_m * s))))
x_m = abs(x) function code(x_m, c, s) return Float64(1.0 / Float64(Float64(c * s) * Float64(x_m * Float64(c * Float64(x_m * s))))) end
x_m = abs(x); function tmp = code(x_m, c, s) tmp = 1.0 / ((c * s) * (x_m * (c * (x_m * s)))); end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, c_, s_] := N[(1.0 / N[(N[(c * s), $MachinePrecision] * N[(x$95$m * N[(c * N[(x$95$m * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{1}{\left(c \cdot s\right) \cdot \left(x\_m \cdot \left(c \cdot \left(x\_m \cdot s\right)\right)\right)}
\end{array}
Initial program 66.5%
Taylor expanded in x around 0 52.8%
associate-/r*52.6%
*-commutative52.6%
unpow252.6%
unpow252.6%
swap-sqr64.8%
unpow264.8%
associate-/r*65.0%
unpow265.0%
unpow265.0%
swap-sqr74.9%
unpow274.9%
*-commutative74.9%
Simplified74.9%
unpow274.9%
associate-*r*74.1%
*-commutative74.1%
associate-*l*72.4%
Applied egg-rr72.4%
Final simplification72.4%
x_m = (fabs.f64 x) (FPCore (x_m c s) :precision binary64 (/ 1.0 (* (* c s) (* x_m (* x_m (* c s))))))
x_m = fabs(x);
double code(double x_m, double c, double s) {
return 1.0 / ((c * s) * (x_m * (x_m * (c * s))));
}
x_m = abs(x)
real(8) function code(x_m, c, s)
real(8), intent (in) :: x_m
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / ((c * s) * (x_m * (x_m * (c * s))))
end function
x_m = Math.abs(x);
public static double code(double x_m, double c, double s) {
return 1.0 / ((c * s) * (x_m * (x_m * (c * s))));
}
x_m = math.fabs(x) def code(x_m, c, s): return 1.0 / ((c * s) * (x_m * (x_m * (c * s))))
x_m = abs(x) function code(x_m, c, s) return Float64(1.0 / Float64(Float64(c * s) * Float64(x_m * Float64(x_m * Float64(c * s))))) end
x_m = abs(x); function tmp = code(x_m, c, s) tmp = 1.0 / ((c * s) * (x_m * (x_m * (c * s)))); end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, c_, s_] := N[(1.0 / N[(N[(c * s), $MachinePrecision] * N[(x$95$m * N[(x$95$m * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{1}{\left(c \cdot s\right) \cdot \left(x\_m \cdot \left(x\_m \cdot \left(c \cdot s\right)\right)\right)}
\end{array}
Initial program 66.5%
Taylor expanded in x around 0 52.8%
associate-/r*52.6%
*-commutative52.6%
unpow252.6%
unpow252.6%
swap-sqr64.8%
unpow264.8%
associate-/r*65.0%
unpow265.0%
unpow265.0%
swap-sqr74.9%
unpow274.9%
*-commutative74.9%
Simplified74.9%
unpow274.9%
associate-*r*74.1%
*-commutative74.1%
associate-*l*72.4%
Applied egg-rr72.4%
pow172.4%
*-commutative72.4%
Applied egg-rr72.4%
unpow172.4%
associate-*r*73.9%
*-commutative73.9%
Simplified73.9%
Final simplification73.9%
x_m = (fabs.f64 x) (FPCore (x_m c s) :precision binary64 (/ 1.0 (* (* x_m s) (* c (* c (* x_m s))))))
x_m = fabs(x);
double code(double x_m, double c, double s) {
return 1.0 / ((x_m * s) * (c * (c * (x_m * s))));
}
x_m = abs(x)
real(8) function code(x_m, c, s)
real(8), intent (in) :: x_m
real(8), intent (in) :: c
real(8), intent (in) :: s
code = 1.0d0 / ((x_m * s) * (c * (c * (x_m * s))))
end function
x_m = Math.abs(x);
public static double code(double x_m, double c, double s) {
return 1.0 / ((x_m * s) * (c * (c * (x_m * s))));
}
x_m = math.fabs(x) def code(x_m, c, s): return 1.0 / ((x_m * s) * (c * (c * (x_m * s))))
x_m = abs(x) function code(x_m, c, s) return Float64(1.0 / Float64(Float64(x_m * s) * Float64(c * Float64(c * Float64(x_m * s))))) end
x_m = abs(x); function tmp = code(x_m, c, s) tmp = 1.0 / ((x_m * s) * (c * (c * (x_m * s)))); end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, c_, s_] := N[(1.0 / N[(N[(x$95$m * s), $MachinePrecision] * N[(c * N[(c * N[(x$95$m * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{1}{\left(x\_m \cdot s\right) \cdot \left(c \cdot \left(c \cdot \left(x\_m \cdot s\right)\right)\right)}
\end{array}
Initial program 66.5%
Taylor expanded in x around 0 52.8%
associate-/r*52.6%
*-commutative52.6%
unpow252.6%
unpow252.6%
swap-sqr64.8%
unpow264.8%
associate-/r*65.0%
unpow265.0%
unpow265.0%
swap-sqr74.9%
unpow274.9%
*-commutative74.9%
Simplified74.9%
*-commutative74.9%
*-commutative74.9%
*-commutative74.9%
unpow274.9%
associate-*r*74.2%
Applied egg-rr74.2%
Final simplification74.2%
x_m = (fabs.f64 x) (FPCore (x_m c s) :precision binary64 (let* ((t_0 (* c (* x_m s)))) (/ (/ 1.0 t_0) t_0)))
x_m = fabs(x);
double code(double x_m, double c, double s) {
double t_0 = c * (x_m * s);
return (1.0 / t_0) / t_0;
}
x_m = abs(x)
real(8) function code(x_m, c, s)
real(8), intent (in) :: x_m
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
t_0 = c * (x_m * s)
code = (1.0d0 / t_0) / t_0
end function
x_m = Math.abs(x);
public static double code(double x_m, double c, double s) {
double t_0 = c * (x_m * s);
return (1.0 / t_0) / t_0;
}
x_m = math.fabs(x) def code(x_m, c, s): t_0 = c * (x_m * s) return (1.0 / t_0) / t_0
x_m = abs(x) function code(x_m, c, s) t_0 = Float64(c * Float64(x_m * s)) return Float64(Float64(1.0 / t_0) / t_0) end
x_m = abs(x); function tmp = code(x_m, c, s) t_0 = c * (x_m * s); tmp = (1.0 / t_0) / t_0; end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, c_, s_] := Block[{t$95$0 = N[(c * N[(x$95$m * s), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := c \cdot \left(x\_m \cdot s\right)\\
\frac{\frac{1}{t\_0}}{t\_0}
\end{array}
\end{array}
Initial program 66.5%
*-un-lft-identity66.5%
add-sqr-sqrt66.5%
times-frac66.4%
sqrt-prod66.4%
sqrt-pow149.5%
metadata-eval49.5%
pow149.5%
*-commutative49.5%
associate-*r*45.0%
unpow245.0%
pow-prod-down49.5%
sqrt-pow147.0%
metadata-eval47.0%
pow147.0%
*-commutative47.0%
Applied egg-rr95.6%
Taylor expanded in x around 0 75.1%
associate-/r*75.1%
Simplified75.1%
associate-*l/75.2%
*-un-lft-identity75.2%
*-commutative75.2%
associate-/r*75.1%
*-commutative75.1%
*-commutative75.1%
Applied egg-rr75.1%
Final simplification75.1%
herbie shell --seed 2024095
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))