
(FPCore (a b) :precision binary64 (* (* (/ PI 2.0) (/ 1.0 (- (* b b) (* a a)))) (- (/ 1.0 a) (/ 1.0 b))))
double code(double a, double b) {
return ((((double) M_PI) / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b));
}
public static double code(double a, double b) {
return ((Math.PI / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b));
}
def code(a, b): return ((math.pi / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b))
function code(a, b) return Float64(Float64(Float64(pi / 2.0) * Float64(1.0 / Float64(Float64(b * b) - Float64(a * a)))) * Float64(Float64(1.0 / a) - Float64(1.0 / b))) end
function tmp = code(a, b) tmp = ((pi / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b)); end
code[a_, b_] := N[(N[(N[(Pi / 2.0), $MachinePrecision] * N[(1.0 / N[(N[(b * b), $MachinePrecision] - N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / a), $MachinePrecision] - N[(1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b) :precision binary64 (* (* (/ PI 2.0) (/ 1.0 (- (* b b) (* a a)))) (- (/ 1.0 a) (/ 1.0 b))))
double code(double a, double b) {
return ((((double) M_PI) / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b));
}
public static double code(double a, double b) {
return ((Math.PI / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b));
}
def code(a, b): return ((math.pi / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b))
function code(a, b) return Float64(Float64(Float64(pi / 2.0) * Float64(1.0 / Float64(Float64(b * b) - Float64(a * a)))) * Float64(Float64(1.0 / a) - Float64(1.0 / b))) end
function tmp = code(a, b) tmp = ((pi / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b)); end
code[a_, b_] := N[(N[(N[(Pi / 2.0), $MachinePrecision] * N[(1.0 / N[(N[(b * b), $MachinePrecision] - N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / a), $MachinePrecision] - N[(1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right)
\end{array}
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -5e+104) (/ (* 0.5 (/ PI a)) (* a b)) (* (/ 0.5 (* a (+ a b))) (/ PI b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -5e+104) {
tmp = (0.5 * (((double) M_PI) / a)) / (a * b);
} else {
tmp = (0.5 / (a * (a + b))) * (((double) M_PI) / b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -5e+104) {
tmp = (0.5 * (Math.PI / a)) / (a * b);
} else {
tmp = (0.5 / (a * (a + b))) * (Math.PI / b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -5e+104: tmp = (0.5 * (math.pi / a)) / (a * b) else: tmp = (0.5 / (a * (a + b))) * (math.pi / b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -5e+104) tmp = Float64(Float64(0.5 * Float64(pi / a)) / Float64(a * b)); else tmp = Float64(Float64(0.5 / Float64(a * Float64(a + b))) * Float64(pi / b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -5e+104)
tmp = (0.5 * (pi / a)) / (a * b);
else
tmp = (0.5 / (a * (a + b))) * (pi / b);
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[a, -5e+104], N[(N[(0.5 * N[(Pi / a), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / N[(a * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(Pi / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5 \cdot 10^{+104}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{a \cdot \left(a + b\right)} \cdot \frac{\pi}{b}\\
\end{array}
\end{array}
if a < -4.9999999999999997e104Initial program 78.2%
associate-*l*78.2%
*-rgt-identity78.2%
associate-/l*78.2%
metadata-eval78.2%
associate-*l/78.2%
*-lft-identity78.2%
sub-neg78.2%
distribute-neg-frac78.2%
metadata-eval78.2%
Simplified78.2%
metadata-eval78.2%
div-inv78.2%
clear-num78.2%
clear-num78.2%
frac-times78.2%
metadata-eval78.2%
frac-add78.1%
associate-/r/78.1%
*-un-lft-identity78.1%
*-commutative78.1%
neg-mul-178.1%
sub-neg78.1%
flip-+99.7%
+-commutative99.7%
Applied egg-rr99.7%
inv-pow99.7%
associate-*r*99.8%
unpow-prod-down99.7%
pow-prod-down99.8%
inv-pow99.8%
inv-pow99.8%
frac-times99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-*r/99.8%
*-rgt-identity99.8%
unpow-199.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in a around inf 100.0%
if -4.9999999999999997e104 < a Initial program 78.3%
associate-*l*78.3%
*-rgt-identity78.3%
associate-/l*78.3%
metadata-eval78.3%
associate-*l/78.3%
*-lft-identity78.3%
sub-neg78.3%
distribute-neg-frac78.3%
metadata-eval78.3%
Simplified78.3%
metadata-eval78.3%
div-inv78.3%
clear-num78.3%
clear-num78.0%
frac-times78.0%
metadata-eval78.0%
frac-add78.0%
associate-/r/78.0%
*-un-lft-identity78.0%
*-commutative78.0%
neg-mul-178.0%
sub-neg78.0%
flip-+98.9%
+-commutative98.9%
Applied egg-rr98.9%
associate-*l/98.9%
clear-num98.9%
*-un-lft-identity98.9%
times-frac98.9%
metadata-eval98.9%
metadata-eval98.9%
times-frac98.9%
*-un-lft-identity98.9%
associate-*r*93.7%
times-frac94.3%
Applied egg-rr94.3%
Final simplification95.2%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -1e+108) (/ (* 0.5 (/ PI a)) (* a b)) (* (/ 0.5 b) (/ (/ PI a) (+ a b)))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -1e+108) {
tmp = (0.5 * (((double) M_PI) / a)) / (a * b);
} else {
tmp = (0.5 / b) * ((((double) M_PI) / a) / (a + b));
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -1e+108) {
tmp = (0.5 * (Math.PI / a)) / (a * b);
} else {
tmp = (0.5 / b) * ((Math.PI / a) / (a + b));
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -1e+108: tmp = (0.5 * (math.pi / a)) / (a * b) else: tmp = (0.5 / b) * ((math.pi / a) / (a + b)) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -1e+108) tmp = Float64(Float64(0.5 * Float64(pi / a)) / Float64(a * b)); else tmp = Float64(Float64(0.5 / b) * Float64(Float64(pi / a) / Float64(a + b))); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -1e+108)
tmp = (0.5 * (pi / a)) / (a * b);
else
tmp = (0.5 / b) * ((pi / a) / (a + b));
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[a, -1e+108], N[(N[(0.5 * N[(Pi / a), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / b), $MachinePrecision] * N[(N[(Pi / a), $MachinePrecision] / N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{+108}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{b} \cdot \frac{\frac{\pi}{a}}{a + b}\\
\end{array}
\end{array}
if a < -1e108Initial program 77.6%
associate-*l*77.6%
*-rgt-identity77.6%
associate-/l*77.6%
metadata-eval77.6%
associate-*l/77.6%
*-lft-identity77.6%
sub-neg77.6%
distribute-neg-frac77.6%
metadata-eval77.6%
Simplified77.6%
metadata-eval77.6%
div-inv77.6%
clear-num77.6%
clear-num77.6%
frac-times77.6%
metadata-eval77.6%
frac-add77.6%
associate-/r/77.6%
*-un-lft-identity77.6%
*-commutative77.6%
neg-mul-177.6%
sub-neg77.6%
flip-+99.8%
+-commutative99.8%
Applied egg-rr99.8%
inv-pow99.8%
associate-*r*99.8%
unpow-prod-down99.8%
pow-prod-down99.8%
inv-pow99.8%
inv-pow99.8%
frac-times99.8%
metadata-eval99.8%
Applied egg-rr99.8%
associate-*r/99.9%
*-rgt-identity99.9%
unpow-199.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in a around inf 100.0%
if -1e108 < a Initial program 78.4%
associate-*l*78.4%
*-rgt-identity78.4%
associate-/l*78.4%
metadata-eval78.4%
associate-*l/78.4%
*-lft-identity78.4%
sub-neg78.4%
distribute-neg-frac78.4%
metadata-eval78.4%
Simplified78.4%
metadata-eval78.4%
div-inv78.4%
clear-num78.4%
clear-num78.1%
frac-times78.1%
metadata-eval78.1%
frac-add78.1%
associate-/r/78.1%
*-un-lft-identity78.1%
*-commutative78.1%
neg-mul-178.1%
sub-neg78.1%
flip-+98.9%
+-commutative98.9%
Applied egg-rr98.9%
associate-*l/98.9%
clear-num98.9%
*-un-lft-identity98.9%
times-frac98.9%
metadata-eval98.9%
metadata-eval98.9%
times-frac98.9%
*-un-lft-identity98.9%
*-commutative98.9%
*-un-lft-identity98.9%
associate-*r*93.8%
times-frac94.3%
Applied egg-rr94.3%
associate-*l/94.5%
*-commutative94.5%
associate-*r/94.5%
*-lft-identity94.5%
associate-*r/94.5%
*-commutative94.5%
associate-/l*94.3%
metadata-eval94.3%
associate-*r/94.3%
associate-*l/94.3%
*-commutative94.3%
associate-*r/94.3%
metadata-eval94.3%
associate-/l/95.2%
Simplified95.2%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -3.1e-27) (/ (* 0.5 (/ PI a)) (* a b)) (/ (* 0.5 (/ PI b)) (* a b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -3.1e-27) {
tmp = (0.5 * (((double) M_PI) / a)) / (a * b);
} else {
tmp = (0.5 * (((double) M_PI) / b)) / (a * b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -3.1e-27) {
tmp = (0.5 * (Math.PI / a)) / (a * b);
} else {
tmp = (0.5 * (Math.PI / b)) / (a * b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -3.1e-27: tmp = (0.5 * (math.pi / a)) / (a * b) else: tmp = (0.5 * (math.pi / b)) / (a * b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -3.1e-27) tmp = Float64(Float64(0.5 * Float64(pi / a)) / Float64(a * b)); else tmp = Float64(Float64(0.5 * Float64(pi / b)) / Float64(a * b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -3.1e-27)
tmp = (0.5 * (pi / a)) / (a * b);
else
tmp = (0.5 * (pi / b)) / (a * b);
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[a, -3.1e-27], N[(N[(0.5 * N[(Pi / a), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(Pi / b), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.1 \cdot 10^{-27}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{b}}{a \cdot b}\\
\end{array}
\end{array}
if a < -3.0999999999999998e-27Initial program 86.4%
associate-*l*86.3%
*-rgt-identity86.3%
associate-/l*86.3%
metadata-eval86.3%
associate-*l/86.3%
*-lft-identity86.3%
sub-neg86.3%
distribute-neg-frac86.3%
metadata-eval86.3%
Simplified86.3%
metadata-eval86.3%
div-inv86.3%
clear-num86.3%
clear-num86.3%
frac-times86.4%
metadata-eval86.4%
frac-add86.5%
associate-/r/86.4%
*-un-lft-identity86.4%
*-commutative86.4%
neg-mul-186.4%
sub-neg86.4%
flip-+99.7%
+-commutative99.7%
Applied egg-rr99.7%
inv-pow99.7%
associate-*r*99.7%
unpow-prod-down99.7%
pow-prod-down99.7%
inv-pow99.7%
inv-pow99.7%
frac-times99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-*r/99.8%
*-rgt-identity99.8%
unpow-199.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in a around inf 86.1%
if -3.0999999999999998e-27 < a Initial program 75.5%
associate-*l*75.5%
*-rgt-identity75.5%
associate-/l*75.5%
metadata-eval75.5%
associate-*l/75.6%
*-lft-identity75.6%
sub-neg75.6%
distribute-neg-frac75.6%
metadata-eval75.6%
Simplified75.6%
metadata-eval75.6%
div-inv75.6%
clear-num75.6%
clear-num75.2%
frac-times75.2%
metadata-eval75.2%
frac-add75.1%
associate-/r/75.2%
*-un-lft-identity75.2%
*-commutative75.2%
neg-mul-175.2%
sub-neg75.2%
flip-+98.8%
+-commutative98.8%
Applied egg-rr98.8%
inv-pow98.8%
associate-*r*98.8%
unpow-prod-down99.5%
pow-prod-down99.5%
inv-pow99.5%
inv-pow99.5%
frac-times99.5%
metadata-eval99.5%
Applied egg-rr99.5%
associate-*r/99.5%
*-rgt-identity99.5%
unpow-199.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in a around 0 70.3%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -5.9e-27) (/ (* 0.5 (/ PI a)) (* a b)) (* (/ PI (* a b)) (/ 0.5 b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -5.9e-27) {
tmp = (0.5 * (((double) M_PI) / a)) / (a * b);
} else {
tmp = (((double) M_PI) / (a * b)) * (0.5 / b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -5.9e-27) {
tmp = (0.5 * (Math.PI / a)) / (a * b);
} else {
tmp = (Math.PI / (a * b)) * (0.5 / b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -5.9e-27: tmp = (0.5 * (math.pi / a)) / (a * b) else: tmp = (math.pi / (a * b)) * (0.5 / b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -5.9e-27) tmp = Float64(Float64(0.5 * Float64(pi / a)) / Float64(a * b)); else tmp = Float64(Float64(pi / Float64(a * b)) * Float64(0.5 / b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -5.9e-27)
tmp = (0.5 * (pi / a)) / (a * b);
else
tmp = (pi / (a * b)) * (0.5 / b);
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[a, -5.9e-27], N[(N[(0.5 * N[(Pi / a), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(Pi / N[(a * b), $MachinePrecision]), $MachinePrecision] * N[(0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.9 \cdot 10^{-27}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi}{a \cdot b} \cdot \frac{0.5}{b}\\
\end{array}
\end{array}
if a < -5.8999999999999998e-27Initial program 86.4%
associate-*l*86.3%
*-rgt-identity86.3%
associate-/l*86.3%
metadata-eval86.3%
associate-*l/86.3%
*-lft-identity86.3%
sub-neg86.3%
distribute-neg-frac86.3%
metadata-eval86.3%
Simplified86.3%
metadata-eval86.3%
div-inv86.3%
clear-num86.3%
clear-num86.3%
frac-times86.4%
metadata-eval86.4%
frac-add86.5%
associate-/r/86.4%
*-un-lft-identity86.4%
*-commutative86.4%
neg-mul-186.4%
sub-neg86.4%
flip-+99.7%
+-commutative99.7%
Applied egg-rr99.7%
inv-pow99.7%
associate-*r*99.7%
unpow-prod-down99.7%
pow-prod-down99.7%
inv-pow99.7%
inv-pow99.7%
frac-times99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-*r/99.8%
*-rgt-identity99.8%
unpow-199.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in a around inf 86.1%
if -5.8999999999999998e-27 < a Initial program 75.5%
associate-*l*75.5%
*-rgt-identity75.5%
associate-/l*75.5%
metadata-eval75.5%
associate-*l/75.6%
*-lft-identity75.6%
sub-neg75.6%
distribute-neg-frac75.6%
metadata-eval75.6%
Simplified75.6%
metadata-eval75.6%
div-inv75.6%
clear-num75.6%
clear-num75.2%
frac-times75.2%
metadata-eval75.2%
frac-add75.1%
associate-/r/75.2%
*-un-lft-identity75.2%
*-commutative75.2%
neg-mul-175.2%
sub-neg75.2%
flip-+98.8%
+-commutative98.8%
Applied egg-rr98.8%
associate-*l/98.8%
clear-num98.8%
*-un-lft-identity98.8%
times-frac98.8%
metadata-eval98.8%
metadata-eval98.8%
times-frac98.8%
*-un-lft-identity98.8%
*-commutative98.8%
*-commutative98.8%
times-frac99.5%
Applied egg-rr99.5%
Taylor expanded in a around 0 70.2%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -3.1e-27) (/ 0.5 (/ (* a (* a b)) PI)) (* (/ PI (* a b)) (/ 0.5 b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -3.1e-27) {
tmp = 0.5 / ((a * (a * b)) / ((double) M_PI));
} else {
tmp = (((double) M_PI) / (a * b)) * (0.5 / b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -3.1e-27) {
tmp = 0.5 / ((a * (a * b)) / Math.PI);
} else {
tmp = (Math.PI / (a * b)) * (0.5 / b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -3.1e-27: tmp = 0.5 / ((a * (a * b)) / math.pi) else: tmp = (math.pi / (a * b)) * (0.5 / b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -3.1e-27) tmp = Float64(0.5 / Float64(Float64(a * Float64(a * b)) / pi)); else tmp = Float64(Float64(pi / Float64(a * b)) * Float64(0.5 / b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -3.1e-27)
tmp = 0.5 / ((a * (a * b)) / pi);
else
tmp = (pi / (a * b)) * (0.5 / b);
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[a, -3.1e-27], N[(0.5 / N[(N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(Pi / N[(a * b), $MachinePrecision]), $MachinePrecision] * N[(0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.1 \cdot 10^{-27}:\\
\;\;\;\;\frac{0.5}{\frac{a \cdot \left(a \cdot b\right)}{\pi}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi}{a \cdot b} \cdot \frac{0.5}{b}\\
\end{array}
\end{array}
if a < -3.0999999999999998e-27Initial program 86.4%
associate-*l*86.3%
*-rgt-identity86.3%
associate-/l*86.3%
metadata-eval86.3%
associate-*l/86.3%
*-lft-identity86.3%
sub-neg86.3%
distribute-neg-frac86.3%
metadata-eval86.3%
Simplified86.3%
metadata-eval86.3%
div-inv86.3%
clear-num86.3%
clear-num86.3%
frac-times86.4%
metadata-eval86.4%
frac-add86.5%
associate-/r/86.4%
*-un-lft-identity86.4%
*-commutative86.4%
neg-mul-186.4%
sub-neg86.4%
flip-+99.7%
+-commutative99.7%
Applied egg-rr99.7%
inv-pow99.7%
associate-*l/99.7%
*-un-lft-identity99.7%
times-frac99.7%
metadata-eval99.7%
Applied egg-rr99.7%
unpow-199.7%
associate-/r*99.7%
metadata-eval99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in a around inf 86.0%
if -3.0999999999999998e-27 < a Initial program 75.5%
associate-*l*75.5%
*-rgt-identity75.5%
associate-/l*75.5%
metadata-eval75.5%
associate-*l/75.6%
*-lft-identity75.6%
sub-neg75.6%
distribute-neg-frac75.6%
metadata-eval75.6%
Simplified75.6%
metadata-eval75.6%
div-inv75.6%
clear-num75.6%
clear-num75.2%
frac-times75.2%
metadata-eval75.2%
frac-add75.1%
associate-/r/75.2%
*-un-lft-identity75.2%
*-commutative75.2%
neg-mul-175.2%
sub-neg75.2%
flip-+98.8%
+-commutative98.8%
Applied egg-rr98.8%
associate-*l/98.8%
clear-num98.8%
*-un-lft-identity98.8%
times-frac98.8%
metadata-eval98.8%
metadata-eval98.8%
times-frac98.8%
*-un-lft-identity98.8%
*-commutative98.8%
*-commutative98.8%
times-frac99.5%
Applied egg-rr99.5%
Taylor expanded in a around 0 70.2%
Final simplification74.2%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -5e-27) (* PI (/ 0.5 (* a (* a b)))) (* (/ PI (* a b)) (/ 0.5 b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -5e-27) {
tmp = ((double) M_PI) * (0.5 / (a * (a * b)));
} else {
tmp = (((double) M_PI) / (a * b)) * (0.5 / b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -5e-27) {
tmp = Math.PI * (0.5 / (a * (a * b)));
} else {
tmp = (Math.PI / (a * b)) * (0.5 / b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -5e-27: tmp = math.pi * (0.5 / (a * (a * b))) else: tmp = (math.pi / (a * b)) * (0.5 / b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -5e-27) tmp = Float64(pi * Float64(0.5 / Float64(a * Float64(a * b)))); else tmp = Float64(Float64(pi / Float64(a * b)) * Float64(0.5 / b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -5e-27)
tmp = pi * (0.5 / (a * (a * b)));
else
tmp = (pi / (a * b)) * (0.5 / b);
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[a, -5e-27], N[(Pi * N[(0.5 / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi / N[(a * b), $MachinePrecision]), $MachinePrecision] * N[(0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5 \cdot 10^{-27}:\\
\;\;\;\;\pi \cdot \frac{0.5}{a \cdot \left(a \cdot b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi}{a \cdot b} \cdot \frac{0.5}{b}\\
\end{array}
\end{array}
if a < -5.0000000000000002e-27Initial program 86.4%
*-commutative86.4%
associate-*r*86.4%
associate-*r/86.4%
associate-*r*86.4%
*-rgt-identity86.4%
sub-neg86.4%
distribute-neg-frac86.4%
metadata-eval86.4%
Simplified86.4%
*-commutative86.4%
associate-*r/86.3%
div-inv86.3%
metadata-eval86.3%
associate-*l*86.3%
*-commutative86.3%
Applied egg-rr99.6%
Taylor expanded in a around inf 85.9%
if -5.0000000000000002e-27 < a Initial program 75.5%
associate-*l*75.5%
*-rgt-identity75.5%
associate-/l*75.5%
metadata-eval75.5%
associate-*l/75.6%
*-lft-identity75.6%
sub-neg75.6%
distribute-neg-frac75.6%
metadata-eval75.6%
Simplified75.6%
metadata-eval75.6%
div-inv75.6%
clear-num75.6%
clear-num75.2%
frac-times75.2%
metadata-eval75.2%
frac-add75.1%
associate-/r/75.2%
*-un-lft-identity75.2%
*-commutative75.2%
neg-mul-175.2%
sub-neg75.2%
flip-+98.8%
+-commutative98.8%
Applied egg-rr98.8%
associate-*l/98.8%
clear-num98.8%
*-un-lft-identity98.8%
times-frac98.8%
metadata-eval98.8%
metadata-eval98.8%
times-frac98.8%
*-un-lft-identity98.8%
*-commutative98.8%
*-commutative98.8%
times-frac99.5%
Applied egg-rr99.5%
Taylor expanded in a around 0 70.2%
Final simplification74.2%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -5.4e-27) (* PI (/ 0.5 (* a (* a b)))) (* (/ 0.5 b) (/ (/ PI a) b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -5.4e-27) {
tmp = ((double) M_PI) * (0.5 / (a * (a * b)));
} else {
tmp = (0.5 / b) * ((((double) M_PI) / a) / b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -5.4e-27) {
tmp = Math.PI * (0.5 / (a * (a * b)));
} else {
tmp = (0.5 / b) * ((Math.PI / a) / b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -5.4e-27: tmp = math.pi * (0.5 / (a * (a * b))) else: tmp = (0.5 / b) * ((math.pi / a) / b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -5.4e-27) tmp = Float64(pi * Float64(0.5 / Float64(a * Float64(a * b)))); else tmp = Float64(Float64(0.5 / b) * Float64(Float64(pi / a) / b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -5.4e-27)
tmp = pi * (0.5 / (a * (a * b)));
else
tmp = (0.5 / b) * ((pi / a) / b);
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[a, -5.4e-27], N[(Pi * N[(0.5 / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / b), $MachinePrecision] * N[(N[(Pi / a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.4 \cdot 10^{-27}:\\
\;\;\;\;\pi \cdot \frac{0.5}{a \cdot \left(a \cdot b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{b} \cdot \frac{\frac{\pi}{a}}{b}\\
\end{array}
\end{array}
if a < -5.39999999999999978e-27Initial program 86.4%
*-commutative86.4%
associate-*r*86.4%
associate-*r/86.4%
associate-*r*86.4%
*-rgt-identity86.4%
sub-neg86.4%
distribute-neg-frac86.4%
metadata-eval86.4%
Simplified86.4%
*-commutative86.4%
associate-*r/86.3%
div-inv86.3%
metadata-eval86.3%
associate-*l*86.3%
*-commutative86.3%
Applied egg-rr99.6%
Taylor expanded in a around inf 85.9%
if -5.39999999999999978e-27 < a Initial program 75.5%
associate-*l*75.5%
*-rgt-identity75.5%
associate-/l*75.5%
metadata-eval75.5%
associate-*l/75.6%
*-lft-identity75.6%
sub-neg75.6%
distribute-neg-frac75.6%
metadata-eval75.6%
Simplified75.6%
metadata-eval75.6%
div-inv75.6%
clear-num75.6%
clear-num75.2%
frac-times75.2%
metadata-eval75.2%
frac-add75.1%
associate-/r/75.2%
*-un-lft-identity75.2%
*-commutative75.2%
neg-mul-175.2%
sub-neg75.2%
flip-+98.8%
+-commutative98.8%
Applied egg-rr98.8%
associate-*l/98.8%
clear-num98.8%
*-un-lft-identity98.8%
times-frac98.8%
metadata-eval98.8%
metadata-eval98.8%
times-frac98.8%
*-un-lft-identity98.8%
*-commutative98.8%
*-un-lft-identity98.8%
associate-*r*93.0%
times-frac93.6%
Applied egg-rr93.6%
associate-*l/93.8%
*-commutative93.8%
associate-*r/93.8%
*-lft-identity93.8%
associate-*r/93.8%
*-commutative93.8%
associate-/l*93.6%
metadata-eval93.6%
associate-*r/93.6%
associate-*l/93.6%
*-commutative93.6%
associate-*r/93.6%
metadata-eval93.6%
associate-/l/94.6%
Simplified94.6%
Taylor expanded in a around 0 70.2%
associate-/r*70.2%
Simplified70.2%
Final simplification74.2%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -5.9e-27) (* (/ 0.5 b) (/ (/ PI a) a)) (* (/ 0.5 b) (/ (/ PI a) b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -5.9e-27) {
tmp = (0.5 / b) * ((((double) M_PI) / a) / a);
} else {
tmp = (0.5 / b) * ((((double) M_PI) / a) / b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -5.9e-27) {
tmp = (0.5 / b) * ((Math.PI / a) / a);
} else {
tmp = (0.5 / b) * ((Math.PI / a) / b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -5.9e-27: tmp = (0.5 / b) * ((math.pi / a) / a) else: tmp = (0.5 / b) * ((math.pi / a) / b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -5.9e-27) tmp = Float64(Float64(0.5 / b) * Float64(Float64(pi / a) / a)); else tmp = Float64(Float64(0.5 / b) * Float64(Float64(pi / a) / b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -5.9e-27)
tmp = (0.5 / b) * ((pi / a) / a);
else
tmp = (0.5 / b) * ((pi / a) / b);
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[a, -5.9e-27], N[(N[(0.5 / b), $MachinePrecision] * N[(N[(Pi / a), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / b), $MachinePrecision] * N[(N[(Pi / a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.9 \cdot 10^{-27}:\\
\;\;\;\;\frac{0.5}{b} \cdot \frac{\frac{\pi}{a}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{b} \cdot \frac{\frac{\pi}{a}}{b}\\
\end{array}
\end{array}
if a < -5.8999999999999998e-27Initial program 86.4%
associate-*l*86.3%
*-rgt-identity86.3%
associate-/l*86.3%
metadata-eval86.3%
associate-*l/86.3%
*-lft-identity86.3%
sub-neg86.3%
distribute-neg-frac86.3%
metadata-eval86.3%
Simplified86.3%
metadata-eval86.3%
div-inv86.3%
clear-num86.3%
clear-num86.3%
frac-times86.4%
metadata-eval86.4%
frac-add86.5%
associate-/r/86.4%
*-un-lft-identity86.4%
*-commutative86.4%
neg-mul-186.4%
sub-neg86.4%
flip-+99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.7%
clear-num99.7%
*-un-lft-identity99.7%
times-frac99.7%
metadata-eval99.7%
metadata-eval99.7%
times-frac99.7%
*-un-lft-identity99.7%
*-commutative99.7%
*-un-lft-identity99.7%
associate-*r*92.6%
times-frac92.5%
Applied egg-rr92.5%
associate-*l/92.6%
*-commutative92.6%
associate-*r/92.6%
*-lft-identity92.6%
associate-*r/92.6%
*-commutative92.6%
associate-/l*92.6%
metadata-eval92.6%
associate-*r/92.6%
associate-*l/92.6%
*-commutative92.6%
associate-*r/92.6%
metadata-eval92.6%
associate-/l/92.6%
Simplified92.6%
Taylor expanded in a around inf 78.8%
if -5.8999999999999998e-27 < a Initial program 75.5%
associate-*l*75.5%
*-rgt-identity75.5%
associate-/l*75.5%
metadata-eval75.5%
associate-*l/75.6%
*-lft-identity75.6%
sub-neg75.6%
distribute-neg-frac75.6%
metadata-eval75.6%
Simplified75.6%
metadata-eval75.6%
div-inv75.6%
clear-num75.6%
clear-num75.2%
frac-times75.2%
metadata-eval75.2%
frac-add75.1%
associate-/r/75.2%
*-un-lft-identity75.2%
*-commutative75.2%
neg-mul-175.2%
sub-neg75.2%
flip-+98.8%
+-commutative98.8%
Applied egg-rr98.8%
associate-*l/98.8%
clear-num98.8%
*-un-lft-identity98.8%
times-frac98.8%
metadata-eval98.8%
metadata-eval98.8%
times-frac98.8%
*-un-lft-identity98.8%
*-commutative98.8%
*-un-lft-identity98.8%
associate-*r*93.0%
times-frac93.6%
Applied egg-rr93.6%
associate-*l/93.8%
*-commutative93.8%
associate-*r/93.8%
*-lft-identity93.8%
associate-*r/93.8%
*-commutative93.8%
associate-/l*93.6%
metadata-eval93.6%
associate-*r/93.6%
associate-*l/93.6%
*-commutative93.6%
associate-*r/93.6%
metadata-eval93.6%
associate-/l/94.6%
Simplified94.6%
Taylor expanded in a around 0 70.2%
associate-/r*70.2%
Simplified70.2%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (/ (/ 1.0 (* (+ a b) (/ 2.0 PI))) (* a b)))
assert(a < b);
double code(double a, double b) {
return (1.0 / ((a + b) * (2.0 / ((double) M_PI)))) / (a * b);
}
assert a < b;
public static double code(double a, double b) {
return (1.0 / ((a + b) * (2.0 / Math.PI))) / (a * b);
}
[a, b] = sort([a, b]) def code(a, b): return (1.0 / ((a + b) * (2.0 / math.pi))) / (a * b)
a, b = sort([a, b]) function code(a, b) return Float64(Float64(1.0 / Float64(Float64(a + b) * Float64(2.0 / pi))) / Float64(a * b)) end
a, b = num2cell(sort([a, b])){:}
function tmp = code(a, b)
tmp = (1.0 / ((a + b) * (2.0 / pi))) / (a * b);
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := N[(N[(1.0 / N[(N[(a + b), $MachinePrecision] * N[(2.0 / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{\frac{1}{\left(a + b\right) \cdot \frac{2}{\pi}}}{a \cdot b}
\end{array}
Initial program 78.3%
associate-*l*78.3%
*-rgt-identity78.3%
associate-/l*78.3%
metadata-eval78.3%
associate-*l/78.3%
*-lft-identity78.3%
sub-neg78.3%
distribute-neg-frac78.3%
metadata-eval78.3%
Simplified78.3%
metadata-eval78.3%
div-inv78.3%
clear-num78.3%
clear-num78.0%
frac-times78.0%
metadata-eval78.0%
frac-add78.0%
associate-/r/78.0%
*-un-lft-identity78.0%
*-commutative78.0%
neg-mul-178.0%
sub-neg78.0%
flip-+99.0%
+-commutative99.0%
Applied egg-rr99.0%
inv-pow99.0%
associate-*r*99.0%
unpow-prod-down99.5%
pow-prod-down99.5%
inv-pow99.5%
inv-pow99.5%
frac-times99.5%
metadata-eval99.5%
Applied egg-rr99.5%
associate-*r/99.6%
*-rgt-identity99.6%
unpow-199.6%
*-commutative99.6%
Simplified99.6%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (* (/ PI (+ a b)) (/ 0.5 (* a b))))
assert(a < b);
double code(double a, double b) {
return (((double) M_PI) / (a + b)) * (0.5 / (a * b));
}
assert a < b;
public static double code(double a, double b) {
return (Math.PI / (a + b)) * (0.5 / (a * b));
}
[a, b] = sort([a, b]) def code(a, b): return (math.pi / (a + b)) * (0.5 / (a * b))
a, b = sort([a, b]) function code(a, b) return Float64(Float64(pi / Float64(a + b)) * Float64(0.5 / Float64(a * b))) end
a, b = num2cell(sort([a, b])){:}
function tmp = code(a, b)
tmp = (pi / (a + b)) * (0.5 / (a * b));
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := N[(N[(Pi / N[(a + b), $MachinePrecision]), $MachinePrecision] * N[(0.5 / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{\pi}{a + b} \cdot \frac{0.5}{a \cdot b}
\end{array}
Initial program 78.3%
associate-*l*78.3%
*-rgt-identity78.3%
associate-/l*78.3%
metadata-eval78.3%
associate-*l/78.3%
*-lft-identity78.3%
sub-neg78.3%
distribute-neg-frac78.3%
metadata-eval78.3%
Simplified78.3%
metadata-eval78.3%
div-inv78.3%
clear-num78.3%
clear-num78.0%
frac-times78.0%
metadata-eval78.0%
frac-add78.0%
associate-/r/78.0%
*-un-lft-identity78.0%
*-commutative78.0%
neg-mul-178.0%
sub-neg78.0%
flip-+99.0%
+-commutative99.0%
Applied egg-rr99.0%
associate-*l/99.1%
clear-num99.0%
*-un-lft-identity99.0%
times-frac99.0%
metadata-eval99.0%
metadata-eval99.0%
times-frac99.0%
*-un-lft-identity99.0%
*-commutative99.0%
times-frac99.6%
Applied egg-rr99.6%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (* (/ PI (* a b)) (/ 0.5 (+ a b))))
assert(a < b);
double code(double a, double b) {
return (((double) M_PI) / (a * b)) * (0.5 / (a + b));
}
assert a < b;
public static double code(double a, double b) {
return (Math.PI / (a * b)) * (0.5 / (a + b));
}
[a, b] = sort([a, b]) def code(a, b): return (math.pi / (a * b)) * (0.5 / (a + b))
a, b = sort([a, b]) function code(a, b) return Float64(Float64(pi / Float64(a * b)) * Float64(0.5 / Float64(a + b))) end
a, b = num2cell(sort([a, b])){:}
function tmp = code(a, b)
tmp = (pi / (a * b)) * (0.5 / (a + b));
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := N[(N[(Pi / N[(a * b), $MachinePrecision]), $MachinePrecision] * N[(0.5 / N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{\pi}{a \cdot b} \cdot \frac{0.5}{a + b}
\end{array}
Initial program 78.3%
associate-*l*78.3%
*-rgt-identity78.3%
associate-/l*78.3%
metadata-eval78.3%
associate-*l/78.3%
*-lft-identity78.3%
sub-neg78.3%
distribute-neg-frac78.3%
metadata-eval78.3%
Simplified78.3%
metadata-eval78.3%
div-inv78.3%
clear-num78.3%
clear-num78.0%
frac-times78.0%
metadata-eval78.0%
frac-add78.0%
associate-/r/78.0%
*-un-lft-identity78.0%
*-commutative78.0%
neg-mul-178.0%
sub-neg78.0%
flip-+99.0%
+-commutative99.0%
Applied egg-rr99.0%
associate-*l/99.1%
clear-num99.0%
*-un-lft-identity99.0%
times-frac99.0%
metadata-eval99.0%
metadata-eval99.0%
times-frac99.0%
*-un-lft-identity99.0%
*-commutative99.0%
*-commutative99.0%
times-frac99.6%
Applied egg-rr99.6%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (* PI (/ 0.5 (* (+ a b) (* a b)))))
assert(a < b);
double code(double a, double b) {
return ((double) M_PI) * (0.5 / ((a + b) * (a * b)));
}
assert a < b;
public static double code(double a, double b) {
return Math.PI * (0.5 / ((a + b) * (a * b)));
}
[a, b] = sort([a, b]) def code(a, b): return math.pi * (0.5 / ((a + b) * (a * b)))
a, b = sort([a, b]) function code(a, b) return Float64(pi * Float64(0.5 / Float64(Float64(a + b) * Float64(a * b)))) end
a, b = num2cell(sort([a, b])){:}
function tmp = code(a, b)
tmp = pi * (0.5 / ((a + b) * (a * b)));
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := N[(Pi * N[(0.5 / N[(N[(a + b), $MachinePrecision] * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\pi \cdot \frac{0.5}{\left(a + b\right) \cdot \left(a \cdot b\right)}
\end{array}
Initial program 78.3%
*-commutative78.3%
associate-*r*78.3%
associate-*r/78.3%
associate-*r*78.3%
*-rgt-identity78.3%
sub-neg78.3%
distribute-neg-frac78.3%
metadata-eval78.3%
Simplified78.3%
*-commutative78.3%
associate-*r/78.3%
div-inv78.3%
metadata-eval78.3%
associate-*l*78.3%
*-commutative78.3%
Applied egg-rr99.0%
Final simplification99.0%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (* (/ 0.5 b) (/ (/ PI a) a)))
assert(a < b);
double code(double a, double b) {
return (0.5 / b) * ((((double) M_PI) / a) / a);
}
assert a < b;
public static double code(double a, double b) {
return (0.5 / b) * ((Math.PI / a) / a);
}
[a, b] = sort([a, b]) def code(a, b): return (0.5 / b) * ((math.pi / a) / a)
a, b = sort([a, b]) function code(a, b) return Float64(Float64(0.5 / b) * Float64(Float64(pi / a) / a)) end
a, b = num2cell(sort([a, b])){:}
function tmp = code(a, b)
tmp = (0.5 / b) * ((pi / a) / a);
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := N[(N[(0.5 / b), $MachinePrecision] * N[(N[(Pi / a), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{0.5}{b} \cdot \frac{\frac{\pi}{a}}{a}
\end{array}
Initial program 78.3%
associate-*l*78.3%
*-rgt-identity78.3%
associate-/l*78.3%
metadata-eval78.3%
associate-*l/78.3%
*-lft-identity78.3%
sub-neg78.3%
distribute-neg-frac78.3%
metadata-eval78.3%
Simplified78.3%
metadata-eval78.3%
div-inv78.3%
clear-num78.3%
clear-num78.0%
frac-times78.0%
metadata-eval78.0%
frac-add78.0%
associate-/r/78.0%
*-un-lft-identity78.0%
*-commutative78.0%
neg-mul-178.0%
sub-neg78.0%
flip-+99.0%
+-commutative99.0%
Applied egg-rr99.0%
associate-*l/99.1%
clear-num99.0%
*-un-lft-identity99.0%
times-frac99.0%
metadata-eval99.0%
metadata-eval99.0%
times-frac99.0%
*-un-lft-identity99.0%
*-commutative99.0%
*-un-lft-identity99.0%
associate-*r*92.9%
times-frac93.4%
Applied egg-rr93.4%
associate-*l/93.5%
*-commutative93.5%
associate-*r/93.5%
*-lft-identity93.5%
associate-*r/93.5%
*-commutative93.5%
associate-/l*93.3%
metadata-eval93.3%
associate-*r/93.3%
associate-*l/93.3%
*-commutative93.3%
associate-*r/93.3%
metadata-eval93.3%
associate-/l/94.1%
Simplified94.1%
Taylor expanded in a around inf 57.0%
herbie shell --seed 2024139
(FPCore (a b)
:name "NMSE Section 6.1 mentioned, B"
:precision binary64
(* (* (/ PI 2.0) (/ 1.0 (- (* b b) (* a a)))) (- (/ 1.0 a) (/ 1.0 b))))