
(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}
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 7.6e-84) (pow (* c (* x s)) -2.0) (* (cos (* x 2.0)) (* (pow (* s (* x c)) -1.0) (/ (/ (/ 1.0 x) 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 <= 7.6e-84) {
tmp = pow((c * (x * s)), -2.0);
} else {
tmp = cos((x * 2.0)) * (pow((s * (x * c)), -1.0) * (((1.0 / x) / 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 <= 7.6d-84) then
tmp = (c * (x * s)) ** (-2.0d0)
else
tmp = cos((x * 2.0d0)) * (((s * (x * c)) ** (-1.0d0)) * (((1.0d0 / x) / 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 <= 7.6e-84) {
tmp = Math.pow((c * (x * s)), -2.0);
} else {
tmp = Math.cos((x * 2.0)) * (Math.pow((s * (x * c)), -1.0) * (((1.0 / x) / 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 <= 7.6e-84: tmp = math.pow((c * (x * s)), -2.0) else: tmp = math.cos((x * 2.0)) * (math.pow((s * (x * c)), -1.0) * (((1.0 / x) / 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 <= 7.6e-84) tmp = Float64(c * Float64(x * s)) ^ -2.0; else tmp = Float64(cos(Float64(x * 2.0)) * Float64((Float64(s * Float64(x * c)) ^ -1.0) * Float64(Float64(Float64(1.0 / x) / 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 <= 7.6e-84)
tmp = (c * (x * s)) ^ -2.0;
else
tmp = cos((x * 2.0)) * (((s * (x * c)) ^ -1.0) * (((1.0 / x) / 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, 7.6e-84], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * N[(N[(N[(1.0 / x), $MachinePrecision] / c), $MachinePrecision] / s), $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 7.6 \cdot 10^{-84}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(x \cdot 2\right) \cdot \left({\left(s \cdot \left(x \cdot c\right)\right)}^{-1} \cdot \frac{\frac{\frac{1}{x}}{c}}{s}\right)\\
\end{array}
\end{array}
if x < 7.59999999999999971e-84Initial program 64.6%
*-commutative64.6%
associate-*r*59.1%
associate-*r*60.1%
unpow260.1%
unswap-sqr74.8%
unpow274.8%
swap-sqr96.9%
*-commutative96.9%
*-commutative96.9%
*-commutative96.9%
*-commutative96.9%
Simplified96.9%
div-inv96.8%
*-commutative96.8%
pow296.8%
pow-flip97.4%
metadata-eval97.4%
Applied egg-rr97.4%
Taylor expanded in x around 0 84.9%
Taylor expanded in s around 0 84.0%
if 7.59999999999999971e-84 < x Initial program 67.0%
*-commutative67.0%
associate-*r*59.4%
associate-*r*60.7%
unpow260.7%
unswap-sqr75.1%
unpow275.1%
swap-sqr95.8%
*-commutative95.8%
*-commutative95.8%
*-commutative95.8%
*-commutative95.8%
Simplified95.8%
div-inv95.8%
*-commutative95.8%
pow295.8%
pow-flip96.6%
metadata-eval96.6%
Applied egg-rr96.6%
metadata-eval96.6%
pow-prod-up96.7%
Applied egg-rr96.7%
Taylor expanded in s around 0 96.7%
*-commutative96.7%
*-commutative96.7%
associate-/r*96.7%
associate-/r*96.7%
Simplified96.7%
Final simplification87.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
(let* ((t_0 (* s (* x c))))
(if (<= x 1.05e-82)
(pow (* c (* x s)) -2.0)
(* (cos (* x 2.0)) (/ (/ 1.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 <= 1.05e-82) {
tmp = pow((c * (x * s)), -2.0);
} else {
tmp = cos((x * 2.0)) * ((1.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 <= 1.05d-82) then
tmp = (c * (x * s)) ** (-2.0d0)
else
tmp = cos((x * 2.0d0)) * ((1.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 <= 1.05e-82) {
tmp = Math.pow((c * (x * s)), -2.0);
} else {
tmp = Math.cos((x * 2.0)) * ((1.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 <= 1.05e-82: tmp = math.pow((c * (x * s)), -2.0) else: tmp = math.cos((x * 2.0)) * ((1.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 <= 1.05e-82) tmp = Float64(c * Float64(x * s)) ^ -2.0; else tmp = Float64(cos(Float64(x * 2.0)) * Float64(Float64(1.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 <= 1.05e-82)
tmp = (c * (x * s)) ^ -2.0;
else
tmp = cos((x * 2.0)) * ((1.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, 1.05e-82], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 / t$95$0), $MachinePrecision] / 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 1.05 \cdot 10^{-82}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(x \cdot 2\right) \cdot \frac{\frac{1}{t_0}}{t_0}\\
\end{array}
\end{array}
if x < 1.05e-82Initial program 64.6%
*-commutative64.6%
associate-*r*59.1%
associate-*r*60.1%
unpow260.1%
unswap-sqr74.8%
unpow274.8%
swap-sqr96.9%
*-commutative96.9%
*-commutative96.9%
*-commutative96.9%
*-commutative96.9%
Simplified96.9%
div-inv96.8%
*-commutative96.8%
pow296.8%
pow-flip97.4%
metadata-eval97.4%
Applied egg-rr97.4%
Taylor expanded in x around 0 84.9%
Taylor expanded in s around 0 84.0%
if 1.05e-82 < x Initial program 67.0%
*-commutative67.0%
associate-*r*59.4%
associate-*r*60.7%
unpow260.7%
unswap-sqr75.1%
unpow275.1%
swap-sqr95.8%
*-commutative95.8%
*-commutative95.8%
*-commutative95.8%
*-commutative95.8%
Simplified95.8%
div-inv95.8%
*-commutative95.8%
pow295.8%
pow-flip96.6%
metadata-eval96.6%
Applied egg-rr96.6%
metadata-eval96.6%
pow-prod-up96.7%
Applied egg-rr96.7%
unpow-196.7%
*-commutative96.7%
un-div-inv96.7%
unpow-196.7%
*-commutative96.7%
Applied egg-rr96.7%
Final simplification87.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 (if (<= x 3.2e-26) (pow (* c (* x s)) -2.0) (/ (cos (* x 2.0)) (* s (* s (* x (* c (* 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 (x <= 3.2e-26) {
tmp = pow((c * (x * s)), -2.0);
} else {
tmp = cos((x * 2.0)) / (s * (s * (x * (c * (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 (x <= 3.2d-26) then
tmp = (c * (x * s)) ** (-2.0d0)
else
tmp = cos((x * 2.0d0)) / (s * (s * (x * (c * (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 (x <= 3.2e-26) {
tmp = Math.pow((c * (x * s)), -2.0);
} else {
tmp = Math.cos((x * 2.0)) / (s * (s * (x * (c * (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 x <= 3.2e-26: tmp = math.pow((c * (x * s)), -2.0) else: tmp = math.cos((x * 2.0)) / (s * (s * (x * (c * (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 (x <= 3.2e-26) tmp = Float64(c * Float64(x * s)) ^ -2.0; else tmp = Float64(cos(Float64(x * 2.0)) / Float64(s * Float64(s * Float64(x * Float64(c * 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 (x <= 3.2e-26)
tmp = (c * (x * s)) ^ -2.0;
else
tmp = cos((x * 2.0)) / (s * (s * (x * (c * (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[x, 3.2e-26], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s * N[(s * N[(x * N[(c * N[(x * c), $MachinePrecision]), $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 3.2 \cdot 10^{-26}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{s \cdot \left(s \cdot \left(x \cdot \left(c \cdot \left(x \cdot c\right)\right)\right)\right)}\\
\end{array}
\end{array}
if x < 3.2000000000000001e-26Initial program 64.8%
*-commutative64.8%
associate-*r*59.5%
associate-*r*60.5%
unpow260.5%
unswap-sqr75.2%
unpow275.2%
swap-sqr97.0%
*-commutative97.0%
*-commutative97.0%
*-commutative97.0%
*-commutative97.0%
Simplified97.0%
div-inv97.0%
*-commutative97.0%
pow297.0%
pow-flip97.5%
metadata-eval97.5%
Applied egg-rr97.5%
Taylor expanded in x around 0 85.5%
Taylor expanded in s around 0 84.6%
if 3.2000000000000001e-26 < x Initial program 66.5%
*-commutative66.5%
associate-*l*58.0%
associate-*r*59.4%
*-commutative59.4%
unpow259.4%
associate-*r*66.5%
associate-*r*66.6%
*-commutative66.6%
unpow266.6%
Simplified66.6%
Taylor expanded in x around 0 66.6%
*-commutative55.6%
unpow255.6%
associate-*r*58.0%
unpow258.0%
associate-*r*58.6%
*-commutative58.6%
Simplified81.0%
Final simplification83.7%
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 1.3e-83)
(pow t_0 -2.0)
(/ (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 <= 1.3e-83) {
tmp = pow(t_0, -2.0);
} 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 <= 1.3d-83) then
tmp = t_0 ** (-2.0d0)
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 <= 1.3e-83) {
tmp = Math.pow(t_0, -2.0);
} 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 <= 1.3e-83: tmp = math.pow(t_0, -2.0) 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 <= 1.3e-83) tmp = t_0 ^ -2.0; 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 <= 1.3e-83)
tmp = t_0 ^ -2.0;
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, 1.3e-83], N[Power[t$95$0, -2.0], $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 1.3 \cdot 10^{-83}:\\
\;\;\;\;{t_0}^{-2}\\
\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 < 1.30000000000000004e-83Initial program 64.6%
*-commutative64.6%
associate-*r*59.1%
associate-*r*60.1%
unpow260.1%
unswap-sqr74.8%
unpow274.8%
swap-sqr96.9%
*-commutative96.9%
*-commutative96.9%
*-commutative96.9%
*-commutative96.9%
Simplified96.9%
div-inv96.8%
*-commutative96.8%
pow296.8%
pow-flip97.4%
metadata-eval97.4%
Applied egg-rr97.4%
Taylor expanded in x around 0 84.9%
Taylor expanded in s around 0 84.0%
if 1.30000000000000004e-83 < x Initial program 67.0%
*-commutative67.0%
associate-*r*59.4%
associate-*r*60.7%
unpow260.7%
unswap-sqr75.1%
unpow275.1%
swap-sqr95.8%
*-commutative95.8%
*-commutative95.8%
*-commutative95.8%
*-commutative95.8%
Simplified95.8%
Taylor expanded in s around 0 94.4%
Final simplification86.7%
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 1.15e-83)
(pow (* c (* x s)) -2.0)
(/ (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 <= 1.15e-83) {
tmp = pow((c * (x * s)), -2.0);
} 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 <= 1.15d-83) then
tmp = (c * (x * s)) ** (-2.0d0)
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 <= 1.15e-83) {
tmp = Math.pow((c * (x * s)), -2.0);
} 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 <= 1.15e-83: tmp = math.pow((c * (x * s)), -2.0) 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 <= 1.15e-83) tmp = Float64(c * Float64(x * s)) ^ -2.0; 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 <= 1.15e-83)
tmp = (c * (x * s)) ^ -2.0;
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, 1.15e-83], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $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 1.15 \cdot 10^{-83}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{t_0 \cdot t_0}\\
\end{array}
\end{array}
if x < 1.14999999999999995e-83Initial program 64.6%
*-commutative64.6%
associate-*r*59.1%
associate-*r*60.1%
unpow260.1%
unswap-sqr74.8%
unpow274.8%
swap-sqr96.9%
*-commutative96.9%
*-commutative96.9%
*-commutative96.9%
*-commutative96.9%
Simplified96.9%
div-inv96.8%
*-commutative96.8%
pow296.8%
pow-flip97.4%
metadata-eval97.4%
Applied egg-rr97.4%
Taylor expanded in x around 0 84.9%
Taylor expanded in s around 0 84.0%
if 1.14999999999999995e-83 < x Initial program 67.0%
*-commutative67.0%
associate-*r*59.4%
associate-*r*60.7%
unpow260.7%
unswap-sqr75.1%
unpow275.1%
swap-sqr95.8%
*-commutative95.8%
*-commutative95.8%
*-commutative95.8%
*-commutative95.8%
Simplified95.8%
Final simplification87.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 (if (<= x 7e-29) (pow (* c (* x s)) -2.0) (/ (/ (cos (* x 2.0)) (* (* s (* x c)) (* x 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 <= 7e-29) {
tmp = pow((c * (x * s)), -2.0);
} else {
tmp = (cos((x * 2.0)) / ((s * (x * c)) * (x * 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 <= 7d-29) then
tmp = (c * (x * s)) ** (-2.0d0)
else
tmp = (cos((x * 2.0d0)) / ((s * (x * c)) * (x * 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 <= 7e-29) {
tmp = Math.pow((c * (x * s)), -2.0);
} else {
tmp = (Math.cos((x * 2.0)) / ((s * (x * c)) * (x * 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 <= 7e-29: tmp = math.pow((c * (x * s)), -2.0) else: tmp = (math.cos((x * 2.0)) / ((s * (x * c)) * (x * 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 <= 7e-29) tmp = Float64(c * Float64(x * s)) ^ -2.0; else tmp = Float64(Float64(cos(Float64(x * 2.0)) / Float64(Float64(s * Float64(x * c)) * Float64(x * 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 <= 7e-29)
tmp = (c * (x * s)) ^ -2.0;
else
tmp = (cos((x * 2.0)) / ((s * (x * c)) * (x * 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, 7e-29], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision] * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / s), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{-29}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x \cdot 2\right)}{\left(s \cdot \left(x \cdot c\right)\right) \cdot \left(x \cdot c\right)}}{s}\\
\end{array}
\end{array}
if x < 6.9999999999999995e-29Initial program 64.8%
*-commutative64.8%
associate-*r*59.5%
associate-*r*60.5%
unpow260.5%
unswap-sqr75.2%
unpow275.2%
swap-sqr97.0%
*-commutative97.0%
*-commutative97.0%
*-commutative97.0%
*-commutative97.0%
Simplified97.0%
div-inv97.0%
*-commutative97.0%
pow297.0%
pow-flip97.5%
metadata-eval97.5%
Applied egg-rr97.5%
Taylor expanded in x around 0 85.5%
Taylor expanded in s around 0 84.6%
if 6.9999999999999995e-29 < x Initial program 66.5%
*-commutative66.5%
associate-*r*58.0%
associate-*r*59.4%
unpow259.4%
unswap-sqr73.8%
unpow273.8%
swap-sqr95.3%
*-commutative95.3%
*-commutative95.3%
*-commutative95.3%
*-commutative95.3%
Simplified95.3%
*-un-lft-identity95.3%
associate-*l*93.8%
times-frac94.8%
*-commutative94.8%
Applied egg-rr94.8%
associate-*l/94.7%
*-lft-identity94.7%
*-commutative94.7%
*-commutative94.7%
Simplified94.7%
Final simplification86.9%
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 65.2%
*-commutative65.2%
associate-*r*59.2%
associate-*r*60.2%
unpow260.2%
unswap-sqr74.9%
unpow274.9%
swap-sqr96.6%
*-commutative96.6%
*-commutative96.6%
*-commutative96.6%
*-commutative96.6%
Simplified96.6%
div-inv96.6%
*-commutative96.6%
pow296.6%
pow-flip97.2%
metadata-eval97.2%
Applied egg-rr97.2%
Taylor expanded in x around 0 79.7%
Taylor expanded in s around 0 79.1%
Final simplification79.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 (if (or (<= c 1.5e-157) (not (<= c 1.95e-25))) (/ 1.0 (* s (* s (* x (* c (* x c)))))) (/ 1.0 (* s (* (* x x) (* s (* c 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.5e-157) || !(c <= 1.95e-25)) {
tmp = 1.0 / (s * (s * (x * (c * (x * c)))));
} else {
tmp = 1.0 / (s * ((x * x) * (s * (c * 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.5d-157) .or. (.not. (c <= 1.95d-25))) then
tmp = 1.0d0 / (s * (s * (x * (c * (x * c)))))
else
tmp = 1.0d0 / (s * ((x * x) * (s * (c * 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.5e-157) || !(c <= 1.95e-25)) {
tmp = 1.0 / (s * (s * (x * (c * (x * c)))));
} else {
tmp = 1.0 / (s * ((x * x) * (s * (c * 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.5e-157) or not (c <= 1.95e-25): tmp = 1.0 / (s * (s * (x * (c * (x * c))))) else: tmp = 1.0 / (s * ((x * x) * (s * (c * 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.5e-157) || !(c <= 1.95e-25)) tmp = Float64(1.0 / Float64(s * Float64(s * Float64(x * Float64(c * Float64(x * c)))))); else tmp = Float64(1.0 / Float64(s * Float64(Float64(x * x) * Float64(s * Float64(c * 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.5e-157) || ~((c <= 1.95e-25)))
tmp = 1.0 / (s * (s * (x * (c * (x * c)))));
else
tmp = 1.0 / (s * ((x * x) * (s * (c * 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[Or[LessEqual[c, 1.5e-157], N[Not[LessEqual[c, 1.95e-25]], $MachinePrecision]], N[(1.0 / N[(s * N[(s * N[(x * N[(c * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(s * N[(N[(x * x), $MachinePrecision] * N[(s * N[(c * 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.5 \cdot 10^{-157} \lor \neg \left(c \leq 1.95 \cdot 10^{-25}\right):\\
\;\;\;\;\frac{1}{s \cdot \left(s \cdot \left(x \cdot \left(c \cdot \left(x \cdot c\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{s \cdot \left(\left(x \cdot x\right) \cdot \left(s \cdot \left(c \cdot c\right)\right)\right)}\\
\end{array}
\end{array}
if c < 1.5e-157 or 1.95e-25 < c Initial program 64.3%
*-commutative64.3%
associate-*l*58.2%
associate-*r*58.9%
*-commutative58.9%
unpow258.9%
associate-*r*66.0%
associate-*r*68.5%
*-commutative68.5%
unpow268.5%
Simplified68.5%
Taylor expanded in x around 0 63.4%
Taylor expanded in x around 0 62.6%
*-commutative62.6%
unpow262.6%
associate-*r*66.5%
unpow266.5%
associate-*r*72.2%
*-commutative72.2%
Simplified72.2%
if 1.5e-157 < c < 1.95e-25Initial program 75.9%
*-commutative75.9%
associate-*l*70.4%
associate-*r*70.4%
*-commutative70.4%
unpow270.4%
associate-*r*85.2%
associate-*r*85.2%
*-commutative85.2%
unpow285.2%
Simplified85.2%
Taylor expanded in x around 0 80.2%
Final simplification72.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 (if (<= s 3.1e+115) (/ 1.0 (* x (* (* s s) (* x (* c c))))) (/ 1.0 (* s (* s (* x (* c (* 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 (s <= 3.1e+115) {
tmp = 1.0 / (x * ((s * s) * (x * (c * c))));
} else {
tmp = 1.0 / (s * (s * (x * (c * (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 (s <= 3.1d+115) then
tmp = 1.0d0 / (x * ((s * s) * (x * (c * c))))
else
tmp = 1.0d0 / (s * (s * (x * (c * (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 (s <= 3.1e+115) {
tmp = 1.0 / (x * ((s * s) * (x * (c * c))));
} else {
tmp = 1.0 / (s * (s * (x * (c * (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 s <= 3.1e+115: tmp = 1.0 / (x * ((s * s) * (x * (c * c)))) else: tmp = 1.0 / (s * (s * (x * (c * (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 (s <= 3.1e+115) tmp = Float64(1.0 / Float64(x * Float64(Float64(s * s) * Float64(x * Float64(c * c))))); else tmp = Float64(1.0 / Float64(s * Float64(s * Float64(x * Float64(c * 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 (s <= 3.1e+115)
tmp = 1.0 / (x * ((s * s) * (x * (c * c))));
else
tmp = 1.0 / (s * (s * (x * (c * (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[s, 3.1e+115], N[(1.0 / N[(x * N[(N[(s * s), $MachinePrecision] * N[(x * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(s * N[(s * N[(x * N[(c * N[(x * c), $MachinePrecision]), $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}\;s \leq 3.1 \cdot 10^{+115}:\\
\;\;\;\;\frac{1}{x \cdot \left(\left(s \cdot s\right) \cdot \left(x \cdot \left(c \cdot c\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{s \cdot \left(s \cdot \left(x \cdot \left(c \cdot \left(x \cdot c\right)\right)\right)\right)}\\
\end{array}
\end{array}
if s < 3.10000000000000005e115Initial program 68.3%
associate-*r*71.5%
*-commutative71.5%
associate-*r*71.4%
unpow271.4%
unpow271.4%
Simplified71.4%
Taylor expanded in x around 0 61.6%
if 3.10000000000000005e115 < s Initial program 46.0%
*-commutative46.0%
associate-*l*42.7%
associate-*r*42.7%
*-commutative42.7%
unpow242.7%
associate-*r*62.4%
associate-*r*72.7%
*-commutative72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in x around 0 72.7%
Taylor expanded in x around 0 62.0%
*-commutative62.0%
unpow262.0%
associate-*r*67.5%
unpow267.5%
associate-*r*67.5%
*-commutative67.5%
Simplified67.5%
Final simplification62.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 (<= s 1.86e+115) (/ 1.0 (* (* c c) (* x (* x (* s s))))) (/ 1.0 (* s (* s (* x (* c (* 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 (s <= 1.86e+115) {
tmp = 1.0 / ((c * c) * (x * (x * (s * s))));
} else {
tmp = 1.0 / (s * (s * (x * (c * (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 (s <= 1.86d+115) then
tmp = 1.0d0 / ((c * c) * (x * (x * (s * s))))
else
tmp = 1.0d0 / (s * (s * (x * (c * (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 (s <= 1.86e+115) {
tmp = 1.0 / ((c * c) * (x * (x * (s * s))));
} else {
tmp = 1.0 / (s * (s * (x * (c * (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 s <= 1.86e+115: tmp = 1.0 / ((c * c) * (x * (x * (s * s)))) else: tmp = 1.0 / (s * (s * (x * (c * (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 (s <= 1.86e+115) tmp = Float64(1.0 / Float64(Float64(c * c) * Float64(x * Float64(x * Float64(s * s))))); else tmp = Float64(1.0 / Float64(s * Float64(s * Float64(x * Float64(c * 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 (s <= 1.86e+115)
tmp = 1.0 / ((c * c) * (x * (x * (s * s))));
else
tmp = 1.0 / (s * (s * (x * (c * (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[s, 1.86e+115], N[(1.0 / N[(N[(c * c), $MachinePrecision] * N[(x * N[(x * N[(s * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(s * N[(s * N[(x * N[(c * N[(x * c), $MachinePrecision]), $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}\;s \leq 1.86 \cdot 10^{+115}:\\
\;\;\;\;\frac{1}{\left(c \cdot c\right) \cdot \left(x \cdot \left(x \cdot \left(s \cdot s\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{s \cdot \left(s \cdot \left(x \cdot \left(c \cdot \left(x \cdot c\right)\right)\right)\right)}\\
\end{array}
\end{array}
if s < 1.86e115Initial program 68.3%
unpow268.3%
*-commutative68.3%
unpow268.3%
Simplified68.3%
Taylor expanded in x around 0 58.9%
if 1.86e115 < s Initial program 46.0%
*-commutative46.0%
associate-*l*42.7%
associate-*r*42.7%
*-commutative42.7%
unpow242.7%
associate-*r*62.4%
associate-*r*72.7%
*-commutative72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in x around 0 72.7%
Taylor expanded in x around 0 62.0%
*-commutative62.0%
unpow262.0%
associate-*r*67.5%
unpow267.5%
associate-*r*67.5%
*-commutative67.5%
Simplified67.5%
Final simplification60.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 (/ 1.0 (* s (* s (* x (* c (* x 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 * (c * (x * 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 * (c * (x * 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 * (c * (x * 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 * (c * (x * 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(s * Float64(s * Float64(x * Float64(c * Float64(x * 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 * (c * (x * 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[(s * N[(s * N[(x * N[(c * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{s \cdot \left(s \cdot \left(x \cdot \left(c \cdot \left(x \cdot c\right)\right)\right)\right)}
\end{array}
Initial program 65.2%
*-commutative65.2%
associate-*l*59.2%
associate-*r*59.8%
*-commutative59.8%
unpow259.8%
associate-*r*67.5%
associate-*r*69.8%
*-commutative69.8%
unpow269.8%
Simplified69.8%
Taylor expanded in x around 0 64.7%
Taylor expanded in x around 0 63.2%
*-commutative63.2%
unpow263.2%
associate-*r*67.0%
unpow267.0%
associate-*r*72.2%
*-commutative72.2%
Simplified72.2%
Final simplification72.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)))) (/ 1.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);
return 1.0 / (t_0 * t_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
real(8) :: t_0
t_0 = s * (x * c)
code = 1.0d0 / (t_0 * t_0)
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);
return 1.0 / (t_0 * t_0);
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = s * (x * c) return 1.0 / (t_0 * t_0)
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)) return Float64(1.0 / Float64(t_0 * t_0)) end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
t_0 = s * (x * c);
tmp = 1.0 / (t_0 * t_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_] := Block[{t$95$0 = N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]}, N[(1.0 / 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)\\
\frac{1}{t_0 \cdot t_0}
\end{array}
\end{array}
Initial program 65.2%
*-commutative65.2%
associate-*r*59.2%
associate-*r*60.2%
unpow260.2%
unswap-sqr74.9%
unpow274.9%
swap-sqr96.6%
*-commutative96.6%
*-commutative96.6%
*-commutative96.6%
*-commutative96.6%
Simplified96.6%
Taylor expanded in x around 0 79.5%
Final simplification79.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 (/ -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 65.2%
*-commutative65.2%
associate-*l*59.2%
associate-*r*59.8%
*-commutative59.8%
unpow259.8%
associate-*r*67.5%
associate-*r*69.8%
*-commutative69.8%
unpow269.8%
Simplified69.8%
add-sqr-sqrt69.8%
pow269.8%
*-commutative69.8%
sqrt-prod38.7%
sqrt-prod39.4%
sqrt-prod24.7%
add-sqr-sqrt43.4%
sqrt-prod44.1%
sqrt-prod25.0%
add-sqr-sqrt53.7%
Applied egg-rr53.7%
Taylor expanded in x around 0 30.0%
Simplified31.6%
Taylor expanded in x around inf 26.0%
unpow226.0%
unpow226.0%
Simplified26.0%
Final simplification26.0%
herbie shell --seed 2023200
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))