
(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 11 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 2.4e+98) (/ (cos (* x 2.0)) (pow (* c (* x s)) 2.0)) (/ (cos (* x -2.0)) (* s (* (* x c) (* s (* x c)))))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 2.4e+98) {
tmp = cos((x * 2.0)) / pow((c * (x * s)), 2.0);
} else {
tmp = cos((x * -2.0)) / (s * ((x * c) * (s * (x * c))));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (x <= 2.4d+98) then
tmp = cos((x * 2.0d0)) / ((c * (x * s)) ** 2.0d0)
else
tmp = cos((x * (-2.0d0))) / (s * ((x * c) * (s * (x * c))))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (x <= 2.4e+98) {
tmp = Math.cos((x * 2.0)) / Math.pow((c * (x * s)), 2.0);
} else {
tmp = Math.cos((x * -2.0)) / (s * ((x * c) * (s * (x * c))));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if x <= 2.4e+98: tmp = math.cos((x * 2.0)) / math.pow((c * (x * s)), 2.0) else: tmp = math.cos((x * -2.0)) / (s * ((x * c) * (s * (x * c)))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (x <= 2.4e+98) tmp = Float64(cos(Float64(x * 2.0)) / (Float64(c * Float64(x * s)) ^ 2.0)); else tmp = Float64(cos(Float64(x * -2.0)) / Float64(s * Float64(Float64(x * c) * Float64(s * Float64(x * c))))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (x <= 2.4e+98)
tmp = cos((x * 2.0)) / ((c * (x * s)) ^ 2.0);
else
tmp = cos((x * -2.0)) / (s * ((x * c) * (s * (x * c))));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[x, 2.4e+98], N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x * -2.0), $MachinePrecision]], $MachinePrecision] / N[(s * N[(N[(x * c), $MachinePrecision] * N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.4 \cdot 10^{+98}:\\
\;\;\;\;\frac{\cos \left(x \cdot 2\right)}{{\left(c \cdot \left(x \cdot s\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot -2\right)}{s \cdot \left(\left(x \cdot c\right) \cdot \left(s \cdot \left(x \cdot c\right)\right)\right)}\\
\end{array}
\end{array}
if x < 2.3999999999999999e98Initial program 74.0%
add-sqr-sqrt74.0%
pow274.0%
sqrt-prod74.0%
unpow274.0%
sqrt-prod37.0%
add-sqr-sqrt78.6%
*-commutative78.6%
associate-*r*71.4%
unpow271.4%
pow-prod-down88.9%
sqrt-pow197.6%
metadata-eval97.6%
pow197.6%
*-commutative97.6%
Applied egg-rr97.6%
if 2.3999999999999999e98 < x Initial program 54.6%
*-commutative54.6%
/-rgt-identity54.6%
metadata-eval54.6%
associate-/l/54.6%
metadata-eval54.6%
/-rgt-identity54.6%
cos-neg54.6%
*-commutative54.6%
distribute-rgt-neg-in54.6%
metadata-eval54.6%
*-commutative54.6%
associate-*l*39.9%
unpow239.9%
Simplified39.9%
Taylor expanded in x around inf 40.0%
*-commutative40.0%
unpow240.0%
unpow240.0%
associate-*r*54.6%
*-commutative54.6%
unpow254.6%
associate-*r*59.1%
associate-*r*64.0%
*-commutative64.0%
unpow264.0%
associate-*l*78.6%
*-commutative78.6%
unpow278.6%
associate-*l*87.8%
*-commutative87.8%
associate-*l*92.5%
unpow292.5%
associate-*r*96.7%
*-commutative96.7%
Simplified96.7%
unpow296.7%
*-commutative96.7%
associate-*r*90.2%
Applied egg-rr90.2%
Final simplification96.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 (<= x 1.8e-98) (/ 1.0 (* c (* (* x s) (* c (* x s))))) (/ (cos (* x -2.0)) (* (* c s) (* x (* s (* x c)))))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 1.8e-98) {
tmp = 1.0 / (c * ((x * s) * (c * (x * s))));
} else {
tmp = cos((x * -2.0)) / ((c * s) * (x * (s * (x * c))));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (x <= 1.8d-98) then
tmp = 1.0d0 / (c * ((x * s) * (c * (x * s))))
else
tmp = cos((x * (-2.0d0))) / ((c * s) * (x * (s * (x * c))))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (x <= 1.8e-98) {
tmp = 1.0 / (c * ((x * s) * (c * (x * s))));
} else {
tmp = Math.cos((x * -2.0)) / ((c * s) * (x * (s * (x * c))));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if x <= 1.8e-98: tmp = 1.0 / (c * ((x * s) * (c * (x * s)))) else: tmp = math.cos((x * -2.0)) / ((c * s) * (x * (s * (x * c)))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (x <= 1.8e-98) tmp = Float64(1.0 / Float64(c * Float64(Float64(x * s) * Float64(c * Float64(x * s))))); else tmp = Float64(cos(Float64(x * -2.0)) / Float64(Float64(c * s) * Float64(x * Float64(s * Float64(x * c))))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (x <= 1.8e-98)
tmp = 1.0 / (c * ((x * s) * (c * (x * s))));
else
tmp = cos((x * -2.0)) / ((c * s) * (x * (s * (x * c))));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[x, 1.8e-98], N[(1.0 / N[(c * N[(N[(x * s), $MachinePrecision] * N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x * -2.0), $MachinePrecision]], $MachinePrecision] / N[(N[(c * s), $MachinePrecision] * N[(x * N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.8 \cdot 10^{-98}:\\
\;\;\;\;\frac{1}{c \cdot \left(\left(x \cdot s\right) \cdot \left(c \cdot \left(x \cdot s\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot -2\right)}{\left(c \cdot s\right) \cdot \left(x \cdot \left(s \cdot \left(x \cdot c\right)\right)\right)}\\
\end{array}
\end{array}
if x < 1.8000000000000001e-98Initial program 72.5%
Taylor expanded in x around 0 59.4%
unpow259.4%
unpow259.4%
associate-*r*65.1%
*-commutative65.1%
unpow265.1%
associate-*r*70.8%
associate-*r*72.0%
*-commutative72.0%
unpow272.0%
associate-*l*78.1%
*-commutative78.1%
unpow278.1%
associate-*l*82.0%
*-commutative82.0%
associate-*l*84.2%
unpow284.2%
associate-*r*84.6%
*-commutative84.6%
Simplified84.6%
unpow284.6%
associate-*r*82.9%
associate-*l*81.3%
Applied egg-rr81.3%
Taylor expanded in s around 0 80.4%
/-rgt-identity80.4%
associate-*r*82.5%
*-commutative82.5%
associate-*r*84.2%
associate-/l*84.2%
frac-2neg84.2%
metadata-eval84.2%
distribute-lft-neg-in84.2%
associate-/l/84.1%
div-inv84.0%
div-inv84.1%
associate-/l*82.0%
Applied egg-rr80.4%
associate-/l/80.3%
associate-/r/80.4%
/-rgt-identity80.4%
*-commutative80.4%
*-commutative80.4%
*-commutative80.4%
associate-*r*82.0%
Simplified82.0%
if 1.8000000000000001e-98 < x Initial program 67.0%
*-commutative67.0%
/-rgt-identity67.0%
metadata-eval67.0%
associate-/l/66.9%
metadata-eval66.9%
/-rgt-identity66.9%
cos-neg66.9%
*-commutative66.9%
distribute-rgt-neg-in66.9%
metadata-eval66.9%
*-commutative66.9%
associate-*l*58.8%
unpow258.8%
Simplified58.8%
Taylor expanded in x around inf 58.9%
*-commutative58.9%
unpow258.9%
unpow258.9%
associate-*r*67.0%
*-commutative67.0%
unpow267.0%
associate-*r*70.7%
associate-*r*74.6%
*-commutative74.6%
unpow274.6%
associate-*l*84.1%
*-commutative84.1%
unpow284.1%
associate-*l*93.2%
*-commutative93.2%
associate-*l*95.7%
unpow295.7%
associate-*r*98.0%
*-commutative98.0%
Simplified98.0%
unpow261.3%
associate-*r*60.5%
associate-*l*60.3%
Applied egg-rr83.3%
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 (if (<= x 1.1e-6) (pow (* c (* x s)) -2.0) (/ (cos (* x -2.0)) (* (* x c) (* s (* s (* x c)))))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 1.1e-6) {
tmp = pow((c * (x * s)), -2.0);
} else {
tmp = cos((x * -2.0)) / ((x * c) * (s * (s * (x * c))));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (x <= 1.1d-6) then
tmp = (c * (x * s)) ** (-2.0d0)
else
tmp = cos((x * (-2.0d0))) / ((x * c) * (s * (s * (x * c))))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (x <= 1.1e-6) {
tmp = Math.pow((c * (x * s)), -2.0);
} else {
tmp = Math.cos((x * -2.0)) / ((x * c) * (s * (s * (x * c))));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if x <= 1.1e-6: tmp = math.pow((c * (x * s)), -2.0) else: tmp = math.cos((x * -2.0)) / ((x * c) * (s * (s * (x * c)))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (x <= 1.1e-6) tmp = Float64(c * Float64(x * s)) ^ -2.0; else tmp = Float64(cos(Float64(x * -2.0)) / Float64(Float64(x * c) * Float64(s * Float64(s * Float64(x * c))))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (x <= 1.1e-6)
tmp = (c * (x * s)) ^ -2.0;
else
tmp = cos((x * -2.0)) / ((x * c) * (s * (s * (x * c))));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[x, 1.1e-6], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[Cos[N[(x * -2.0), $MachinePrecision]], $MachinePrecision] / N[(N[(x * c), $MachinePrecision] * N[(s * N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.1 \cdot 10^{-6}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot -2\right)}{\left(x \cdot c\right) \cdot \left(s \cdot \left(s \cdot \left(x \cdot c\right)\right)\right)}\\
\end{array}
\end{array}
if x < 1.1000000000000001e-6Initial program 73.2%
Taylor expanded in x around 0 61.3%
unpow261.3%
unpow261.3%
associate-*r*66.5%
*-commutative66.5%
unpow266.5%
associate-*r*72.1%
associate-*r*73.7%
*-commutative73.7%
unpow273.7%
associate-*l*79.7%
*-commutative79.7%
unpow279.7%
associate-*l*83.7%
*-commutative83.7%
associate-*l*85.7%
unpow285.7%
associate-*r*86.0%
*-commutative86.0%
Simplified86.0%
expm1-log1p-u84.9%
expm1-udef75.7%
pow-flip75.7%
metadata-eval75.7%
Applied egg-rr75.7%
expm1-def84.9%
expm1-log1p86.0%
associate-*r*85.5%
*-commutative85.5%
associate-*r*85.6%
Simplified85.6%
if 1.1000000000000001e-6 < x Initial program 62.5%
*-commutative62.5%
/-rgt-identity62.5%
metadata-eval62.5%
associate-/l/62.5%
metadata-eval62.5%
/-rgt-identity62.5%
cos-neg62.5%
*-commutative62.5%
distribute-rgt-neg-in62.5%
metadata-eval62.5%
*-commutative62.5%
associate-*l*51.6%
unpow251.6%
Simplified51.6%
Taylor expanded in x around inf 51.6%
*-commutative51.6%
unpow251.6%
unpow251.6%
associate-*r*62.5%
*-commutative62.5%
unpow262.5%
associate-*r*65.8%
associate-*r*69.4%
*-commutative69.4%
unpow269.4%
associate-*l*80.5%
*-commutative80.5%
unpow280.5%
associate-*l*90.8%
*-commutative90.8%
associate-*l*94.3%
unpow294.3%
associate-*r*97.5%
*-commutative97.5%
Simplified97.5%
unpow297.5%
associate-*r*89.2%
Applied egg-rr89.2%
Final simplification86.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 (<= x 1.05e-21) (/ 1.0 (* c (* (* x s) (* c (* x s))))) (/ (cos (* x -2.0)) (* s (* (* x c) (* s (* x c)))))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 1.05e-21) {
tmp = 1.0 / (c * ((x * s) * (c * (x * s))));
} else {
tmp = cos((x * -2.0)) / (s * ((x * c) * (s * (x * c))));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (x <= 1.05d-21) then
tmp = 1.0d0 / (c * ((x * s) * (c * (x * s))))
else
tmp = cos((x * (-2.0d0))) / (s * ((x * c) * (s * (x * c))))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (x <= 1.05e-21) {
tmp = 1.0 / (c * ((x * s) * (c * (x * s))));
} else {
tmp = Math.cos((x * -2.0)) / (s * ((x * c) * (s * (x * c))));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if x <= 1.05e-21: tmp = 1.0 / (c * ((x * s) * (c * (x * s)))) else: tmp = math.cos((x * -2.0)) / (s * ((x * c) * (s * (x * c)))) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (x <= 1.05e-21) tmp = Float64(1.0 / Float64(c * Float64(Float64(x * s) * Float64(c * Float64(x * s))))); else tmp = Float64(cos(Float64(x * -2.0)) / Float64(s * Float64(Float64(x * c) * Float64(s * Float64(x * c))))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (x <= 1.05e-21)
tmp = 1.0 / (c * ((x * s) * (c * (x * s))));
else
tmp = cos((x * -2.0)) / (s * ((x * c) * (s * (x * c))));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[x, 1.05e-21], N[(1.0 / N[(c * N[(N[(x * s), $MachinePrecision] * N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x * -2.0), $MachinePrecision]], $MachinePrecision] / N[(s * N[(N[(x * c), $MachinePrecision] * N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.05 \cdot 10^{-21}:\\
\;\;\;\;\frac{1}{c \cdot \left(\left(x \cdot s\right) \cdot \left(c \cdot \left(x \cdot s\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x \cdot -2\right)}{s \cdot \left(\left(x \cdot c\right) \cdot \left(s \cdot \left(x \cdot c\right)\right)\right)}\\
\end{array}
\end{array}
if x < 1.05000000000000006e-21Initial program 73.1%
Taylor expanded in x around 0 61.1%
unpow261.1%
unpow261.1%
associate-*r*66.3%
*-commutative66.3%
unpow266.3%
associate-*r*72.0%
associate-*r*73.6%
*-commutative73.6%
unpow273.6%
associate-*l*79.6%
*-commutative79.6%
unpow279.6%
associate-*l*83.6%
*-commutative83.6%
associate-*l*85.6%
unpow285.6%
associate-*r*86.0%
*-commutative86.0%
Simplified86.0%
unpow286.0%
associate-*r*84.4%
associate-*l*83.0%
Applied egg-rr83.0%
Taylor expanded in s around 0 82.2%
/-rgt-identity82.2%
associate-*r*84.1%
*-commutative84.1%
associate-*r*85.6%
associate-/l*85.6%
frac-2neg85.6%
metadata-eval85.6%
distribute-lft-neg-in85.6%
associate-/l/85.5%
div-inv85.5%
div-inv85.5%
associate-/l*83.5%
Applied egg-rr82.1%
associate-/l/82.1%
associate-/r/82.1%
/-rgt-identity82.1%
*-commutative82.1%
*-commutative82.1%
*-commutative82.1%
associate-*r*83.6%
Simplified83.6%
if 1.05000000000000006e-21 < x Initial program 63.2%
*-commutative63.2%
/-rgt-identity63.2%
metadata-eval63.2%
associate-/l/63.2%
metadata-eval63.2%
/-rgt-identity63.2%
cos-neg63.2%
*-commutative63.2%
distribute-rgt-neg-in63.2%
metadata-eval63.2%
*-commutative63.2%
associate-*l*52.4%
unpow252.4%
Simplified52.4%
Taylor expanded in x around inf 52.5%
*-commutative52.5%
unpow252.5%
unpow252.5%
associate-*r*63.2%
*-commutative63.2%
unpow263.2%
associate-*r*66.4%
associate-*r*70.0%
*-commutative70.0%
unpow270.0%
associate-*l*80.8%
*-commutative80.8%
unpow280.8%
associate-*l*91.0%
*-commutative91.0%
associate-*l*94.4%
unpow294.4%
associate-*r*97.5%
*-commutative97.5%
Simplified97.5%
unpow297.5%
*-commutative97.5%
associate-*r*92.7%
Applied egg-rr92.7%
Final simplification85.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.05e-22)
(/ 1.0 (* c (* (* x s) (* c (* x s)))))
(/ (/ (cos (* x 2.0)) t_0) t_0))))x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double t_0 = s * (x * c);
double tmp;
if (x <= 2.05e-22) {
tmp = 1.0 / (c * ((x * s) * (c * (x * s))));
} else {
tmp = (cos((x * 2.0)) / t_0) / t_0;
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: t_0
real(8) :: tmp
t_0 = s * (x * c)
if (x <= 2.05d-22) then
tmp = 1.0d0 / (c * ((x * s) * (c * (x * s))))
else
tmp = (cos((x * 2.0d0)) / t_0) / t_0
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double t_0 = s * (x * c);
double tmp;
if (x <= 2.05e-22) {
tmp = 1.0 / (c * ((x * s) * (c * (x * s))));
} else {
tmp = (Math.cos((x * 2.0)) / t_0) / t_0;
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): t_0 = s * (x * c) tmp = 0 if x <= 2.05e-22: tmp = 1.0 / (c * ((x * s) * (c * (x * s)))) else: tmp = (math.cos((x * 2.0)) / t_0) / t_0 return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) t_0 = Float64(s * Float64(x * c)) tmp = 0.0 if (x <= 2.05e-22) tmp = Float64(1.0 / Float64(c * Float64(Float64(x * s) * Float64(c * Float64(x * s))))); else tmp = Float64(Float64(cos(Float64(x * 2.0)) / t_0) / t_0); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
t_0 = s * (x * c);
tmp = 0.0;
if (x <= 2.05e-22)
tmp = 1.0 / (c * ((x * s) * (c * (x * s))));
else
tmp = (cos((x * 2.0)) / t_0) / t_0;
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(s * N[(x * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.05e-22], N[(1.0 / N[(c * N[(N[(x * s), $MachinePrecision] * N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := s \cdot \left(x \cdot c\right)\\
\mathbf{if}\;x \leq 2.05 \cdot 10^{-22}:\\
\;\;\;\;\frac{1}{c \cdot \left(\left(x \cdot s\right) \cdot \left(c \cdot \left(x \cdot s\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cos \left(x \cdot 2\right)}{t_0}}{t_0}\\
\end{array}
\end{array}
if x < 2.05e-22Initial program 73.1%
Taylor expanded in x around 0 61.1%
unpow261.1%
unpow261.1%
associate-*r*66.3%
*-commutative66.3%
unpow266.3%
associate-*r*72.0%
associate-*r*73.6%
*-commutative73.6%
unpow273.6%
associate-*l*79.6%
*-commutative79.6%
unpow279.6%
associate-*l*83.6%
*-commutative83.6%
associate-*l*85.6%
unpow285.6%
associate-*r*86.0%
*-commutative86.0%
Simplified86.0%
unpow286.0%
associate-*r*84.4%
associate-*l*83.0%
Applied egg-rr83.0%
Taylor expanded in s around 0 82.2%
/-rgt-identity82.2%
associate-*r*84.1%
*-commutative84.1%
associate-*r*85.6%
associate-/l*85.6%
frac-2neg85.6%
metadata-eval85.6%
distribute-lft-neg-in85.6%
associate-/l/85.5%
div-inv85.5%
div-inv85.5%
associate-/l*83.5%
Applied egg-rr82.1%
associate-/l/82.1%
associate-/r/82.1%
/-rgt-identity82.1%
*-commutative82.1%
*-commutative82.1%
*-commutative82.1%
associate-*r*83.6%
Simplified83.6%
if 2.05e-22 < x Initial program 63.2%
Applied egg-rr80.5%
frac-times73.8%
*-un-lft-identity73.8%
unpow273.8%
associate-/l*73.7%
add-sqr-sqrt58.9%
sqrt-unprod32.4%
*-commutative32.4%
*-commutative32.4%
swap-sqr32.4%
metadata-eval32.4%
metadata-eval32.4%
swap-sqr32.4%
sqrt-unprod0.0%
add-sqr-sqrt73.7%
metadata-eval73.7%
pow-flip73.7%
associate-/l*73.8%
div-inv73.7%
Applied egg-rr97.5%
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 (if (<= x 5.1e-92) (/ 1.0 (* c (* (* x s) (* c (* x s))))) (/ (/ (/ (cos (* x 2.0)) s) (* x c)) (* s (* x c)))))
x = abs(x);
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
double tmp;
if (x <= 5.1e-92) {
tmp = 1.0 / (c * ((x * s) * (c * (x * s))));
} else {
tmp = ((cos((x * 2.0)) / s) / (x * c)) / (s * (x * c));
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
real(8) function code(x, c, s)
real(8), intent (in) :: x
real(8), intent (in) :: c
real(8), intent (in) :: s
real(8) :: tmp
if (x <= 5.1d-92) then
tmp = 1.0d0 / (c * ((x * s) * (c * (x * s))))
else
tmp = ((cos((x * 2.0d0)) / s) / (x * c)) / (s * (x * c))
end if
code = tmp
end function
x = Math.abs(x);
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
double tmp;
if (x <= 5.1e-92) {
tmp = 1.0 / (c * ((x * s) * (c * (x * s))));
} else {
tmp = ((Math.cos((x * 2.0)) / s) / (x * c)) / (s * (x * c));
}
return tmp;
}
x = abs(x) c = abs(c) s = abs(s) [c, s] = sort([c, s]) def code(x, c, s): tmp = 0 if x <= 5.1e-92: tmp = 1.0 / (c * ((x * s) * (c * (x * s)))) else: tmp = ((math.cos((x * 2.0)) / s) / (x * c)) / (s * (x * c)) return tmp
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) tmp = 0.0 if (x <= 5.1e-92) tmp = Float64(1.0 / Float64(c * Float64(Float64(x * s) * Float64(c * Float64(x * s))))); else tmp = Float64(Float64(Float64(cos(Float64(x * 2.0)) / s) / Float64(x * c)) / Float64(s * Float64(x * c))); end return tmp end
x = abs(x)
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
tmp = 0.0;
if (x <= 5.1e-92)
tmp = 1.0 / (c * ((x * s) * (c * (x * s))));
else
tmp = ((cos((x * 2.0)) / s) / (x * c)) / (s * (x * c));
end
tmp_2 = tmp;
end
NOTE: x should be positive before calling this function NOTE: c should be positive before calling this function NOTE: s should be positive before calling this function NOTE: c and s should be sorted in increasing order before calling this function. code[x_, c_, s_] := If[LessEqual[x, 5.1e-92], N[(1.0 / N[(c * N[(N[(x * s), $MachinePrecision] * N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Cos[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / s), $MachinePrecision] / N[(x * c), $MachinePrecision]), $MachinePrecision] / N[(s * N[(x * c), $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 5.1 \cdot 10^{-92}:\\
\;\;\;\;\frac{1}{c \cdot \left(\left(x \cdot s\right) \cdot \left(c \cdot \left(x \cdot s\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\cos \left(x \cdot 2\right)}{s}}{x \cdot c}}{s \cdot \left(x \cdot c\right)}\\
\end{array}
\end{array}
if x < 5.09999999999999972e-92Initial program 72.7%
Taylor expanded in x around 0 59.6%
unpow259.6%
unpow259.6%
associate-*r*65.3%
*-commutative65.3%
unpow265.3%
associate-*r*71.0%
associate-*r*72.2%
*-commutative72.2%
unpow272.2%
associate-*l*78.2%
*-commutative78.2%
unpow278.2%
associate-*l*82.1%
*-commutative82.1%
associate-*l*84.3%
unpow284.3%
associate-*r*84.7%
*-commutative84.7%
Simplified84.7%
unpow284.7%
associate-*r*83.0%
associate-*l*81.4%
Applied egg-rr81.4%
Taylor expanded in s around 0 80.5%
/-rgt-identity80.5%
associate-*r*82.6%
*-commutative82.6%
associate-*r*84.3%
associate-/l*84.3%
frac-2neg84.3%
metadata-eval84.3%
distribute-lft-neg-in84.3%
associate-/l/84.2%
div-inv84.1%
div-inv84.2%
associate-/l*82.0%
Applied egg-rr80.5%
associate-/l/80.5%
associate-/r/80.5%
/-rgt-identity80.5%
*-commutative80.5%
*-commutative80.5%
*-commutative80.5%
associate-*r*82.1%
Simplified82.1%
if 5.09999999999999972e-92 < x Initial program 66.5%
Applied egg-rr82.3%
frac-times74.6%
*-un-lft-identity74.6%
unpow274.6%
associate-/l*74.6%
add-sqr-sqrt63.2%
sqrt-unprod42.8%
*-commutative42.8%
*-commutative42.8%
swap-sqr42.8%
metadata-eval42.8%
metadata-eval42.8%
swap-sqr42.8%
sqrt-unprod0.0%
add-sqr-sqrt74.6%
metadata-eval74.6%
pow-flip74.6%
associate-/l*74.6%
div-inv74.6%
Applied egg-rr98.0%
*-un-lft-identity98.0%
*-commutative98.0%
times-frac98.1%
*-commutative98.1%
Applied egg-rr98.1%
associate-*l/98.1%
*-commutative98.1%
*-rgt-identity98.1%
*-commutative98.1%
Simplified98.1%
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 (if (<= x 2.25e+15) (pow (* c (* x s)) -2.0) (/ -1.0 (pow (* x (* c 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 (x <= 2.25e+15) {
tmp = pow((c * (x * s)), -2.0);
} else {
tmp = -1.0 / pow((x * (c * 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 (x <= 2.25d+15) then
tmp = (c * (x * s)) ** (-2.0d0)
else
tmp = (-1.0d0) / ((x * (c * 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 (x <= 2.25e+15) {
tmp = Math.pow((c * (x * s)), -2.0);
} else {
tmp = -1.0 / Math.pow((x * (c * 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 x <= 2.25e+15: tmp = math.pow((c * (x * s)), -2.0) else: tmp = -1.0 / math.pow((x * (c * 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 (x <= 2.25e+15) tmp = Float64(c * Float64(x * s)) ^ -2.0; else tmp = Float64(-1.0 / (Float64(x * Float64(c * 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 (x <= 2.25e+15)
tmp = (c * (x * s)) ^ -2.0;
else
tmp = -1.0 / ((x * (c * 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[x, 2.25e+15], N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(-1.0 / N[Power[N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.25 \cdot 10^{+15}:\\
\;\;\;\;{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{{\left(x \cdot \left(c \cdot s\right)\right)}^{2}}\\
\end{array}
\end{array}
if x < 2.25e15Initial program 73.3%
Taylor expanded in x around 0 60.7%
unpow260.7%
unpow260.7%
associate-*r*65.8%
*-commutative65.8%
unpow265.8%
associate-*r*71.3%
associate-*r*72.9%
*-commutative72.9%
unpow272.9%
associate-*l*78.7%
*-commutative78.7%
unpow278.7%
associate-*l*82.8%
*-commutative82.8%
associate-*l*84.7%
unpow284.7%
associate-*r*85.0%
*-commutative85.0%
Simplified85.0%
expm1-log1p-u83.9%
expm1-udef74.8%
pow-flip74.8%
metadata-eval74.8%
Applied egg-rr74.8%
expm1-def83.9%
expm1-log1p85.0%
associate-*r*84.5%
*-commutative84.5%
associate-*r*84.7%
Simplified84.7%
if 2.25e15 < x Initial program 61.5%
Taylor expanded in x around 0 42.8%
unpow242.8%
unpow242.8%
associate-*r*46.1%
*-commutative46.1%
unpow246.1%
associate-*r*46.3%
associate-*r*46.7%
*-commutative46.7%
unpow246.7%
associate-*l*48.3%
*-commutative48.3%
unpow248.3%
associate-*l*49.5%
*-commutative49.5%
associate-*l*49.4%
unpow249.4%
associate-*r*49.1%
*-commutative49.1%
Simplified49.1%
add-sqr-sqrt49.1%
sqrt-div49.1%
metadata-eval49.1%
unpow249.1%
sqrt-prod30.7%
add-sqr-sqrt45.3%
sqrt-div45.3%
metadata-eval45.3%
unpow245.3%
sqrt-prod30.7%
add-sqr-sqrt49.1%
Applied egg-rr49.1%
unpow249.1%
associate-/r*49.1%
associate-/l/49.4%
associate-/r*49.4%
Simplified49.4%
associate-/r*49.4%
associate-/l/49.1%
associate-/r*49.1%
inv-pow49.1%
metadata-eval49.1%
*-commutative49.1%
unpow-prod-down49.1%
metadata-eval49.1%
inv-pow49.1%
metadata-eval49.1%
metadata-eval49.1%
metadata-eval49.1%
sqrt-pow147.8%
pow-flip47.6%
*-commutative47.6%
sqrt-div47.6%
metadata-eval47.6%
unpow247.6%
sqrt-prod21.5%
add-sqr-sqrt49.1%
Applied egg-rr49.1%
*-commutative49.1%
associate-*r/49.1%
*-rgt-identity49.1%
*-commutative49.1%
Simplified49.1%
unpow249.1%
associate-/r*49.1%
associate-*r*47.9%
*-commutative47.9%
associate-*r*49.2%
frac-2neg49.2%
metadata-eval49.2%
distribute-lft-neg-in49.2%
associate-/l/49.2%
associate-/r*49.2%
associate-*r*48.3%
*-commutative48.3%
associate-*r*49.4%
times-frac48.9%
*-un-lft-identity48.9%
associate-/l/48.9%
Applied egg-rr45.2%
Final simplification76.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 (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 70.9%
Taylor expanded in x around 0 57.1%
unpow257.1%
unpow257.1%
associate-*r*61.8%
*-commutative61.8%
unpow261.8%
associate-*r*66.4%
associate-*r*67.7%
*-commutative67.7%
unpow267.7%
associate-*l*72.7%
*-commutative72.7%
unpow272.7%
associate-*l*76.1%
*-commutative76.1%
associate-*l*77.7%
unpow277.7%
associate-*r*77.9%
*-commutative77.9%
Simplified77.9%
expm1-log1p-u77.0%
expm1-udef69.5%
pow-flip69.5%
metadata-eval69.5%
Applied egg-rr69.5%
expm1-def77.0%
expm1-log1p77.9%
associate-*r*77.3%
*-commutative77.3%
associate-*r*77.7%
Simplified77.7%
Final simplification77.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 (/ (/ (/ (/ -1.0 c) (* x s)) -1.0) (* 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 / c) / (x * s)) / -1.0) / (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) / c) / (x * s)) / (-1.0d0)) / (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 / c) / (x * s)) / -1.0) / (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 / c) / (x * s)) / -1.0) / (c * (x * s))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(Float64(Float64(-1.0 / c) / Float64(x * s)) / -1.0) / 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 / c) / (x * s)) / -1.0) / (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[(N[(N[(N[(-1.0 / c), $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision] / -1.0), $MachinePrecision] / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\frac{\frac{\frac{-1}{c}}{x \cdot s}}{-1}}{c \cdot \left(x \cdot s\right)}
\end{array}
Initial program 70.9%
Taylor expanded in x around 0 57.1%
unpow257.1%
unpow257.1%
associate-*r*61.8%
*-commutative61.8%
unpow261.8%
associate-*r*66.4%
associate-*r*67.7%
*-commutative67.7%
unpow267.7%
associate-*l*72.7%
*-commutative72.7%
unpow272.7%
associate-*l*76.1%
*-commutative76.1%
associate-*l*77.7%
unpow277.7%
associate-*r*77.9%
*-commutative77.9%
Simplified77.9%
add-sqr-sqrt77.9%
sqrt-div77.9%
metadata-eval77.9%
unpow277.9%
sqrt-prod43.4%
add-sqr-sqrt54.3%
sqrt-div54.3%
metadata-eval54.3%
unpow254.3%
sqrt-prod36.3%
add-sqr-sqrt77.9%
Applied egg-rr77.9%
unpow277.9%
associate-/r*77.9%
associate-/l/77.5%
associate-/r*77.5%
Simplified77.5%
unpow277.5%
frac-2neg77.5%
associate-/r*77.6%
associate-/l/76.8%
associate-/r*76.8%
frac-times73.3%
*-un-lft-identity73.3%
distribute-neg-frac73.3%
metadata-eval73.3%
*-commutative73.3%
associate-*r*73.7%
*-commutative73.7%
Applied egg-rr73.7%
*-commutative73.7%
associate-/r*76.2%
*-rgt-identity76.2%
*-rgt-identity76.2%
metadata-eval76.2%
distribute-neg-frac76.2%
associate-/l/76.2%
associate-/l/76.2%
distribute-neg-frac76.2%
metadata-eval76.2%
*-commutative76.2%
*-commutative76.2%
*-commutative76.2%
associate-*r*77.6%
Simplified77.6%
add-sqr-sqrt40.3%
neg-mul-140.3%
times-frac40.3%
associate-/r*39.5%
associate-/r*39.5%
Applied egg-rr39.5%
associate-*l/39.5%
Simplified77.7%
Final simplification77.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 (/ (/ (/ -1.0 (* x s)) (- c)) (* 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 * s)) / -c) / (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 * s)) / -c) / (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 * s)) / -c) / (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 * s)) / -c) / (c * (x * s))
x = abs(x) c = abs(c) s = abs(s) c, s = sort([c, s]) function code(x, c, s) return Float64(Float64(Float64(-1.0 / Float64(x * s)) / Float64(-c)) / 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 * s)) / -c) / (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[(N[(N[(-1.0 / N[(x * s), $MachinePrecision]), $MachinePrecision] / (-c)), $MachinePrecision] / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\frac{\frac{-1}{x \cdot s}}{-c}}{c \cdot \left(x \cdot s\right)}
\end{array}
Initial program 70.9%
Taylor expanded in x around 0 57.1%
unpow257.1%
unpow257.1%
associate-*r*61.8%
*-commutative61.8%
unpow261.8%
associate-*r*66.4%
associate-*r*67.7%
*-commutative67.7%
unpow267.7%
associate-*l*72.7%
*-commutative72.7%
unpow272.7%
associate-*l*76.1%
*-commutative76.1%
associate-*l*77.7%
unpow277.7%
associate-*r*77.9%
*-commutative77.9%
Simplified77.9%
add-sqr-sqrt77.9%
sqrt-div77.9%
metadata-eval77.9%
unpow277.9%
sqrt-prod43.4%
add-sqr-sqrt54.3%
sqrt-div54.3%
metadata-eval54.3%
unpow254.3%
sqrt-prod36.3%
add-sqr-sqrt77.9%
Applied egg-rr77.9%
unpow277.9%
associate-/r*77.9%
associate-/l/77.5%
associate-/r*77.5%
Simplified77.5%
unpow277.5%
frac-2neg77.5%
associate-/r*77.6%
associate-/l/76.8%
associate-/r*76.8%
frac-times73.3%
*-un-lft-identity73.3%
distribute-neg-frac73.3%
metadata-eval73.3%
*-commutative73.3%
associate-*r*73.7%
*-commutative73.7%
Applied egg-rr73.7%
*-commutative73.7%
associate-/r*76.2%
*-rgt-identity76.2%
*-rgt-identity76.2%
metadata-eval76.2%
distribute-neg-frac76.2%
associate-/l/76.2%
associate-/l/76.2%
distribute-neg-frac76.2%
metadata-eval76.2%
*-commutative76.2%
*-commutative76.2%
*-commutative76.2%
associate-*r*77.6%
Simplified77.6%
Final simplification77.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 (/ 1.0 (* c (* (* x 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 / (c * ((x * 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 / (c * ((x * 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 / (c * ((x * 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 / (c * ((x * 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(c * Float64(Float64(x * 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 / (c * ((x * 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[(c * N[(N[(x * s), $MachinePrecision] * 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}{c \cdot \left(\left(x \cdot s\right) \cdot \left(c \cdot \left(x \cdot s\right)\right)\right)}
\end{array}
Initial program 70.9%
Taylor expanded in x around 0 57.1%
unpow257.1%
unpow257.1%
associate-*r*61.8%
*-commutative61.8%
unpow261.8%
associate-*r*66.4%
associate-*r*67.7%
*-commutative67.7%
unpow267.7%
associate-*l*72.7%
*-commutative72.7%
unpow272.7%
associate-*l*76.1%
*-commutative76.1%
associate-*l*77.7%
unpow277.7%
associate-*r*77.9%
*-commutative77.9%
Simplified77.9%
unpow277.9%
associate-*r*76.4%
associate-*l*75.2%
Applied egg-rr75.2%
Taylor expanded in s around 0 74.7%
/-rgt-identity74.7%
associate-*r*76.3%
*-commutative76.3%
associate-*r*77.7%
associate-/l*77.7%
frac-2neg77.7%
metadata-eval77.7%
distribute-lft-neg-in77.7%
associate-/l/77.6%
div-inv77.6%
div-inv77.6%
associate-/l*76.1%
Applied egg-rr74.7%
associate-/l/74.7%
associate-/r/74.7%
/-rgt-identity74.7%
*-commutative74.7%
*-commutative74.7%
*-commutative74.7%
associate-*r*76.1%
Simplified76.1%
Final simplification76.1%
herbie shell --seed 2023301
(FPCore (x c s)
:name "mixedcos"
:precision binary64
(/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))