
(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 14 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}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* s (* x c))))
(if (<= x 7.8e-54)
(* (/ 1.0 c) (/ (/ 1.0 (* c (* x s))) (* x s)))
(/ (/ (cos (* x 2.0)) t_0) t_0))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = s * (x * c);
double tmp;
if (x <= 7.8e-54) {
tmp = (1.0 / c) * ((1.0 / (c * (x * s))) / (x * s));
} else {
tmp = (cos((x * 2.0)) / t_0) / t_0;
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 = s * (x * c)
if (x <= 7.8d-54) then
tmp = (1.0d0 / c) * ((1.0d0 / (c * (x * s))) / (x * s))
else
tmp = (cos((x * 2.0d0)) / t_0) / t_0
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = s * (x * c);
double tmp;
if (x <= 7.8e-54) {
tmp = (1.0 / c) * ((1.0 / (c * (x * s))) / (x * s));
} else {
tmp = (Math.cos((x * 2.0)) / t_0) / t_0;
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = s * (x * c) tmp = 0 if x <= 7.8e-54: tmp = (1.0 / c) * ((1.0 / (c * (x * s))) / (x * s)) else: tmp = (math.cos((x * 2.0)) / t_0) / t_0 return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(s * Float64(x * c)) tmp = 0.0 if (x <= 7.8e-54) tmp = Float64(Float64(1.0 / c) * Float64(Float64(1.0 / Float64(c * Float64(x * s))) / Float64(x * s))); else tmp = Float64(Float64(cos(Float64(x * 2.0)) / t_0) / t_0); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = s * (x * c);
tmp = 0.0;
if (x <= 7.8e-54)
tmp = (1.0 / c) * ((1.0 / (c * (x * s))) / (x * s));
else
tmp = (cos((x * 2.0)) / t_0) / t_0;
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 7.8e-54], N[(N[(1.0 / c), $MachinePrecision] * N[(N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := s \cdot \left(x \cdot c\right)\\
\mathbf{if}\;x \leq 7.8 \cdot 10^{-54}:\\
\;\;\;\;\frac{1}{c} \cdot \frac{\frac{1}{c \cdot \left(x \cdot s\right)}}{x \cdot s}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x \cdot 2\right)}{t_0}}{t_0}\\
\end{array}
\end{array}
if x < 7.8e-54Initial program 62.1%
associate-/r*62.1%
unpow262.1%
*-commutative62.1%
unpow262.1%
Simplified62.1%
associate-*r*57.2%
pow257.2%
pow257.2%
pow-prod-down77.3%
Applied egg-rr77.3%
div-inv76.8%
*-commutative76.8%
frac-times77.5%
pow277.5%
*-commutative77.5%
unpow-prod-down97.1%
*-commutative97.1%
*-commutative97.1%
associate-*r*96.1%
pow296.1%
frac-times96.5%
*-commutative96.5%
associate-*l/96.5%
associate-*r*94.4%
*-commutative94.4%
*-commutative94.4%
Applied egg-rr89.6%
Taylor expanded in x around 0 77.3%
if 7.8e-54 < x Initial program 70.9%
associate-*r*69.8%
*-commutative69.8%
*-commutative69.8%
associate-*r*65.7%
*-commutative65.7%
unpow265.7%
unpow265.7%
Simplified65.7%
*-un-lft-identity65.7%
associate-*r*69.8%
*-commutative69.8%
add-sqr-sqrt69.8%
times-frac69.7%
Applied egg-rr99.5%
associate-*l/99.5%
*-un-lft-identity99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 98.3%
associate-*r*99.5%
*-commutative99.5%
associate-*r*96.9%
Simplified96.9%
Taylor expanded in x around 0 95.4%
associate-*r*99.5%
*-commutative99.5%
associate-*r*96.9%
Simplified96.8%
Final simplification82.1%
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (cos (* x 2.0))))
(if (<= x 9e-9)
(pow (* c (* x s)) -2.0)
(if (<= x 3.58e+152)
(/ t_0 (* s (* (* x x) (* c (* c s)))))
(if (<= x 4.9e+213)
(/ t_0 (* x (* x (* (* c c) (* s s)))))
(/ (/ 1.0 s) (* (* x c) (* s (* x c)))))))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = cos((x * 2.0));
double tmp;
if (x <= 9e-9) {
tmp = pow((c * (x * s)), -2.0);
} else if (x <= 3.58e+152) {
tmp = t_0 / (s * ((x * x) * (c * (c * s))));
} else if (x <= 4.9e+213) {
tmp = t_0 / (x * (x * ((c * c) * (s * s))));
} else {
tmp = (1.0 / s) / ((x * c) * (s * (x * c)));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 <= 9d-9) then
tmp = (c * (x * s)) ** (-2.0d0)
else if (x <= 3.58d+152) then
tmp = t_0 / (s * ((x * x) * (c * (c * s))))
else if (x <= 4.9d+213) then
tmp = t_0 / (x * (x * ((c * c) * (s * s))))
else
tmp = (1.0d0 / s) / ((x * c) * (s * (x * c)))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = Math.cos((x * 2.0));
double tmp;
if (x <= 9e-9) {
tmp = Math.pow((c * (x * s)), -2.0);
} else if (x <= 3.58e+152) {
tmp = t_0 / (s * ((x * x) * (c * (c * s))));
} else if (x <= 4.9e+213) {
tmp = t_0 / (x * (x * ((c * c) * (s * s))));
} else {
tmp = (1.0 / s) / ((x * c) * (s * (x * c)));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = math.cos((x * 2.0)) tmp = 0 if x <= 9e-9: tmp = math.pow((c * (x * s)), -2.0) elif x <= 3.58e+152: tmp = t_0 / (s * ((x * x) * (c * (c * s)))) elif x <= 4.9e+213: tmp = t_0 / (x * (x * ((c * c) * (s * s)))) else: tmp = (1.0 / s) / ((x * c) * (s * (x * c))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = cos(Float64(x * 2.0)) tmp = 0.0 if (x <= 9e-9) tmp = Float64(c * Float64(x * s)) ^ -2.0; elseif (x <= 3.58e+152) tmp = Float64(t_0 / Float64(s * Float64(Float64(x * x) * Float64(c * Float64(c * s))))); elseif (x <= 4.9e+213) tmp = Float64(t_0 / Float64(x * Float64(x * Float64(Float64(c * c) * Float64(s * s))))); else tmp = Float64(Float64(1.0 / s) / Float64(Float64(x * c) * Float64(s * Float64(x * c)))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = cos((x * 2.0));
tmp = 0.0;
if (x <= 9e-9)
tmp = (c * (x * s)) ^ -2.0;
elseif (x <= 3.58e+152)
tmp = t_0 / (s * ((x * x) * (c * (c * s))));
elseif (x <= 4.9e+213)
tmp = t_0 / (x * (x * ((c * c) * (s * s))));
else
tmp = (1.0 / s) / ((x * c) * (s * (x * c)));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 9e-9], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], If[LessEqual[x, 3.58e+152], N[(t$95$0 / N[(s * N[(N[(x * x), $MachinePrecision] * N[(c * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.9e+213], N[(t$95$0 / N[(x * N[(x * N[(N[(c * c), $MachinePrecision] * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / s), $MachinePrecision] / N[(N[(x * c), $MachinePrecision] * N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := \cos \left(x \cdot 2\right)\\
\mathbf{if}\;x \leq 9 \cdot 10^{-9}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{elif}\;x \leq 3.58 \cdot 10^{+152}:\\
\;\;\;\;\frac{t_0}{s \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)}\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{+213}:\\
\;\;\;\;\frac{t_0}{x \cdot \left(x \cdot \left(\left(c \cdot c\right) \cdot \left(s \cdot s\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{s}}{\left(x \cdot c\right) \cdot \left(s \cdot \left(x \cdot c\right)\right)}\\
\end{array}
\end{array}
if x < 8.99999999999999953e-9Initial program 62.0%
associate-*r*62.7%
*-commutative62.7%
*-commutative62.7%
associate-*r*61.3%
*-commutative61.3%
unpow261.3%
unpow261.3%
Simplified61.3%
*-un-lft-identity61.3%
associate-*r*62.7%
*-commutative62.7%
add-sqr-sqrt62.6%
times-frac62.6%
Applied egg-rr96.7%
Taylor expanded in x around 0 51.7%
Simplified81.3%
if 8.99999999999999953e-9 < x < 3.58000000000000006e152Initial program 71.2%
*-commutative71.2%
associate-*l*71.2%
associate-*r*71.9%
*-commutative71.9%
unpow271.9%
associate-*r*73.7%
associate-*r*77.3%
*-commutative77.3%
unpow277.3%
Simplified77.3%
Taylor expanded in c around 0 77.3%
*-commutative77.3%
unpow277.3%
associate-*r*89.1%
Simplified89.1%
if 3.58000000000000006e152 < x < 4.89999999999999997e213Initial program 75.1%
associate-*r*75.2%
*-commutative75.2%
*-commutative75.2%
associate-*r*69.0%
*-commutative69.0%
unpow269.0%
unpow269.0%
Simplified69.0%
if 4.89999999999999997e213 < x Initial program 77.7%
associate-/r*70.0%
unpow270.0%
*-commutative70.0%
unpow270.0%
Simplified70.0%
associate-*r*50.3%
pow250.3%
pow250.3%
pow-prod-down70.4%
Applied egg-rr70.4%
div-inv70.2%
*-commutative70.2%
frac-times77.8%
pow277.8%
*-commutative77.8%
unpow-prod-down99.8%
*-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
pow299.8%
frac-times99.8%
*-commutative99.8%
associate-*l/99.4%
associate-*r*99.7%
*-commutative99.7%
*-commutative99.7%
Applied egg-rr100.0%
Taylor expanded in x around 0 64.6%
frac-times64.6%
*-un-lft-identity64.6%
associate-*r*64.6%
*-commutative64.6%
associate-*r*64.6%
inv-pow64.6%
*-commutative64.6%
associate-*r*64.6%
*-commutative64.6%
associate-*r*64.6%
pow164.6%
pow-div64.6%
metadata-eval64.6%
metadata-eval64.6%
pow-prod-up64.6%
inv-pow64.6%
inv-pow64.6%
associate-/r*64.6%
frac-times64.6%
*-un-lft-identity64.6%
Applied egg-rr64.6%
Final simplification80.6%
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (cos (* x 2.0))))
(if (<= x 9.6e-9)
(pow (* c (* x s)) -2.0)
(if (<= x 3.58e+152)
(/ t_0 (* s (* (* x x) (* c (* c s)))))
(/ t_0 (* x (* (* x (* c c)) (* s s))))))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = cos((x * 2.0));
double tmp;
if (x <= 9.6e-9) {
tmp = pow((c * (x * s)), -2.0);
} else if (x <= 3.58e+152) {
tmp = t_0 / (s * ((x * x) * (c * (c * s))));
} else {
tmp = t_0 / (x * ((x * (c * c)) * (s * s)));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 <= 9.6d-9) then
tmp = (c * (x * s)) ** (-2.0d0)
else if (x <= 3.58d+152) then
tmp = t_0 / (s * ((x * x) * (c * (c * s))))
else
tmp = t_0 / (x * ((x * (c * c)) * (s * s)))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = Math.cos((x * 2.0));
double tmp;
if (x <= 9.6e-9) {
tmp = Math.pow((c * (x * s)), -2.0);
} else if (x <= 3.58e+152) {
tmp = t_0 / (s * ((x * x) * (c * (c * s))));
} else {
tmp = t_0 / (x * ((x * (c * c)) * (s * s)));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = math.cos((x * 2.0)) tmp = 0 if x <= 9.6e-9: tmp = math.pow((c * (x * s)), -2.0) elif x <= 3.58e+152: tmp = t_0 / (s * ((x * x) * (c * (c * s)))) else: tmp = t_0 / (x * ((x * (c * c)) * (s * s))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = cos(Float64(x * 2.0)) tmp = 0.0 if (x <= 9.6e-9) tmp = Float64(c * Float64(x * s)) ^ -2.0; elseif (x <= 3.58e+152) tmp = Float64(t_0 / Float64(s * Float64(Float64(x * x) * Float64(c * Float64(c * s))))); else tmp = Float64(t_0 / Float64(x * Float64(Float64(x * Float64(c * c)) * Float64(s * s)))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = cos((x * 2.0));
tmp = 0.0;
if (x <= 9.6e-9)
tmp = (c * (x * s)) ^ -2.0;
elseif (x <= 3.58e+152)
tmp = t_0 / (s * ((x * x) * (c * (c * s))));
else
tmp = t_0 / (x * ((x * (c * c)) * (s * s)));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 9.6e-9], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], If[LessEqual[x, 3.58e+152], N[(t$95$0 / N[(s * N[(N[(x * x), $MachinePrecision] * N[(c * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(x * N[(N[(x * N[(c * c), $MachinePrecision]), $MachinePrecision] * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := \cos \left(x \cdot 2\right)\\
\mathbf{if}\;x \leq 9.6 \cdot 10^{-9}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{elif}\;x \leq 3.58 \cdot 10^{+152}:\\
\;\;\;\;\frac{t_0}{s \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{x \cdot \left(\left(x \cdot \left(c \cdot c\right)\right) \cdot \left(s \cdot s\right)\right)}\\
\end{array}
\end{array}
if x < 9.5999999999999999e-9Initial program 62.0%
associate-*r*62.7%
*-commutative62.7%
*-commutative62.7%
associate-*r*61.3%
*-commutative61.3%
unpow261.3%
unpow261.3%
Simplified61.3%
*-un-lft-identity61.3%
associate-*r*62.7%
*-commutative62.7%
add-sqr-sqrt62.6%
times-frac62.6%
Applied egg-rr96.7%
Taylor expanded in x around 0 51.7%
Simplified81.3%
if 9.5999999999999999e-9 < x < 3.58000000000000006e152Initial program 71.2%
*-commutative71.2%
associate-*l*71.2%
associate-*r*71.9%
*-commutative71.9%
unpow271.9%
associate-*r*73.7%
associate-*r*77.3%
*-commutative77.3%
unpow277.3%
Simplified77.3%
Taylor expanded in c around 0 77.3%
*-commutative77.3%
unpow277.3%
associate-*r*89.1%
Simplified89.1%
if 3.58000000000000006e152 < x Initial program 76.1%
associate-*r*75.9%
*-commutative75.9%
associate-*r*75.8%
unpow275.8%
unpow275.8%
Simplified75.8%
Final simplification81.5%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (if (<= x 9.5e-9) (pow (* c (* x s)) -2.0) (/ (cos (* x 2.0)) (* s (* (* x x) (* c (* c s)))))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 9.5e-9) {
tmp = pow((c * (x * s)), -2.0);
} else {
tmp = cos((x * 2.0)) / (s * ((x * x) * (c * (c * s))));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 <= 9.5d-9) then
tmp = (c * (x * s)) ** (-2.0d0)
else
tmp = cos((x * 2.0d0)) / (s * ((x * x) * (c * (c * s))))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (x <= 9.5e-9) {
tmp = Math.pow((c * (x * s)), -2.0);
} else {
tmp = Math.cos((x * 2.0)) / (s * ((x * x) * (c * (c * s))));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if x <= 9.5e-9: tmp = math.pow((c * (x * s)), -2.0) else: tmp = math.cos((x * 2.0)) / (s * ((x * x) * (c * (c * s)))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (x <= 9.5e-9) tmp = Float64(c * Float64(x * s)) ^ -2.0; else tmp = Float64(cos(Float64(x * 2.0)) / Float64(s * Float64(Float64(x * x) * Float64(c * Float64(c * s))))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (x <= 9.5e-9)
tmp = (c * (x * s)) ^ -2.0;
else
tmp = cos((x * 2.0)) / (s * ((x * x) * (c * (c * s))));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[x, 9.5e-9], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s * N[(N[(x * x), $MachinePrecision] * N[(c * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.5 \cdot 10^{-9}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot \left(c \cdot s\right)\right)\right)}\\
\end{array}
\end{array}
if x < 9.5000000000000007e-9Initial program 62.0%
associate-*r*62.7%
*-commutative62.7%
*-commutative62.7%
associate-*r*61.3%
*-commutative61.3%
unpow261.3%
unpow261.3%
Simplified61.3%
*-un-lft-identity61.3%
associate-*r*62.7%
*-commutative62.7%
add-sqr-sqrt62.6%
times-frac62.6%
Applied egg-rr96.7%
Taylor expanded in x around 0 51.7%
Simplified81.3%
if 9.5000000000000007e-9 < x Initial program 73.7%
*-commutative73.7%
associate-*l*62.7%
associate-*r*62.8%
*-commutative62.8%
unpow262.8%
associate-*r*64.2%
associate-*r*66.0%
*-commutative66.0%
unpow266.0%
Simplified66.0%
Taylor expanded in c around 0 66.0%
*-commutative66.0%
unpow266.0%
associate-*r*75.7%
Simplified75.7%
Final simplification80.2%
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* c (* x s))))
(if (<= x 2.55e-89)
(* (/ 1.0 c) (/ (/ 1.0 t_0) (* x s)))
(/ (cos (* x 2.0)) (* t_0 (* s (* x c)))))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 2.55e-89) {
tmp = (1.0 / c) * ((1.0 / t_0) / (x * s));
} else {
tmp = cos((x * 2.0)) / (t_0 * (s * (x * c)));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 = c * (x * s)
if (x <= 2.55d-89) then
tmp = (1.0d0 / c) * ((1.0d0 / t_0) / (x * s))
else
tmp = cos((x * 2.0d0)) / (t_0 * (s * (x * c)))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = c * (x * s);
double tmp;
if (x <= 2.55e-89) {
tmp = (1.0 / c) * ((1.0 / t_0) / (x * s));
} else {
tmp = Math.cos((x * 2.0)) / (t_0 * (s * (x * c)));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = c * (x * s) tmp = 0 if x <= 2.55e-89: tmp = (1.0 / c) * ((1.0 / t_0) / (x * s)) else: tmp = math.cos((x * 2.0)) / (t_0 * (s * (x * c))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(c * Float64(x * s)) tmp = 0.0 if (x <= 2.55e-89) tmp = Float64(Float64(1.0 / c) * Float64(Float64(1.0 / t_0) / Float64(x * s))); else tmp = Float64(cos(Float64(x * 2.0)) / Float64(t_0 * Float64(s * Float64(x * c)))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = c * (x * s);
tmp = 0.0;
if (x <= 2.55e-89)
tmp = (1.0 / c) * ((1.0 / t_0) / (x * s));
else
tmp = cos((x * 2.0)) / (t_0 * (s * (x * c)));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.55e-89], N[(N[(1.0 / c), $MachinePrecision] * N[(N[(1.0 / t$95$0), $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\mathbf{if}\;x \leq 2.55 \cdot 10^{-89}:\\
\;\;\;\;\frac{1}{c} \cdot \frac{\frac{1}{t_0}}{x \cdot s}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{t_0 \cdot \left(s \cdot \left(x \cdot c\right)\right)}\\
\end{array}
\end{array}
if x < 2.55000000000000002e-89Initial program 61.0%
associate-/r*61.0%
unpow261.0%
*-commutative61.0%
unpow261.0%
Simplified61.0%
associate-*r*55.9%
pow255.9%
pow255.9%
pow-prod-down76.3%
Applied egg-rr76.3%
div-inv75.8%
*-commutative75.8%
frac-times76.5%
pow276.5%
*-commutative76.5%
unpow-prod-down97.0%
*-commutative97.0%
*-commutative97.0%
associate-*r*95.9%
pow295.9%
frac-times96.4%
*-commutative96.4%
associate-*l/96.4%
associate-*r*94.1%
*-commutative94.1%
*-commutative94.1%
Applied egg-rr89.1%
Taylor expanded in x around 0 76.4%
if 2.55000000000000002e-89 < x Initial program 72.8%
*-commutative72.8%
associate-*r*64.9%
associate-*r*65.0%
unpow265.0%
unswap-sqr77.3%
unpow277.3%
swap-sqr95.2%
*-commutative95.2%
*-commutative95.2%
*-commutative95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in s around 0 93.9%
Final simplification81.2%
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
:precision binary64
(let* ((t_0 (* s (* x c))))
(if (<= x 2.45e-82)
(* (/ 1.0 c) (/ (/ 1.0 (* c (* x s))) (* x s)))
(/ (cos (* x 2.0)) (* t_0 t_0)))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = s * (x * c);
double tmp;
if (x <= 2.45e-82) {
tmp = (1.0 / c) * ((1.0 / (c * (x * s))) / (x * s));
} else {
tmp = cos((x * 2.0)) / (t_0 * t_0);
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 = s * (x * c)
if (x <= 2.45d-82) then
tmp = (1.0d0 / c) * ((1.0d0 / (c * (x * s))) / (x * s))
else
tmp = cos((x * 2.0d0)) / (t_0 * t_0)
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = s * (x * c);
double tmp;
if (x <= 2.45e-82) {
tmp = (1.0 / c) * ((1.0 / (c * (x * s))) / (x * s));
} else {
tmp = Math.cos((x * 2.0)) / (t_0 * t_0);
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = s * (x * c) tmp = 0 if x <= 2.45e-82: tmp = (1.0 / c) * ((1.0 / (c * (x * s))) / (x * s)) else: tmp = math.cos((x * 2.0)) / (t_0 * t_0) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(s * Float64(x * c)) tmp = 0.0 if (x <= 2.45e-82) tmp = Float64(Float64(1.0 / c) * Float64(Float64(1.0 / Float64(c * Float64(x * s))) / Float64(x * s))); else tmp = Float64(cos(Float64(x * 2.0)) / Float64(t_0 * t_0)); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = s * (x * c);
tmp = 0.0;
if (x <= 2.45e-82)
tmp = (1.0 / c) * ((1.0 / (c * (x * s))) / (x * s));
else
tmp = cos((x * 2.0)) / (t_0 * t_0);
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.45e-82], N[(N[(1.0 / c), $MachinePrecision] * N[(N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := s \cdot \left(x \cdot c\right)\\
\mathbf{if}\;x \leq 2.45 \cdot 10^{-82}:\\
\;\;\;\;\frac{1}{c} \cdot \frac{\frac{1}{c \cdot \left(x \cdot s\right)}}{x \cdot s}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{t_0 \cdot t_0}\\
\end{array}
\end{array}
if x < 2.4500000000000001e-82Initial program 61.6%
associate-/r*61.6%
unpow261.6%
*-commutative61.6%
unpow261.6%
Simplified61.6%
associate-*r*56.6%
pow256.6%
pow256.6%
pow-prod-down76.7%
Applied egg-rr76.7%
div-inv76.2%
*-commutative76.2%
frac-times76.9%
pow276.9%
*-commutative76.9%
unpow-prod-down97.0%
*-commutative97.0%
*-commutative97.0%
associate-*r*96.0%
pow296.0%
frac-times96.4%
*-commutative96.4%
associate-*l/96.4%
associate-*r*94.2%
*-commutative94.2%
*-commutative94.2%
Applied egg-rr89.3%
Taylor expanded in x around 0 76.7%
if 2.4500000000000001e-82 < x Initial program 71.6%
*-commutative71.6%
associate-*r*63.4%
associate-*r*63.5%
unpow263.5%
unswap-sqr76.3%
unpow276.3%
swap-sqr95.0%
*-commutative95.0%
*-commutative95.0%
*-commutative95.0%
*-commutative95.0%
Simplified95.0%
Final simplification81.6%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (if (<= s 2.7e-78) (/ (- 0.5 (* x x)) (/ (pow (* s (* x c)) 2.0) 2.0)) (/ 1.0 (pow (* c (* x s)) 2.0))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (s <= 2.7e-78) {
tmp = (0.5 - (x * x)) / (pow((s * (x * c)), 2.0) / 2.0);
} else {
tmp = 1.0 / pow((c * (x * s)), 2.0);
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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.7d-78) then
tmp = (0.5d0 - (x * x)) / (((s * (x * c)) ** 2.0d0) / 2.0d0)
else
tmp = 1.0d0 / ((c * (x * s)) ** 2.0d0)
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (s <= 2.7e-78) {
tmp = (0.5 - (x * x)) / (Math.pow((s * (x * c)), 2.0) / 2.0);
} else {
tmp = 1.0 / Math.pow((c * (x * s)), 2.0);
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if s <= 2.7e-78: tmp = (0.5 - (x * x)) / (math.pow((s * (x * c)), 2.0) / 2.0) else: tmp = 1.0 / math.pow((c * (x * s)), 2.0) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (s <= 2.7e-78) tmp = Float64(Float64(0.5 - Float64(x * x)) / Float64((Float64(s * Float64(x * c)) ^ 2.0) / 2.0)); else tmp = Float64(1.0 / (Float64(c * Float64(x * s)) ^ 2.0)); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (s <= 2.7e-78)
tmp = (0.5 - (x * x)) / (((s * (x * c)) ^ 2.0) / 2.0);
else
tmp = 1.0 / ((c * (x * s)) ^ 2.0);
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[s, 2.7e-78], N[(N[(0.5 - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;s \leq 2.7 \cdot 10^{-78}:\\
\;\;\;\;\frac{0.5 - x \cdot x}{\frac{{\left(s \cdot \left(x \cdot c\right)\right)}^{2}}{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\
\end{array}
\end{array}
if s < 2.69999999999999994e-78Initial program 65.0%
*-commutative65.0%
associate-*r*58.4%
associate-*r*58.4%
unpow258.4%
unswap-sqr74.2%
unpow274.2%
swap-sqr96.9%
*-commutative96.9%
*-commutative96.9%
*-commutative96.9%
*-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 29.1%
unpow229.1%
unpow229.1%
associate-*r*27.8%
*-commutative27.8%
unpow227.8%
associate-*r/27.8%
metadata-eval27.8%
unpow227.8%
unpow227.8%
Simplified27.8%
associate-/r*27.8%
clear-num27.8%
frac-sub12.2%
unswap-sqr12.2%
*-commutative12.2%
*-commutative12.2%
pow212.2%
unswap-sqr15.5%
*-commutative15.5%
*-commutative15.5%
pow215.5%
Applied egg-rr29.2%
associate-*r/29.2%
lft-mult-inverse55.4%
metadata-eval55.4%
*-rgt-identity55.4%
associate-*r/55.4%
unpow255.4%
swap-sqr66.3%
unpow266.3%
associate-*r*66.3%
*-commutative66.3%
associate-*r*67.3%
Simplified67.3%
if 2.69999999999999994e-78 < s Initial program 62.2%
*-commutative62.2%
associate-*r*58.3%
associate-*r*59.6%
unpow259.6%
unswap-sqr73.9%
unpow273.9%
swap-sqr98.4%
*-commutative98.4%
*-commutative98.4%
*-commutative98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in x around 0 55.3%
unpow255.3%
unpow255.3%
*-commutative55.3%
associate-*r*55.5%
*-commutative55.5%
unpow255.5%
swap-sqr64.0%
unpow264.0%
associate-*r*68.9%
*-commutative68.9%
*-commutative68.9%
associate-*r*64.0%
unpow264.0%
swap-sqr81.9%
unpow281.9%
associate-*r*80.5%
*-commutative80.5%
*-commutative80.5%
*-commutative80.5%
Simplified80.5%
Final simplification70.8%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ 1.0 (pow (* c (* x s)) 2.0)))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / pow((c * (x * s)), 2.0);
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / Math.pow((c * (x * s)), 2.0);
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return 1.0 / math.pow((c * (x * s)), 2.0)
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / (Float64(c * Float64(x * s)) ^ 2.0)) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / ((c * (x * s)) ^ 2.0);
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(1.0 / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}
\end{array}
Initial program 64.3%
*-commutative64.3%
associate-*r*58.4%
associate-*r*58.7%
unpow258.7%
unswap-sqr74.1%
unpow274.1%
swap-sqr97.3%
*-commutative97.3%
*-commutative97.3%
*-commutative97.3%
*-commutative97.3%
Simplified97.3%
Taylor expanded in x around 0 53.1%
unpow253.1%
unpow253.1%
*-commutative53.1%
associate-*r*53.5%
*-commutative53.5%
unpow253.5%
swap-sqr64.8%
unpow264.8%
associate-*r*72.2%
*-commutative72.2%
*-commutative72.2%
associate-*r*64.8%
unpow264.8%
swap-sqr79.6%
unpow279.6%
associate-*r*78.4%
*-commutative78.4%
*-commutative78.4%
*-commutative78.4%
Simplified78.4%
Final simplification78.4%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (pow (* c (* x s)) -2.0))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return pow((c * (x * s)), -2.0);
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return Math.pow((c * (x * s)), -2.0);
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return math.pow((c * (x * s)), -2.0)
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(c * Float64(x * s)) ^ -2.0 end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = (c * (x * s)) ^ -2.0;
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}
\end{array}
Initial program 64.3%
associate-*r*64.9%
*-commutative64.9%
*-commutative64.9%
associate-*r*62.8%
*-commutative62.8%
unpow262.8%
unpow262.8%
Simplified62.8%
*-un-lft-identity62.8%
associate-*r*64.9%
*-commutative64.9%
add-sqr-sqrt64.8%
times-frac64.8%
Applied egg-rr97.2%
Taylor expanded in x around 0 53.5%
Simplified78.4%
Final simplification78.4%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (if (<= c 1.7e-27) (/ 1.0 (* (* c (* x s)) (* x (* c s)))) (/ 1.0 (* c (* (* x s) (* s (* x c)))))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (c <= 1.7e-27) {
tmp = 1.0 / ((c * (x * s)) * (x * (c * s)));
} else {
tmp = 1.0 / (c * ((x * s) * (s * (x * c))));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 (c <= 1.7d-27) then
tmp = 1.0d0 / ((c * (x * s)) * (x * (c * s)))
else
tmp = 1.0d0 / (c * ((x * s) * (s * (x * c))))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (c <= 1.7e-27) {
tmp = 1.0 / ((c * (x * s)) * (x * (c * s)));
} else {
tmp = 1.0 / (c * ((x * s) * (s * (x * c))));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if c <= 1.7e-27: tmp = 1.0 / ((c * (x * s)) * (x * (c * s))) else: tmp = 1.0 / (c * ((x * s) * (s * (x * c)))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (c <= 1.7e-27) tmp = Float64(1.0 / Float64(Float64(c * Float64(x * s)) * Float64(x * Float64(c * s)))); else tmp = Float64(1.0 / Float64(c * Float64(Float64(x * s) * Float64(s * Float64(x * c))))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (c <= 1.7e-27)
tmp = 1.0 / ((c * (x * s)) * (x * (c * s)));
else
tmp = 1.0 / (c * ((x * s) * (s * (x * c))));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[c, 1.7e-27], N[(1.0 / N[(N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision] * N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(c * N[(N[(x * s), $MachinePrecision] * N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;c \leq 1.7 \cdot 10^{-27}:\\
\;\;\;\;\frac{1}{\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{c \cdot \left(\left(x \cdot s\right) \cdot \left(s \cdot \left(x \cdot c\right)\right)\right)}\\
\end{array}
\end{array}
if c < 1.69999999999999985e-27Initial program 63.2%
*-commutative63.2%
associate-*r*56.8%
associate-*r*57.4%
unpow257.4%
unswap-sqr73.7%
unpow273.7%
swap-sqr96.9%
*-commutative96.9%
*-commutative96.9%
*-commutative96.9%
*-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 49.8%
unpow249.8%
unpow249.8%
*-commutative49.8%
associate-*r*50.4%
*-commutative50.4%
unpow250.4%
swap-sqr61.0%
unpow261.0%
associate-*r*67.0%
*-commutative67.0%
*-commutative67.0%
associate-*r*61.0%
unpow261.0%
swap-sqr76.4%
unpow276.4%
associate-*r*76.1%
*-commutative76.1%
*-commutative76.1%
*-commutative76.1%
Simplified76.1%
*-commutative76.1%
*-commutative76.1%
associate-*r*75.2%
pow275.2%
Applied egg-rr75.2%
Taylor expanded in x around 0 74.7%
if 1.69999999999999985e-27 < c Initial program 66.9%
associate-/r*66.9%
unpow266.9%
*-commutative66.9%
unpow266.9%
Simplified66.9%
associate-*r*62.1%
pow262.1%
pow262.1%
pow-prod-down79.9%
Applied egg-rr79.9%
div-inv78.9%
*-commutative78.9%
frac-times79.9%
pow279.9%
*-commutative79.9%
unpow-prod-down95.6%
*-commutative95.6%
*-commutative95.6%
associate-*r*96.7%
pow296.7%
frac-times97.0%
*-commutative97.0%
associate-*l/97.1%
associate-*r*93.4%
*-commutative93.4%
*-commutative93.4%
Applied egg-rr89.7%
Taylor expanded in x around 0 79.9%
*-commutative79.9%
associate-/l/79.9%
frac-times80.0%
metadata-eval80.0%
*-commutative80.0%
associate-*r*77.6%
*-commutative77.6%
associate-*r*80.0%
Applied egg-rr80.0%
Final simplification76.3%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (* (/ 1.0 c) (/ (/ 1.0 (* c (* x s))) (* x s))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return (1.0 / c) * ((1.0 / (c * (x * s))) / (x * s));
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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) * ((1.0d0 / (c * (x * s))) / (x * s))
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return (1.0 / c) * ((1.0 / (c * (x * s))) / (x * s));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return (1.0 / c) * ((1.0 / (c * (x * s))) / (x * s))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(1.0 / c) * Float64(Float64(1.0 / Float64(c * Float64(x * s))) / Float64(x * s))) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = (1.0 / c) * ((1.0 / (c * (x * s))) / (x * s));
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(N[(1.0 / c), $MachinePrecision] * N[(N[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{c} \cdot \frac{\frac{1}{c \cdot \left(x \cdot s\right)}}{x \cdot s}
\end{array}
Initial program 64.3%
associate-/r*64.2%
unpow264.2%
*-commutative64.2%
unpow264.2%
Simplified64.2%
associate-*r*58.6%
pow258.6%
pow258.6%
pow-prod-down76.5%
Applied egg-rr76.5%
div-inv76.1%
*-commutative76.1%
frac-times76.7%
pow276.7%
*-commutative76.7%
unpow-prod-down96.8%
*-commutative96.8%
*-commutative96.8%
associate-*r*96.4%
pow296.4%
frac-times97.2%
*-commutative97.2%
associate-*l/97.3%
associate-*r*95.3%
*-commutative95.3%
*-commutative95.3%
Applied egg-rr90.5%
Taylor expanded in x around 0 76.0%
Final simplification76.0%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ 1.0 (* (* s s) (* (* x x) (* c c)))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / ((s * s) * ((x * x) * (c * c)));
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 / ((s * s) * ((x * x) * (c * c)))
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / ((s * s) * ((x * x) * (c * c)));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return 1.0 / ((s * s) * ((x * x) * (c * c)))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(Float64(s * s) * Float64(Float64(x * x) * Float64(c * c)))) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / ((s * s) * ((x * x) * (c * c)));
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(1.0 / N[(N[(s * s), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{\left(s \cdot s\right) \cdot \left(\left(x \cdot x\right) \cdot \left(c \cdot c\right)\right)}
\end{array}
Initial program 64.3%
associate-*r*64.9%
*-commutative64.9%
*-commutative64.9%
associate-*r*62.8%
*-commutative62.8%
unpow262.8%
unpow262.8%
Simplified62.8%
*-un-lft-identity62.8%
associate-*r*64.9%
*-commutative64.9%
add-sqr-sqrt64.8%
times-frac64.8%
Applied egg-rr97.2%
associate-*l/97.3%
*-un-lft-identity97.3%
Applied egg-rr97.3%
Taylor expanded in x around 0 95.3%
associate-*r*97.3%
*-commutative97.3%
associate-*r*96.0%
Simplified96.0%
Taylor expanded in x around 0 53.5%
unpow253.5%
unpow253.5%
unpow253.5%
Simplified53.5%
Final simplification53.5%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ 1.0 (* (* c (* x s)) (* x (* c s)))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return 1.0 / ((c * (x * s)) * (x * (c * s)));
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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 * (c * s)))
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return 1.0 / ((c * (x * s)) * (x * (c * s)));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return 1.0 / ((c * (x * s)) * (x * (c * s)))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(1.0 / Float64(Float64(c * Float64(x * s)) * Float64(x * Float64(c * s)))) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = 1.0 / ((c * (x * s)) * (x * (c * s)));
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(1.0 / N[(N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision] * N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(x \cdot \left(c \cdot s\right)\right)}
\end{array}
Initial program 64.3%
*-commutative64.3%
associate-*r*58.4%
associate-*r*58.7%
unpow258.7%
unswap-sqr74.1%
unpow274.1%
swap-sqr97.3%
*-commutative97.3%
*-commutative97.3%
*-commutative97.3%
*-commutative97.3%
Simplified97.3%
Taylor expanded in x around 0 53.1%
unpow253.1%
unpow253.1%
*-commutative53.1%
associate-*r*53.5%
*-commutative53.5%
unpow253.5%
swap-sqr64.8%
unpow264.8%
associate-*r*72.2%
*-commutative72.2%
*-commutative72.2%
associate-*r*64.8%
unpow264.8%
swap-sqr79.6%
unpow279.6%
associate-*r*78.4%
*-commutative78.4%
*-commutative78.4%
*-commutative78.4%
Simplified78.4%
*-commutative78.4%
*-commutative78.4%
associate-*r*78.1%
pow278.1%
Applied egg-rr78.1%
Taylor expanded in x around 0 76.6%
Final simplification76.6%
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. (FPCore (x c s) :precision binary64 (/ -2.0 (* (* c c) (* s s))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return -2.0 / ((c * c) * (s * s));
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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) / ((c * c) * (s * s))
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
return -2.0 / ((c * c) * (s * s));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return -2.0 / ((c * c) * (s * s))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(-2.0 / Float64(Float64(c * c) * Float64(s * s))) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
tmp = -2.0 / ((c * c) * (s * s));
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := N[(-2.0 / N[(N[(c * c), $MachinePrecision] * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{-2}{\left(c \cdot c\right) \cdot \left(s \cdot s\right)}
\end{array}
Initial program 64.3%
*-commutative64.3%
associate-*r*58.4%
associate-*r*58.7%
unpow258.7%
unswap-sqr74.1%
unpow274.1%
swap-sqr97.3%
*-commutative97.3%
*-commutative97.3%
*-commutative97.3%
*-commutative97.3%
Simplified97.3%
Taylor expanded in x around 0 32.2%
unpow232.2%
unpow232.2%
associate-*r*31.3%
*-commutative31.3%
unpow231.3%
associate-*r/31.3%
metadata-eval31.3%
unpow231.3%
unpow231.3%
Simplified31.3%
Taylor expanded in x around inf 25.0%
unpow225.0%
*-commutative25.0%
unpow225.0%
Simplified25.0%
Final simplification25.0%
herbie shell --seed 2023240
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))