
(FPCore (x c s) :precision binary64 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
double code(double x, double c, double s) {
return cos((2.0 * x)) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = cos((2.0d0 * x)) / ((c ** 2.0d0) * ((x * (s ** 2.0d0)) * x))
end function
public static double code(double x, double c, double s) {
return Math.cos((2.0 * x)) / (Math.pow(c, 2.0) * ((x * Math.pow(s, 2.0)) * x));
}
def code(x, c, s): return math.cos((2.0 * x)) / (math.pow(c, 2.0) * ((x * math.pow(s, 2.0)) * x))
function code(x, c, s) return Float64(cos(Float64(2.0 * x)) / Float64((c ^ 2.0) * Float64(Float64(x * (s ^ 2.0)) * x))) end
function tmp = code(x, c, s) tmp = cos((2.0 * x)) / ((c ^ 2.0) * ((x * (s ^ 2.0)) * x)); end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c, 2.0], $MachinePrecision] * N[(N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x c s) :precision binary64 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
double code(double x, double c, double s) {
return cos((2.0 * x)) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
code = cos((2.0d0 * x)) / ((c ** 2.0d0) * ((x * (s ** 2.0d0)) * x))
end function
public static double code(double x, double c, double s) {
return Math.cos((2.0 * x)) / (Math.pow(c, 2.0) * ((x * Math.pow(s, 2.0)) * x));
}
def code(x, c, s): return math.cos((2.0 * x)) / (math.pow(c, 2.0) * ((x * math.pow(s, 2.0)) * x))
function code(x, c, s) return Float64(cos(Float64(2.0 * x)) / Float64((c ^ 2.0) * Float64(Float64(x * (s ^ 2.0)) * x))) end
function tmp = code(x, c, s) tmp = cos((2.0 * x)) / ((c ^ 2.0) * ((x * (s ^ 2.0)) * x)); end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c, 2.0], $MachinePrecision] * N[(N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\end{array}
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 3.15e-65)
(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 <= 3.15e-65) {
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 <= 3.15d-65) 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 <= 3.15e-65) {
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 <= 3.15e-65: 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 <= 3.15e-65) tmp = Float64(c * Float64(x * s)) ^ -2.0; 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 <= 3.15e-65)
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, 3.15e-65], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $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 3.15 \cdot 10^{-65}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x \cdot 2\right)}{t_0}}{t_0}\\
\end{array}
\end{array}
if x < 3.1499999999999998e-65Initial program 68.0%
associate-/r*68.0%
unpow268.0%
*-commutative68.0%
unpow268.0%
Simplified68.0%
Taylor expanded in x around 0 61.5%
unpow261.5%
Simplified61.5%
Taylor expanded in x around 0 61.5%
unpow261.5%
associate-*l*68.5%
Simplified68.5%
add-sqr-sqrt68.5%
pow268.5%
sqrt-div68.4%
sqrt-div68.4%
metadata-eval68.4%
sqrt-prod36.0%
add-sqr-sqrt74.4%
associate-*r*77.2%
*-commutative77.2%
sqrt-prod54.0%
add-sqr-sqrt85.0%
associate-/r*84.9%
pow284.9%
clear-num84.9%
*-commutative84.9%
associate-*r*82.2%
clear-num82.2%
Applied egg-rr84.9%
if 3.1499999999999998e-65 < x Initial program 71.2%
*-commutative71.2%
associate-*l*66.9%
associate-*r*67.1%
*-commutative67.1%
unpow267.1%
associate-*r*70.0%
associate-*r*70.1%
*-commutative70.1%
unpow270.1%
Simplified70.1%
add-cube-cbrt70.0%
times-frac70.1%
associate-*r*70.1%
swap-sqr87.0%
associate-*r*92.0%
*-commutative92.0%
times-frac92.5%
associate-*l*95.8%
add-cube-cbrt96.0%
associate-/r*96.1%
Applied egg-rr96.1%
un-div-inv96.1%
Applied egg-rr96.1%
Final simplification88.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 (if (<= (pow s 2.0) 2e+207) (/ (cos (* x 2.0)) (* x (* (* c c) (* s (* x s))))) (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 (pow(s, 2.0) <= 2e+207) {
tmp = cos((x * 2.0)) / (x * ((c * c) * (s * (x * s))));
} else {
tmp = 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.0d0) <= 2d+207) then
tmp = cos((x * 2.0d0)) / (x * ((c * c) * (s * (x * s))))
else
tmp = (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 (Math.pow(s, 2.0) <= 2e+207) {
tmp = Math.cos((x * 2.0)) / (x * ((c * c) * (s * (x * s))));
} else {
tmp = 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 math.pow(s, 2.0) <= 2e+207: tmp = math.cos((x * 2.0)) / (x * ((c * c) * (s * (x * s)))) else: tmp = 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.0) <= 2e+207) tmp = Float64(cos(Float64(x * 2.0)) / Float64(x * Float64(Float64(c * c) * Float64(s * Float64(x * s))))); else tmp = 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.0) <= 2e+207)
tmp = cos((x * 2.0)) / (x * ((c * c) * (s * (x * s))));
else
tmp = (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[N[Power[s, 2.0], $MachinePrecision], 2e+207], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x * N[(N[(c * c), $MachinePrecision] * N[(s * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;{s}^{2} \leq 2 \cdot 10^{+207}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(\left(c \cdot c\right) \cdot \left(s \cdot \left(x \cdot s\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\end{array}
\end{array}
if (pow.f64 s 2) < 2.0000000000000001e207Initial program 74.1%
associate-*r*74.9%
*-commutative74.9%
associate-*r*74.2%
unpow274.2%
unpow274.2%
Simplified74.2%
Taylor expanded in c around 0 74.2%
unpow274.2%
*-commutative74.2%
associate-*r*74.9%
unpow274.9%
*-commutative74.9%
associate-*l*78.6%
Simplified78.6%
if 2.0000000000000001e207 < (pow.f64 s 2) Initial program 60.3%
associate-/r*60.3%
unpow260.3%
*-commutative60.3%
unpow260.3%
Simplified60.3%
Taylor expanded in x around 0 59.4%
unpow259.4%
Simplified59.4%
Taylor expanded in x around 0 59.4%
unpow259.4%
associate-*l*71.4%
Simplified71.4%
add-sqr-sqrt71.4%
pow271.4%
sqrt-div71.4%
sqrt-div71.4%
metadata-eval71.4%
sqrt-prod38.6%
add-sqr-sqrt77.1%
associate-*r*82.1%
*-commutative82.1%
sqrt-prod46.9%
add-sqr-sqrt88.7%
associate-/r*88.6%
pow288.6%
clear-num88.6%
*-commutative88.6%
associate-*r*83.3%
clear-num83.3%
Applied egg-rr88.6%
Final simplification82.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
(let* ((t_0 (/ 1.0 (* s (* x c)))))
(if (<= x 0.112)
(pow (* c (* x s)) -2.0)
(if (<= x 3.95e+182)
(/ (cos (* x 2.0)) (* s (* (* c c) (* x (* x s)))))
(* 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 = 1.0 / (s * (x * c));
double tmp;
if (x <= 0.112) {
tmp = pow((c * (x * s)), -2.0);
} else if (x <= 3.95e+182) {
tmp = cos((x * 2.0)) / (s * ((c * c) * (x * (x * s))));
} else {
tmp = 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 = 1.0d0 / (s * (x * c))
if (x <= 0.112d0) then
tmp = (c * (x * s)) ** (-2.0d0)
else if (x <= 3.95d+182) then
tmp = cos((x * 2.0d0)) / (s * ((c * c) * (x * (x * s))))
else
tmp = 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 = 1.0 / (s * (x * c));
double tmp;
if (x <= 0.112) {
tmp = Math.pow((c * (x * s)), -2.0);
} else if (x <= 3.95e+182) {
tmp = Math.cos((x * 2.0)) / (s * ((c * c) * (x * (x * s))));
} else {
tmp = 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 = 1.0 / (s * (x * c)) tmp = 0 if x <= 0.112: tmp = math.pow((c * (x * s)), -2.0) elif x <= 3.95e+182: tmp = math.cos((x * 2.0)) / (s * ((c * c) * (x * (x * s)))) else: tmp = 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(1.0 / Float64(s * Float64(x * c))) tmp = 0.0 if (x <= 0.112) tmp = Float64(c * Float64(x * s)) ^ -2.0; elseif (x <= 3.95e+182) tmp = Float64(cos(Float64(x * 2.0)) / Float64(s * Float64(Float64(c * c) * Float64(x * Float64(x * s))))); else tmp = 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 = 1.0 / (s * (x * c));
tmp = 0.0;
if (x <= 0.112)
tmp = (c * (x * s)) ^ -2.0;
elseif (x <= 3.95e+182)
tmp = cos((x * 2.0)) / (s * ((c * c) * (x * (x * s))));
else
tmp = 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[(1.0 / N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 0.112], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], If[LessEqual[x, 3.95e+182], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s * N[(N[(c * c), $MachinePrecision] * N[(x * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := \frac{1}{s \cdot \left(x \cdot c\right)}\\
\mathbf{if}\;x \leq 0.112:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{elif}\;x \leq 3.95 \cdot 10^{+182}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{s \cdot \left(\left(c \cdot c\right) \cdot \left(x \cdot \left(x \cdot s\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot t_0\\
\end{array}
\end{array}
if x < 0.112000000000000002Initial program 68.6%
associate-/r*68.6%
unpow268.6%
*-commutative68.6%
unpow268.6%
Simplified68.6%
Taylor expanded in x around 0 62.5%
unpow262.5%
Simplified62.5%
Taylor expanded in x around 0 62.5%
unpow262.5%
associate-*l*69.1%
Simplified69.1%
add-sqr-sqrt69.0%
pow269.0%
sqrt-div69.0%
sqrt-div69.0%
metadata-eval69.0%
sqrt-prod35.7%
add-sqr-sqrt74.6%
associate-*r*77.2%
*-commutative77.2%
sqrt-prod54.5%
add-sqr-sqrt85.6%
associate-/r*85.5%
pow285.5%
clear-num85.5%
*-commutative85.5%
associate-*r*83.0%
clear-num83.0%
Applied egg-rr85.6%
if 0.112000000000000002 < x < 3.9500000000000001e182Initial program 76.6%
*-commutative76.6%
associate-*l*70.2%
associate-*r*73.3%
*-commutative73.3%
unpow273.3%
associate-*r*76.3%
associate-*r*73.4%
*-commutative73.4%
unpow273.4%
Simplified73.4%
Taylor expanded in x around 0 73.4%
*-commutative73.4%
unpow273.4%
associate-*r*70.5%
unpow270.5%
*-commutative70.5%
associate-*r*76.4%
Simplified76.4%
if 3.9500000000000001e182 < x Initial program 62.4%
*-commutative62.4%
associate-*l*58.6%
associate-*r*58.6%
*-commutative58.6%
unpow258.6%
associate-*r*62.6%
associate-*r*63.0%
*-commutative63.0%
unpow263.0%
Simplified63.0%
add-cube-cbrt63.0%
times-frac63.0%
associate-*r*63.0%
swap-sqr90.2%
associate-*r*93.5%
*-commutative93.5%
times-frac93.6%
associate-*l*93.6%
add-cube-cbrt93.7%
associate-/r*93.7%
Applied egg-rr93.7%
Taylor expanded in x around 0 72.2%
Final simplification82.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
(let* ((t_0 (/ 1.0 (* s (* x c)))))
(if (<= x 0.112)
(pow (* c (* x s)) -2.0)
(if (<= x 1.26e+154)
(/ (cos (* x 2.0)) (* s (* (* x x) (* s (* c c)))))
(* 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 = 1.0 / (s * (x * c));
double tmp;
if (x <= 0.112) {
tmp = pow((c * (x * s)), -2.0);
} else if (x <= 1.26e+154) {
tmp = cos((x * 2.0)) / (s * ((x * x) * (s * (c * c))));
} else {
tmp = 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 = 1.0d0 / (s * (x * c))
if (x <= 0.112d0) then
tmp = (c * (x * s)) ** (-2.0d0)
else if (x <= 1.26d+154) then
tmp = cos((x * 2.0d0)) / (s * ((x * x) * (s * (c * c))))
else
tmp = 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 = 1.0 / (s * (x * c));
double tmp;
if (x <= 0.112) {
tmp = Math.pow((c * (x * s)), -2.0);
} else if (x <= 1.26e+154) {
tmp = Math.cos((x * 2.0)) / (s * ((x * x) * (s * (c * c))));
} else {
tmp = 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 = 1.0 / (s * (x * c)) tmp = 0 if x <= 0.112: tmp = math.pow((c * (x * s)), -2.0) elif x <= 1.26e+154: tmp = math.cos((x * 2.0)) / (s * ((x * x) * (s * (c * c)))) else: tmp = 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(1.0 / Float64(s * Float64(x * c))) tmp = 0.0 if (x <= 0.112) tmp = Float64(c * Float64(x * s)) ^ -2.0; elseif (x <= 1.26e+154) tmp = Float64(cos(Float64(x * 2.0)) / Float64(s * Float64(Float64(x * x) * Float64(s * Float64(c * c))))); else tmp = 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 = 1.0 / (s * (x * c));
tmp = 0.0;
if (x <= 0.112)
tmp = (c * (x * s)) ^ -2.0;
elseif (x <= 1.26e+154)
tmp = cos((x * 2.0)) / (s * ((x * x) * (s * (c * c))));
else
tmp = 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[(1.0 / N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 0.112], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], If[LessEqual[x, 1.26e+154], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(s * N[(N[(x * x), $MachinePrecision] * N[(s * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := \frac{1}{s \cdot \left(x \cdot c\right)}\\
\mathbf{if}\;x \leq 0.112:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{elif}\;x \leq 1.26 \cdot 10^{+154}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(s \cdot \left(c \cdot c\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot t_0\\
\end{array}
\end{array}
if x < 0.112000000000000002Initial program 68.6%
associate-/r*68.6%
unpow268.6%
*-commutative68.6%
unpow268.6%
Simplified68.6%
Taylor expanded in x around 0 62.5%
unpow262.5%
Simplified62.5%
Taylor expanded in x around 0 62.5%
unpow262.5%
associate-*l*69.1%
Simplified69.1%
add-sqr-sqrt69.0%
pow269.0%
sqrt-div69.0%
sqrt-div69.0%
metadata-eval69.0%
sqrt-prod35.7%
add-sqr-sqrt74.6%
associate-*r*77.2%
*-commutative77.2%
sqrt-prod54.5%
add-sqr-sqrt85.6%
associate-/r*85.5%
pow285.5%
clear-num85.5%
*-commutative85.5%
associate-*r*83.0%
clear-num83.0%
Applied egg-rr85.6%
if 0.112000000000000002 < x < 1.26e154Initial program 78.2%
*-commutative78.2%
associate-*l*78.1%
associate-*r*81.8%
*-commutative81.8%
unpow281.8%
associate-*r*85.5%
associate-*r*81.9%
*-commutative81.9%
unpow281.9%
Simplified81.9%
if 1.26e154 < x Initial program 63.6%
*-commutative63.6%
associate-*l*54.6%
associate-*r*54.6%
*-commutative54.6%
unpow254.6%
associate-*r*57.9%
associate-*r*58.2%
*-commutative58.2%
unpow258.2%
Simplified58.2%
add-cube-cbrt58.2%
times-frac58.2%
associate-*r*58.2%
swap-sqr89.1%
associate-*r*94.5%
*-commutative94.5%
times-frac94.5%
associate-*l*94.5%
add-cube-cbrt94.7%
associate-/r*94.7%
Applied egg-rr94.7%
Taylor expanded in x around 0 66.9%
Final simplification82.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 (<= x 0.295) (pow (* c (* x s)) -2.0) (/ (cos (* x 2.0)) (* x (* (* c (* x c)) (* s 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 <= 0.295) {
tmp = pow((c * (x * s)), -2.0);
} else {
tmp = cos((x * 2.0)) / (x * ((c * (x * 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) :: tmp
if (x <= 0.295d0) then
tmp = (c * (x * s)) ** (-2.0d0)
else
tmp = cos((x * 2.0d0)) / (x * ((c * (x * 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 tmp;
if (x <= 0.295) {
tmp = Math.pow((c * (x * s)), -2.0);
} else {
tmp = Math.cos((x * 2.0)) / (x * ((c * (x * c)) * (s * 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 <= 0.295: tmp = math.pow((c * (x * s)), -2.0) else: tmp = math.cos((x * 2.0)) / (x * ((c * (x * c)) * (s * 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 <= 0.295) tmp = Float64(c * Float64(x * s)) ^ -2.0; else tmp = Float64(cos(Float64(x * 2.0)) / Float64(x * Float64(Float64(c * Float64(x * 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)
tmp = 0.0;
if (x <= 0.295)
tmp = (c * (x * s)) ^ -2.0;
else
tmp = cos((x * 2.0)) / (x * ((c * (x * 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_] := If[LessEqual[x, 0.295], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[(x * N[(N[(c * N[(x * 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}
\mathbf{if}\;x \leq 0.295:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{x \cdot \left(\left(c \cdot \left(x \cdot c\right)\right) \cdot \left(s \cdot s\right)\right)}\\
\end{array}
\end{array}
if x < 0.294999999999999984Initial program 68.6%
associate-/r*68.6%
unpow268.6%
*-commutative68.6%
unpow268.6%
Simplified68.6%
Taylor expanded in x around 0 62.5%
unpow262.5%
Simplified62.5%
Taylor expanded in x around 0 62.5%
unpow262.5%
associate-*l*69.1%
Simplified69.1%
add-sqr-sqrt69.0%
pow269.0%
sqrt-div69.0%
sqrt-div69.0%
metadata-eval69.0%
sqrt-prod35.7%
add-sqr-sqrt74.6%
associate-*r*77.2%
*-commutative77.2%
sqrt-prod54.5%
add-sqr-sqrt85.6%
associate-/r*85.5%
pow285.5%
clear-num85.5%
*-commutative85.5%
associate-*r*83.0%
clear-num83.0%
Applied egg-rr85.6%
if 0.294999999999999984 < x Initial program 70.0%
associate-*r*71.6%
*-commutative71.6%
associate-*r*71.6%
unpow271.6%
unpow271.6%
Simplified71.6%
Taylor expanded in c around 0 71.6%
unpow271.6%
associate-*l*81.1%
Simplified81.1%
Final simplification84.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
(let* ((t_0 (cos (* x 2.0))) (t_1 (* c (* x s))))
(if (<= x 1.9e+203)
(/ t_0 (* t_1 t_1))
(/ t_0 (* x (* (* c (* x 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 t_1 = c * (x * s);
double tmp;
if (x <= 1.9e+203) {
tmp = t_0 / (t_1 * t_1);
} else {
tmp = t_0 / (x * ((c * (x * 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) :: t_1
real(8) :: tmp
t_0 = cos((x * 2.0d0))
t_1 = c * (x * s)
if (x <= 1.9d+203) then
tmp = t_0 / (t_1 * t_1)
else
tmp = t_0 / (x * ((c * (x * 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 t_1 = c * (x * s);
double tmp;
if (x <= 1.9e+203) {
tmp = t_0 / (t_1 * t_1);
} else {
tmp = t_0 / (x * ((c * (x * 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)) t_1 = c * (x * s) tmp = 0 if x <= 1.9e+203: tmp = t_0 / (t_1 * t_1) else: tmp = t_0 / (x * ((c * (x * 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)) t_1 = Float64(c * Float64(x * s)) tmp = 0.0 if (x <= 1.9e+203) tmp = Float64(t_0 / Float64(t_1 * t_1)); else tmp = Float64(t_0 / Float64(x * Float64(Float64(c * Float64(x * 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));
t_1 = c * (x * s);
tmp = 0.0;
if (x <= 1.9e+203)
tmp = t_0 / (t_1 * t_1);
else
tmp = t_0 / (x * ((c * (x * 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]}, Block[{t$95$1 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.9e+203], N[(t$95$0 / N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(x * N[(N[(c * N[(x * 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)\\
t_1 := c \cdot \left(x \cdot s\right)\\
\mathbf{if}\;x \leq 1.9 \cdot 10^{+203}:\\
\;\;\;\;\frac{t_0}{t_1 \cdot t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{x \cdot \left(\left(c \cdot \left(x \cdot c\right)\right) \cdot \left(s \cdot s\right)\right)}\\
\end{array}
\end{array}
if x < 1.90000000000000012e203Initial program 70.0%
*-commutative70.0%
associate-*r*66.0%
associate-*r*64.4%
unpow264.4%
unswap-sqr79.5%
unpow279.5%
swap-sqr96.3%
*-commutative96.3%
*-commutative96.3%
*-commutative96.3%
*-commutative96.3%
Simplified96.3%
Taylor expanded in s around 0 94.0%
Taylor expanded in s around 0 97.0%
if 1.90000000000000012e203 < x Initial program 59.7%
associate-*r*59.8%
*-commutative59.8%
associate-*r*60.0%
unpow260.0%
unpow260.0%
Simplified60.0%
Taylor expanded in c around 0 60.0%
unpow260.0%
associate-*l*81.7%
Simplified81.7%
Final simplification95.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
(let* ((t_0 (* s (* x c))))
(if (<= x 2.4e-64)
(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 <= 2.4e-64) {
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 <= 2.4d-64) 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 <= 2.4e-64) {
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 <= 2.4e-64: 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 <= 2.4e-64) 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 <= 2.4e-64)
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, 2.4e-64], 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 2.4 \cdot 10^{-64}:\\
\;\;\;\;{\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 < 2.39999999999999998e-64Initial program 68.0%
associate-/r*68.0%
unpow268.0%
*-commutative68.0%
unpow268.0%
Simplified68.0%
Taylor expanded in x around 0 61.5%
unpow261.5%
Simplified61.5%
Taylor expanded in x around 0 61.5%
unpow261.5%
associate-*l*68.5%
Simplified68.5%
add-sqr-sqrt68.5%
pow268.5%
sqrt-div68.4%
sqrt-div68.4%
metadata-eval68.4%
sqrt-prod36.0%
add-sqr-sqrt74.4%
associate-*r*77.2%
*-commutative77.2%
sqrt-prod54.0%
add-sqr-sqrt85.0%
associate-/r*84.9%
pow284.9%
clear-num84.9%
*-commutative84.9%
associate-*r*82.2%
clear-num82.2%
Applied egg-rr84.9%
if 2.39999999999999998e-64 < x Initial program 71.2%
*-commutative71.2%
associate-*r*66.9%
associate-*r*67.0%
unpow267.0%
unswap-sqr82.8%
unpow282.8%
swap-sqr96.0%
*-commutative96.0%
*-commutative96.0%
*-commutative96.0%
*-commutative96.0%
Simplified96.0%
Final simplification88.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 (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 68.9%
associate-/r*68.9%
unpow268.9%
*-commutative68.9%
unpow268.9%
Simplified68.9%
Taylor expanded in x around 0 60.6%
unpow260.6%
Simplified60.6%
Taylor expanded in x around 0 60.6%
unpow260.6%
associate-*l*66.0%
Simplified66.0%
add-sqr-sqrt66.0%
pow266.0%
sqrt-div66.0%
sqrt-div66.0%
metadata-eval66.0%
sqrt-prod35.5%
add-sqr-sqrt71.2%
associate-*r*73.1%
*-commutative73.1%
sqrt-prod49.1%
add-sqr-sqrt79.9%
associate-/r*79.8%
pow279.8%
clear-num79.8%
*-commutative79.8%
associate-*r*77.8%
clear-num77.8%
Applied egg-rr79.9%
Final simplification79.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 (if (<= s 5.6e+157) (/ 1.0 (* (* c c) (* (* s s) (* x x)))) (/ -2.0 (* (* s 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 (s <= 5.6e+157) {
tmp = 1.0 / ((c * c) * ((s * s) * (x * x)));
} else {
tmp = -2.0 / ((s * 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 (s <= 5.6d+157) then
tmp = 1.0d0 / ((c * c) * ((s * s) * (x * x)))
else
tmp = (-2.0d0) / ((s * 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 (s <= 5.6e+157) {
tmp = 1.0 / ((c * c) * ((s * s) * (x * x)));
} else {
tmp = -2.0 / ((s * 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 s <= 5.6e+157: tmp = 1.0 / ((c * c) * ((s * s) * (x * x))) else: tmp = -2.0 / ((s * 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 (s <= 5.6e+157) tmp = Float64(1.0 / Float64(Float64(c * c) * Float64(Float64(s * s) * Float64(x * x)))); else tmp = Float64(-2.0 / Float64(Float64(s * 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 (s <= 5.6e+157)
tmp = 1.0 / ((c * c) * ((s * s) * (x * x)));
else
tmp = -2.0 / ((s * 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[LessEqual[s, 5.6e+157], N[(1.0 / N[(N[(c * c), $MachinePrecision] * N[(N[(s * s), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 / N[(N[(s * s), $MachinePrecision] * N[(c * c), $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 5.6 \cdot 10^{+157}:\\
\;\;\;\;\frac{1}{\left(c \cdot c\right) \cdot \left(\left(s \cdot s\right) \cdot \left(x \cdot x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{\left(s \cdot s\right) \cdot \left(c \cdot c\right)}\\
\end{array}
\end{array}
if s < 5.6000000000000005e157Initial program 68.7%
*-commutative68.7%
associate-*r*65.0%
associate-*r*63.5%
unpow263.5%
unswap-sqr80.5%
unpow280.5%
swap-sqr96.1%
*-commutative96.1%
*-commutative96.1%
*-commutative96.1%
*-commutative96.1%
Simplified96.1%
Taylor expanded in s around 0 93.4%
Taylor expanded in s around 0 96.5%
Taylor expanded in x around 0 56.2%
*-commutative56.2%
associate-*r*56.9%
*-commutative56.9%
unpow256.9%
unpow256.9%
unpow256.9%
Simplified56.9%
if 5.6000000000000005e157 < s Initial program 70.5%
*-commutative70.5%
associate-*l*63.4%
associate-*r*63.4%
*-commutative63.4%
unpow263.4%
associate-*r*70.5%
associate-*r*70.5%
*-commutative70.5%
unpow270.5%
Simplified70.5%
add-cube-cbrt70.5%
times-frac70.5%
associate-*r*67.5%
swap-sqr87.0%
associate-*r*93.4%
*-commutative93.4%
times-frac93.5%
associate-*l*94.8%
add-cube-cbrt95.0%
associate-/r*95.0%
Applied egg-rr95.0%
Taylor expanded in x around 0 85.4%
Taylor expanded in x around inf 70.5%
unpow270.5%
unpow270.5%
Simplified70.5%
Final simplification58.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 2.8e-202) (/ (/ 1.0 (* c c)) (* x (* s (* x s)))) (/ 1.0 (* (* x c) (* s (* c (* x 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 <= 2.8e-202) {
tmp = (1.0 / (c * c)) / (x * (s * (x * s)));
} else {
tmp = 1.0 / ((x * c) * (s * (c * (x * 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 <= 2.8d-202) then
tmp = (1.0d0 / (c * c)) / (x * (s * (x * s)))
else
tmp = 1.0d0 / ((x * c) * (s * (c * (x * 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 <= 2.8e-202) {
tmp = (1.0 / (c * c)) / (x * (s * (x * s)));
} else {
tmp = 1.0 / ((x * c) * (s * (c * (x * 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 <= 2.8e-202: tmp = (1.0 / (c * c)) / (x * (s * (x * s))) else: tmp = 1.0 / ((x * c) * (s * (c * (x * 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 <= 2.8e-202) tmp = Float64(Float64(1.0 / Float64(c * c)) / Float64(x * Float64(s * Float64(x * s)))); else tmp = Float64(1.0 / Float64(Float64(x * c) * Float64(s * Float64(c * Float64(x * 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 <= 2.8e-202)
tmp = (1.0 / (c * c)) / (x * (s * (x * s)));
else
tmp = 1.0 / ((x * c) * (s * (c * (x * 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, 2.8e-202], N[(N[(1.0 / N[(c * c), $MachinePrecision]), $MachinePrecision] / N[(x * N[(s * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(x * c), $MachinePrecision] * N[(s * N[(c * N[(x * 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 2.8 \cdot 10^{-202}:\\
\;\;\;\;\frac{\frac{1}{c \cdot c}}{x \cdot \left(s \cdot \left(x \cdot s\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(x \cdot c\right) \cdot \left(s \cdot \left(c \cdot \left(x \cdot s\right)\right)\right)}\\
\end{array}
\end{array}
if x < 2.8000000000000001e-202Initial program 66.4%
associate-/r*66.5%
unpow266.5%
*-commutative66.5%
unpow266.5%
Simplified66.5%
Taylor expanded in x around 0 58.9%
unpow258.9%
Simplified58.9%
Taylor expanded in x around 0 58.9%
unpow258.9%
associate-*l*65.8%
Simplified65.8%
if 2.8000000000000001e-202 < x Initial program 72.8%
*-commutative72.8%
associate-*l*65.6%
associate-*r*65.8%
*-commutative65.8%
unpow265.8%
associate-*r*70.0%
associate-*r*69.2%
*-commutative69.2%
unpow269.2%
Simplified69.2%
*-un-lft-identity69.2%
times-frac69.1%
associate-*r*68.2%
swap-sqr88.5%
associate-*r*93.2%
*-commutative93.2%
times-frac93.0%
associate-*l*96.3%
associate-*r*95.4%
times-frac96.0%
*-commutative96.0%
Applied egg-rr96.0%
Taylor expanded in x around 0 75.3%
frac-times74.8%
metadata-eval74.8%
associate-*r*74.4%
*-commutative74.4%
*-commutative74.4%
*-commutative74.4%
*-commutative74.4%
Applied egg-rr74.4%
Final simplification69.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 (if (<= x 6e-123) (/ (/ 1.0 (* c c)) (* (* x s) (* x s))) (/ 1.0 (* (* x c) (* s (* c (* x 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 <= 6e-123) {
tmp = (1.0 / (c * c)) / ((x * s) * (x * s));
} else {
tmp = 1.0 / ((x * c) * (s * (c * (x * 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 <= 6d-123) then
tmp = (1.0d0 / (c * c)) / ((x * s) * (x * s))
else
tmp = 1.0d0 / ((x * c) * (s * (c * (x * 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 <= 6e-123) {
tmp = (1.0 / (c * c)) / ((x * s) * (x * s));
} else {
tmp = 1.0 / ((x * c) * (s * (c * (x * 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 <= 6e-123: tmp = (1.0 / (c * c)) / ((x * s) * (x * s)) else: tmp = 1.0 / ((x * c) * (s * (c * (x * 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 <= 6e-123) tmp = Float64(Float64(1.0 / Float64(c * c)) / Float64(Float64(x * s) * Float64(x * s))); else tmp = Float64(1.0 / Float64(Float64(x * c) * Float64(s * Float64(c * Float64(x * 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 <= 6e-123)
tmp = (1.0 / (c * c)) / ((x * s) * (x * s));
else
tmp = 1.0 / ((x * c) * (s * (c * (x * 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, 6e-123], N[(N[(1.0 / N[(c * c), $MachinePrecision]), $MachinePrecision] / N[(N[(x * s), $MachinePrecision] * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(x * c), $MachinePrecision] * N[(s * N[(c * N[(x * 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 6 \cdot 10^{-123}:\\
\;\;\;\;\frac{\frac{1}{c \cdot c}}{\left(x \cdot s\right) \cdot \left(x \cdot s\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(x \cdot c\right) \cdot \left(s \cdot \left(c \cdot \left(x \cdot s\right)\right)\right)}\\
\end{array}
\end{array}
if x < 5.99999999999999968e-123Initial program 66.7%
associate-/r*66.7%
unpow266.7%
*-commutative66.7%
unpow266.7%
Simplified66.7%
Taylor expanded in x around 0 59.8%
unpow259.8%
Simplified59.8%
add-sqr-sqrt59.8%
sqrt-unprod58.1%
associate-*r*55.1%
associate-*r*55.1%
swap-sqr45.4%
pow245.4%
pow245.4%
pow-prod-up45.4%
metadata-eval45.4%
pow245.4%
pow245.4%
pow-prod-up45.4%
metadata-eval45.4%
Applied egg-rr45.4%
*-commutative45.4%
metadata-eval45.4%
pow-sqr45.4%
unpow245.4%
unpow245.4%
metadata-eval45.4%
pow-sqr45.4%
unpow245.4%
unpow245.4%
unswap-sqr55.1%
*-commutative55.1%
swap-sqr55.1%
unpow255.1%
*-commutative55.1%
swap-sqr65.6%
unpow265.6%
pow-sqr65.6%
*-commutative65.6%
metadata-eval65.6%
Simplified65.6%
sqrt-pow169.1%
metadata-eval69.1%
pow269.1%
*-commutative69.1%
*-commutative69.1%
Applied egg-rr69.1%
if 5.99999999999999968e-123 < x Initial program 73.4%
*-commutative73.4%
associate-*l*69.6%
associate-*r*69.7%
*-commutative69.7%
unpow269.7%
associate-*r*72.4%
associate-*r*72.5%
*-commutative72.5%
unpow272.5%
Simplified72.5%
*-un-lft-identity72.5%
times-frac72.5%
associate-*r*71.4%
swap-sqr87.6%
associate-*r*93.2%
*-commutative93.2%
times-frac93.6%
associate-*l*96.4%
associate-*r*95.4%
times-frac95.3%
*-commutative95.3%
Applied egg-rr95.3%
Taylor expanded in x around 0 71.1%
frac-times71.0%
metadata-eval71.0%
associate-*r*70.6%
*-commutative70.6%
*-commutative70.6%
*-commutative70.6%
*-commutative70.6%
Applied egg-rr70.6%
Final simplification69.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 (* s (* x c))))
(if (<= x 2.6e-171)
(/ (/ 1.0 (* c c)) (* (* x s) (* x s)))
(/ (/ 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 <= 2.6e-171) {
tmp = (1.0 / (c * c)) / ((x * s) * (x * s));
} else {
tmp = (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 <= 2.6d-171) then
tmp = (1.0d0 / (c * c)) / ((x * s) * (x * s))
else
tmp = (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 <= 2.6e-171) {
tmp = (1.0 / (c * c)) / ((x * s) * (x * s));
} else {
tmp = (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 <= 2.6e-171: tmp = (1.0 / (c * c)) / ((x * s) * (x * s)) else: tmp = (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 <= 2.6e-171) tmp = Float64(Float64(1.0 / Float64(c * c)) / Float64(Float64(x * s) * Float64(x * s))); else tmp = 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 <= 2.6e-171)
tmp = (1.0 / (c * c)) / ((x * s) * (x * s));
else
tmp = (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, 2.6e-171], N[(N[(1.0 / N[(c * c), $MachinePrecision]), $MachinePrecision] / N[(N[(x * s), $MachinePrecision] * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / 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 2.6 \cdot 10^{-171}:\\
\;\;\;\;\frac{\frac{1}{c \cdot c}}{\left(x \cdot s\right) \cdot \left(x \cdot s\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t_0}}{t_0}\\
\end{array}
\end{array}
if x < 2.60000000000000005e-171Initial program 66.9%
associate-/r*66.9%
unpow266.9%
*-commutative66.9%
unpow266.9%
Simplified66.9%
Taylor expanded in x around 0 59.5%
unpow259.5%
Simplified59.5%
add-sqr-sqrt59.5%
sqrt-unprod58.4%
associate-*r*55.2%
associate-*r*55.1%
swap-sqr45.8%
pow245.8%
pow245.8%
pow-prod-up45.8%
metadata-eval45.8%
pow245.8%
pow245.8%
pow-prod-up45.8%
metadata-eval45.8%
Applied egg-rr45.8%
*-commutative45.8%
metadata-eval45.8%
pow-sqr45.8%
unpow245.8%
unpow245.8%
metadata-eval45.8%
pow-sqr45.8%
unpow245.8%
unpow245.8%
unswap-sqr55.1%
*-commutative55.1%
swap-sqr55.1%
unpow255.1%
*-commutative55.1%
swap-sqr65.6%
unpow265.6%
pow-sqr65.6%
*-commutative65.6%
metadata-eval65.6%
Simplified65.6%
sqrt-pow168.7%
metadata-eval68.7%
pow268.7%
*-commutative68.7%
*-commutative68.7%
Applied egg-rr68.7%
if 2.60000000000000005e-171 < x Initial program 72.4%
*-commutative72.4%
associate-*l*68.0%
associate-*r*68.2%
*-commutative68.2%
unpow268.2%
associate-*r*71.6%
associate-*r*70.7%
*-commutative70.7%
unpow270.7%
Simplified70.7%
add-cube-cbrt70.6%
times-frac70.6%
associate-*r*69.7%
swap-sqr87.7%
associate-*r*92.6%
*-commutative92.6%
times-frac92.4%
associate-*l*96.0%
add-cube-cbrt96.1%
associate-/r*96.9%
Applied egg-rr96.8%
un-div-inv96.9%
Applied egg-rr96.9%
Taylor expanded in x around 0 74.2%
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 (let* ((t_0 (/ 1.0 (* c (* x s))))) (* 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 = 1.0 / (c * (x * s));
return 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 = 1.0d0 / (c * (x * s))
code = 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 = 1.0 / (c * (x * s));
return 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 = 1.0 / (c * (x * s)) return 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(1.0 / Float64(c * Float64(x * s))) return 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 = 1.0 / (c * (x * s));
tmp = 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[(1.0 / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := \frac{1}{c \cdot \left(x \cdot s\right)}\\
t_0 \cdot t_0
\end{array}
\end{array}
Initial program 68.9%
associate-/r*68.9%
unpow268.9%
*-commutative68.9%
unpow268.9%
Simplified68.9%
Taylor expanded in x around 0 60.6%
unpow260.6%
Simplified60.6%
Taylor expanded in x around 0 60.6%
unpow260.6%
associate-*l*66.0%
Simplified66.0%
add-sqr-sqrt66.0%
sqrt-div66.0%
sqrt-div66.0%
metadata-eval66.0%
sqrt-prod33.0%
add-sqr-sqrt50.3%
associate-*r*50.3%
*-commutative50.3%
sqrt-prod30.0%
add-sqr-sqrt47.8%
associate-/r*47.8%
*-commutative47.8%
sqrt-div47.8%
sqrt-div47.8%
metadata-eval47.8%
sqrt-prod25.3%
add-sqr-sqrt52.2%
associate-*r*52.9%
*-commutative52.9%
Applied egg-rr79.8%
Final simplification79.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 (* (* x c) (* s (* c (* 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 / ((x * c) * (s * (c * (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 / ((x * c) * (s * (c * (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 / ((x * c) * (s * (c * (x * s))));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return 1.0 / ((x * c) * (s * (c * (x * 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(x * c) * Float64(s * Float64(c * 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 / ((x * c) * (s * (c * (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[(1.0 / N[(N[(x * c), $MachinePrecision] * N[(s * N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{1}{\left(x \cdot c\right) \cdot \left(s \cdot \left(c \cdot \left(x \cdot s\right)\right)\right)}
\end{array}
Initial program 68.9%
*-commutative68.9%
associate-*l*64.9%
associate-*r*64.2%
*-commutative64.2%
unpow264.2%
associate-*r*69.9%
associate-*r*70.3%
*-commutative70.3%
unpow270.3%
Simplified70.3%
*-un-lft-identity70.3%
times-frac70.4%
associate-*r*68.9%
swap-sqr87.2%
associate-*r*93.2%
*-commutative93.2%
times-frac93.1%
associate-*l*95.9%
associate-*r*92.7%
times-frac92.7%
*-commutative92.7%
Applied egg-rr92.7%
Taylor expanded in x around 0 77.1%
frac-times77.0%
metadata-eval77.0%
associate-*r*76.0%
*-commutative76.0%
*-commutative76.0%
*-commutative76.0%
*-commutative76.0%
Applied egg-rr76.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 (/ -2.0 (* (* s s) (* c c))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
return -2.0 / ((s * s) * (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 = (-2.0d0) / ((s * s) * (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 -2.0 / ((s * s) * (c * c));
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): return -2.0 / ((s * s) * (c * c))
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(s * s) * 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 = -2.0 / ((s * s) * (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[(-2.0 / N[(N[(s * s), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{-2}{\left(s \cdot s\right) \cdot \left(c \cdot c\right)}
\end{array}
Initial program 68.9%
*-commutative68.9%
associate-*l*64.9%
associate-*r*64.2%
*-commutative64.2%
unpow264.2%
associate-*r*69.9%
associate-*r*70.3%
*-commutative70.3%
unpow270.3%
Simplified70.3%
add-cube-cbrt70.3%
times-frac70.3%
associate-*r*68.9%
swap-sqr87.1%
associate-*r*93.0%
*-commutative93.0%
times-frac92.9%
associate-*l*95.8%
add-cube-cbrt95.9%
associate-/r*96.2%
Applied egg-rr96.2%
Taylor expanded in x around 0 64.8%
Taylor expanded in x around inf 31.3%
unpow231.3%
unpow231.3%
Simplified31.3%
Final simplification31.3%
herbie shell --seed 2023230
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))