
(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 -3.6e+93) (/ (* 0.5 (/ PI a)) (* a b)) (* (/ (/ 0.5 (+ a b)) a) (/ PI b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -3.6e+93) {
tmp = (0.5 * (((double) M_PI) / a)) / (a * b);
} else {
tmp = ((0.5 / (a + b)) / a) * (((double) M_PI) / b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -3.6e+93) {
tmp = (0.5 * (Math.PI / a)) / (a * b);
} else {
tmp = ((0.5 / (a + b)) / a) * (Math.PI / b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -3.6e+93: tmp = (0.5 * (math.pi / a)) / (a * b) else: tmp = ((0.5 / (a + b)) / a) * (math.pi / b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -3.6e+93) tmp = Float64(Float64(0.5 * Float64(pi / a)) / Float64(a * b)); else tmp = Float64(Float64(Float64(0.5 / Float64(a + b)) / a) * Float64(pi / b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -3.6e+93)
tmp = (0.5 * (pi / a)) / (a * b);
else
tmp = ((0.5 / (a + b)) / a) * (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, -3.6e+93], N[(N[(0.5 * N[(Pi / a), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 / N[(a + b), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] * N[(Pi / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.6 \cdot 10^{+93}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{a + b}}{a} \cdot \frac{\pi}{b}\\
\end{array}
\end{array}
if a < -3.5999999999999999e93Initial program 74.2%
div-inv74.2%
cancel-sign-sub-inv74.2%
metadata-eval74.2%
div-inv74.2%
div-inv74.3%
difference-of-squares82.0%
*-commutative82.0%
frac-add82.0%
associate-*r/82.0%
Applied egg-rr99.7%
associate-*r/99.8%
*-commutative99.8%
+-commutative99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in a around inf 99.8%
if -3.5999999999999999e93 < a Initial program 82.0%
div-inv82.0%
cancel-sign-sub-inv82.0%
metadata-eval82.0%
div-inv82.0%
div-inv82.0%
difference-of-squares89.3%
*-commutative89.3%
frac-add89.3%
associate-*r/89.3%
Applied egg-rr99.5%
associate-*r/99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Simplified99.6%
*-commutative99.6%
metadata-eval99.6%
div-inv99.6%
associate-/r*99.6%
+-commutative99.6%
div-inv99.5%
*-commutative99.5%
times-frac95.2%
*-commutative95.2%
+-commutative95.2%
associate-/r*95.2%
metadata-eval95.2%
Applied egg-rr95.2%
Final simplification96.1%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= b 8.2e+69) (* (/ PI a) (/ (/ 0.5 b) (+ a b))) (/ (/ (/ PI (* a 2.0)) b) b)))
assert(a < b);
double code(double a, double b) {
double tmp;
if (b <= 8.2e+69) {
tmp = (((double) M_PI) / a) * ((0.5 / b) / (a + b));
} else {
tmp = ((((double) M_PI) / (a * 2.0)) / b) / b;
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (b <= 8.2e+69) {
tmp = (Math.PI / a) * ((0.5 / b) / (a + b));
} else {
tmp = ((Math.PI / (a * 2.0)) / b) / b;
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if b <= 8.2e+69: tmp = (math.pi / a) * ((0.5 / b) / (a + b)) else: tmp = ((math.pi / (a * 2.0)) / b) / b return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (b <= 8.2e+69) tmp = Float64(Float64(pi / a) * Float64(Float64(0.5 / b) / Float64(a + b))); else tmp = Float64(Float64(Float64(pi / Float64(a * 2.0)) / b) / b); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (b <= 8.2e+69)
tmp = (pi / a) * ((0.5 / b) / (a + b));
else
tmp = ((pi / (a * 2.0)) / b) / 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[b, 8.2e+69], N[(N[(Pi / a), $MachinePrecision] * N[(N[(0.5 / b), $MachinePrecision] / N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(Pi / N[(a * 2.0), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.2 \cdot 10^{+69}:\\
\;\;\;\;\frac{\pi}{a} \cdot \frac{\frac{0.5}{b}}{a + b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\pi}{a \cdot 2}}{b}}{b}\\
\end{array}
\end{array}
if b < 8.1999999999999998e69Initial program 80.4%
div-inv80.4%
cancel-sign-sub-inv80.4%
metadata-eval80.4%
div-inv80.4%
div-inv80.4%
difference-of-squares85.9%
*-commutative85.9%
frac-add85.9%
associate-*r/85.9%
Applied egg-rr99.5%
associate-*r/99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Simplified99.6%
frac-2neg99.6%
associate-/l/98.9%
frac-2neg98.9%
distribute-frac-neg98.9%
neg-sub098.9%
clear-num98.9%
distribute-frac-neg98.9%
associate-/l*98.8%
frac-2neg98.8%
*-commutative98.8%
metadata-eval98.8%
div-inv98.8%
associate-/r*98.8%
+-commutative98.8%
Applied egg-rr99.5%
sub0-neg99.5%
times-frac95.4%
distribute-rgt-neg-in95.4%
distribute-frac-neg95.4%
distribute-neg-frac95.4%
metadata-eval95.4%
associate-/l/95.1%
associate-/r*95.5%
+-commutative95.5%
Simplified95.5%
if 8.1999999999999998e69 < b Initial program 80.6%
Taylor expanded in b around inf 92.5%
unpow292.5%
Simplified92.5%
associate-*r/92.5%
*-commutative92.5%
metadata-eval92.5%
div-inv92.5%
associate-*r*95.6%
associate-/r*98.2%
frac-2neg98.2%
distribute-neg-frac98.2%
div-inv98.2%
metadata-eval98.2%
metadata-eval98.2%
distribute-rgt-neg-in98.2%
frac-2neg98.2%
*-commutative98.2%
associate-/l*98.2%
distribute-neg-frac98.2%
metadata-eval98.2%
Applied egg-rr98.2%
clear-num98.2%
associate-/r*98.2%
times-frac98.2%
associate-/r*98.2%
div-inv98.2%
clear-num98.3%
div-inv98.3%
metadata-eval98.3%
times-frac98.2%
Applied egg-rr98.2%
associate-*l/98.3%
*-lft-identity98.3%
associate-/l/98.3%
Simplified98.3%
Final simplification96.1%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= b 5.3e-30) (* 0.5 (/ PI (* a (* a b)))) (* 0.5 (/ PI (* a (* b b))))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (b <= 5.3e-30) {
tmp = 0.5 * (((double) M_PI) / (a * (a * b)));
} else {
tmp = 0.5 * (((double) M_PI) / (a * (b * b)));
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (b <= 5.3e-30) {
tmp = 0.5 * (Math.PI / (a * (a * b)));
} else {
tmp = 0.5 * (Math.PI / (a * (b * b)));
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if b <= 5.3e-30: tmp = 0.5 * (math.pi / (a * (a * b))) else: tmp = 0.5 * (math.pi / (a * (b * b))) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (b <= 5.3e-30) tmp = Float64(0.5 * Float64(pi / Float64(a * Float64(a * b)))); else tmp = Float64(0.5 * Float64(pi / Float64(a * Float64(b * b)))); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (b <= 5.3e-30)
tmp = 0.5 * (pi / (a * (a * b)));
else
tmp = 0.5 * (pi / (a * (b * 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[b, 5.3e-30], N[(0.5 * N[(Pi / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(Pi / N[(a * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.3 \cdot 10^{-30}:\\
\;\;\;\;0.5 \cdot \frac{\pi}{a \cdot \left(a \cdot b\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\pi}{a \cdot \left(b \cdot b\right)}\\
\end{array}
\end{array}
if b < 5.29999999999999974e-30Initial program 77.2%
div-inv77.2%
cancel-sign-sub-inv77.2%
metadata-eval77.2%
div-inv77.2%
div-inv77.2%
difference-of-squares83.6%
*-commutative83.6%
frac-add83.6%
associate-*r/83.6%
Applied egg-rr99.6%
associate-*r/99.7%
*-commutative99.7%
+-commutative99.7%
*-commutative99.7%
Simplified99.7%
frac-2neg99.7%
associate-/l/98.8%
distribute-lft-neg-in98.8%
metadata-eval98.8%
*-commutative98.8%
associate-/r*99.7%
frac-2neg99.7%
remove-double-neg99.7%
div-inv99.6%
*-commutative99.6%
associate-/l*99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in a around inf 62.6%
unpow262.6%
associate-*r*72.9%
Simplified72.9%
if 5.29999999999999974e-30 < b Initial program 87.0%
Taylor expanded in b around inf 85.7%
unpow285.7%
Simplified85.7%
Final simplification77.1%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= b 1.8e-67) (* 0.5 (/ PI (* a (* a b)))) (* PI (/ (/ (/ 0.5 a) b) b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (b <= 1.8e-67) {
tmp = 0.5 * (((double) M_PI) / (a * (a * b)));
} else {
tmp = ((double) M_PI) * (((0.5 / a) / b) / b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (b <= 1.8e-67) {
tmp = 0.5 * (Math.PI / (a * (a * b)));
} else {
tmp = Math.PI * (((0.5 / a) / b) / b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if b <= 1.8e-67: tmp = 0.5 * (math.pi / (a * (a * b))) else: tmp = math.pi * (((0.5 / a) / b) / b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (b <= 1.8e-67) tmp = Float64(0.5 * Float64(pi / Float64(a * Float64(a * b)))); else tmp = Float64(pi * Float64(Float64(Float64(0.5 / a) / b) / b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (b <= 1.8e-67)
tmp = 0.5 * (pi / (a * (a * b)));
else
tmp = pi * (((0.5 / a) / b) / 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[b, 1.8e-67], N[(0.5 * N[(Pi / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(Pi * N[(N[(N[(0.5 / a), $MachinePrecision] / b), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.8 \cdot 10^{-67}:\\
\;\;\;\;0.5 \cdot \frac{\pi}{a \cdot \left(a \cdot b\right)}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \frac{\frac{\frac{0.5}{a}}{b}}{b}\\
\end{array}
\end{array}
if b < 1.8e-67Initial program 77.9%
div-inv77.9%
cancel-sign-sub-inv77.9%
metadata-eval77.9%
div-inv77.9%
div-inv77.9%
difference-of-squares84.5%
*-commutative84.5%
frac-add84.5%
associate-*r/84.5%
Applied egg-rr99.6%
associate-*r/99.7%
*-commutative99.7%
+-commutative99.7%
*-commutative99.7%
Simplified99.7%
frac-2neg99.7%
associate-/l/99.0%
distribute-lft-neg-in99.0%
metadata-eval99.0%
*-commutative99.0%
associate-/r*99.7%
frac-2neg99.7%
remove-double-neg99.7%
div-inv99.6%
*-commutative99.6%
associate-/l*99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in a around inf 63.6%
unpow263.6%
associate-*r*73.0%
Simplified73.0%
if 1.8e-67 < b Initial program 85.2%
div-inv85.2%
cancel-sign-sub-inv85.2%
metadata-eval85.2%
div-inv85.2%
div-inv85.2%
difference-of-squares94.3%
*-commutative94.3%
frac-add94.2%
associate-*r/94.2%
Applied egg-rr99.5%
associate-*r/99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Simplified99.6%
frac-2neg99.6%
associate-/l/97.8%
distribute-lft-neg-in97.8%
metadata-eval97.8%
*-commutative97.8%
associate-/r*99.7%
frac-2neg99.7%
remove-double-neg99.7%
div-inv99.6%
*-commutative99.6%
associate-/l*99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in a around 0 83.0%
unpow283.0%
associate-/r*82.9%
associate-/l/85.9%
associate-/r*85.8%
associate-*r/85.8%
associate-*r/85.8%
*-commutative85.8%
associate-*r/85.7%
*-rgt-identity85.7%
associate-*r/85.7%
associate-*r*85.6%
associate-*r/85.7%
*-rgt-identity85.7%
associate-/r*85.8%
Simplified85.8%
Final simplification77.4%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= b 1.8e-67) (* (/ PI a) (/ 0.5 (* a b))) (* PI (/ (/ (/ 0.5 a) b) b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (b <= 1.8e-67) {
tmp = (((double) M_PI) / a) * (0.5 / (a * b));
} else {
tmp = ((double) M_PI) * (((0.5 / a) / b) / b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (b <= 1.8e-67) {
tmp = (Math.PI / a) * (0.5 / (a * b));
} else {
tmp = Math.PI * (((0.5 / a) / b) / b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if b <= 1.8e-67: tmp = (math.pi / a) * (0.5 / (a * b)) else: tmp = math.pi * (((0.5 / a) / b) / b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (b <= 1.8e-67) tmp = Float64(Float64(pi / a) * Float64(0.5 / Float64(a * b))); else tmp = Float64(pi * Float64(Float64(Float64(0.5 / a) / b) / b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (b <= 1.8e-67)
tmp = (pi / a) * (0.5 / (a * b));
else
tmp = pi * (((0.5 / a) / b) / 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[b, 1.8e-67], N[(N[(Pi / a), $MachinePrecision] * N[(0.5 / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(Pi * N[(N[(N[(0.5 / a), $MachinePrecision] / b), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.8 \cdot 10^{-67}:\\
\;\;\;\;\frac{\pi}{a} \cdot \frac{0.5}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \frac{\frac{\frac{0.5}{a}}{b}}{b}\\
\end{array}
\end{array}
if b < 1.8e-67Initial program 77.9%
div-inv77.9%
cancel-sign-sub-inv77.9%
metadata-eval77.9%
div-inv77.9%
div-inv77.9%
difference-of-squares84.5%
*-commutative84.5%
frac-add84.5%
associate-*r/84.5%
Applied egg-rr99.6%
associate-*r/99.7%
*-commutative99.7%
+-commutative99.7%
*-commutative99.7%
Simplified99.7%
frac-2neg99.7%
associate-/l/99.0%
frac-2neg99.0%
distribute-frac-neg99.0%
neg-sub099.0%
clear-num99.0%
distribute-frac-neg99.0%
associate-/l*98.9%
frac-2neg98.9%
*-commutative98.9%
metadata-eval98.9%
div-inv98.9%
associate-/r*98.9%
+-commutative98.9%
Applied egg-rr99.6%
sub0-neg99.6%
times-frac94.6%
distribute-rgt-neg-in94.6%
distribute-frac-neg94.6%
distribute-neg-frac94.6%
metadata-eval94.6%
associate-/l/94.2%
associate-/r*94.7%
+-commutative94.7%
Simplified94.7%
Taylor expanded in b around 0 72.9%
if 1.8e-67 < b Initial program 85.2%
div-inv85.2%
cancel-sign-sub-inv85.2%
metadata-eval85.2%
div-inv85.2%
div-inv85.2%
difference-of-squares94.3%
*-commutative94.3%
frac-add94.2%
associate-*r/94.2%
Applied egg-rr99.5%
associate-*r/99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Simplified99.6%
frac-2neg99.6%
associate-/l/97.8%
distribute-lft-neg-in97.8%
metadata-eval97.8%
*-commutative97.8%
associate-/r*99.7%
frac-2neg99.7%
remove-double-neg99.7%
div-inv99.6%
*-commutative99.6%
associate-/l*99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in a around 0 83.0%
unpow283.0%
associate-/r*82.9%
associate-/l/85.9%
associate-/r*85.8%
associate-*r/85.8%
associate-*r/85.8%
*-commutative85.8%
associate-*r/85.7%
*-rgt-identity85.7%
associate-*r/85.7%
associate-*r*85.6%
associate-*r/85.7%
*-rgt-identity85.7%
associate-/r*85.8%
Simplified85.8%
Final simplification77.3%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= b 1.8e-67) (* (/ 0.5 a) (/ (/ PI b) a)) (* PI (/ (/ (/ 0.5 a) b) b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (b <= 1.8e-67) {
tmp = (0.5 / a) * ((((double) M_PI) / b) / a);
} else {
tmp = ((double) M_PI) * (((0.5 / a) / b) / b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (b <= 1.8e-67) {
tmp = (0.5 / a) * ((Math.PI / b) / a);
} else {
tmp = Math.PI * (((0.5 / a) / b) / b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if b <= 1.8e-67: tmp = (0.5 / a) * ((math.pi / b) / a) else: tmp = math.pi * (((0.5 / a) / b) / b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (b <= 1.8e-67) tmp = Float64(Float64(0.5 / a) * Float64(Float64(pi / b) / a)); else tmp = Float64(pi * Float64(Float64(Float64(0.5 / a) / b) / b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (b <= 1.8e-67)
tmp = (0.5 / a) * ((pi / b) / a);
else
tmp = pi * (((0.5 / a) / b) / 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[b, 1.8e-67], N[(N[(0.5 / a), $MachinePrecision] * N[(N[(Pi / b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(Pi * N[(N[(N[(0.5 / a), $MachinePrecision] / b), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.8 \cdot 10^{-67}:\\
\;\;\;\;\frac{0.5}{a} \cdot \frac{\frac{\pi}{b}}{a}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \frac{\frac{\frac{0.5}{a}}{b}}{b}\\
\end{array}
\end{array}
if b < 1.8e-67Initial program 77.9%
div-inv77.9%
cancel-sign-sub-inv77.9%
metadata-eval77.9%
div-inv77.9%
div-inv77.9%
difference-of-squares84.5%
*-commutative84.5%
frac-add84.5%
associate-*r/84.5%
Applied egg-rr99.6%
associate-*r/99.7%
*-commutative99.7%
+-commutative99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in a around inf 72.9%
times-frac72.9%
*-commutative72.9%
associate-/r*72.9%
Applied egg-rr72.9%
frac-2neg72.9%
distribute-frac-neg72.9%
remove-double-neg72.9%
distribute-frac-neg72.9%
frac-2neg72.9%
neg-sub072.9%
div-inv72.9%
distribute-rgt-neg-in72.9%
remove-double-neg72.9%
cancel-sign-sub72.9%
associate-/r*72.8%
Applied egg-rr72.8%
+-lft-identity72.8%
distribute-neg-frac72.8%
distribute-neg-frac72.8%
metadata-eval72.8%
distribute-lft-neg-out72.8%
distribute-rgt-neg-out72.8%
distribute-neg-frac72.8%
distribute-neg-frac72.8%
metadata-eval72.8%
associate-*r/72.8%
associate-*l/72.8%
associate-*r/72.9%
*-rgt-identity72.9%
Simplified72.9%
if 1.8e-67 < b Initial program 85.2%
div-inv85.2%
cancel-sign-sub-inv85.2%
metadata-eval85.2%
div-inv85.2%
div-inv85.2%
difference-of-squares94.3%
*-commutative94.3%
frac-add94.2%
associate-*r/94.2%
Applied egg-rr99.5%
associate-*r/99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Simplified99.6%
frac-2neg99.6%
associate-/l/97.8%
distribute-lft-neg-in97.8%
metadata-eval97.8%
*-commutative97.8%
associate-/r*99.7%
frac-2neg99.7%
remove-double-neg99.7%
div-inv99.6%
*-commutative99.6%
associate-/l*99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in a around 0 83.0%
unpow283.0%
associate-/r*82.9%
associate-/l/85.9%
associate-/r*85.8%
associate-*r/85.8%
associate-*r/85.8%
*-commutative85.8%
associate-*r/85.7%
*-rgt-identity85.7%
associate-*r/85.7%
associate-*r*85.6%
associate-*r/85.7%
*-rgt-identity85.7%
associate-/r*85.8%
Simplified85.8%
Final simplification77.3%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= b 1.3e-67) (/ (* 0.5 (/ PI a)) (* a b)) (* PI (/ (/ (/ 0.5 a) b) b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (b <= 1.3e-67) {
tmp = (0.5 * (((double) M_PI) / a)) / (a * b);
} else {
tmp = ((double) M_PI) * (((0.5 / a) / b) / b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (b <= 1.3e-67) {
tmp = (0.5 * (Math.PI / a)) / (a * b);
} else {
tmp = Math.PI * (((0.5 / a) / b) / b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if b <= 1.3e-67: tmp = (0.5 * (math.pi / a)) / (a * b) else: tmp = math.pi * (((0.5 / a) / b) / b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (b <= 1.3e-67) tmp = Float64(Float64(0.5 * Float64(pi / a)) / Float64(a * b)); else tmp = Float64(pi * Float64(Float64(Float64(0.5 / a) / b) / b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (b <= 1.3e-67)
tmp = (0.5 * (pi / a)) / (a * b);
else
tmp = pi * (((0.5 / a) / b) / 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[b, 1.3e-67], N[(N[(0.5 * N[(Pi / a), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision], N[(Pi * N[(N[(N[(0.5 / a), $MachinePrecision] / b), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.3 \cdot 10^{-67}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \frac{\frac{\frac{0.5}{a}}{b}}{b}\\
\end{array}
\end{array}
if b < 1.2999999999999999e-67Initial program 77.9%
div-inv77.9%
cancel-sign-sub-inv77.9%
metadata-eval77.9%
div-inv77.9%
div-inv77.9%
difference-of-squares84.5%
*-commutative84.5%
frac-add84.5%
associate-*r/84.5%
Applied egg-rr99.6%
associate-*r/99.7%
*-commutative99.7%
+-commutative99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in a around inf 72.9%
if 1.2999999999999999e-67 < b Initial program 85.2%
div-inv85.2%
cancel-sign-sub-inv85.2%
metadata-eval85.2%
div-inv85.2%
div-inv85.2%
difference-of-squares94.3%
*-commutative94.3%
frac-add94.2%
associate-*r/94.2%
Applied egg-rr99.5%
associate-*r/99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
Simplified99.6%
frac-2neg99.6%
associate-/l/97.8%
distribute-lft-neg-in97.8%
metadata-eval97.8%
*-commutative97.8%
associate-/r*99.7%
frac-2neg99.7%
remove-double-neg99.7%
div-inv99.6%
*-commutative99.6%
associate-/l*99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in a around 0 83.0%
unpow283.0%
associate-/r*82.9%
associate-/l/85.9%
associate-/r*85.8%
associate-*r/85.8%
associate-*r/85.8%
*-commutative85.8%
associate-*r/85.7%
*-rgt-identity85.7%
associate-*r/85.7%
associate-*r*85.6%
associate-*r/85.7%
*-rgt-identity85.7%
associate-/r*85.8%
Simplified85.8%
Final simplification77.3%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= b 1.8e-67) (/ (* 0.5 (/ PI a)) (* a b)) (/ (/ 0.5 (* a (/ b PI))) b)))
assert(a < b);
double code(double a, double b) {
double tmp;
if (b <= 1.8e-67) {
tmp = (0.5 * (((double) M_PI) / a)) / (a * b);
} else {
tmp = (0.5 / (a * (b / ((double) M_PI)))) / b;
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (b <= 1.8e-67) {
tmp = (0.5 * (Math.PI / a)) / (a * b);
} else {
tmp = (0.5 / (a * (b / Math.PI))) / b;
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if b <= 1.8e-67: tmp = (0.5 * (math.pi / a)) / (a * b) else: tmp = (0.5 / (a * (b / math.pi))) / b return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (b <= 1.8e-67) tmp = Float64(Float64(0.5 * Float64(pi / a)) / Float64(a * b)); else tmp = Float64(Float64(0.5 / Float64(a * Float64(b / pi))) / b); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (b <= 1.8e-67)
tmp = (0.5 * (pi / a)) / (a * b);
else
tmp = (0.5 / (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[b, 1.8e-67], N[(N[(0.5 * N[(Pi / a), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / N[(a * N[(b / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.8 \cdot 10^{-67}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{a \cdot \frac{b}{\pi}}}{b}\\
\end{array}
\end{array}
if b < 1.8e-67Initial program 77.9%
div-inv77.9%
cancel-sign-sub-inv77.9%
metadata-eval77.9%
div-inv77.9%
div-inv77.9%
difference-of-squares84.5%
*-commutative84.5%
frac-add84.5%
associate-*r/84.5%
Applied egg-rr99.6%
associate-*r/99.7%
*-commutative99.7%
+-commutative99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in a around inf 72.9%
if 1.8e-67 < b Initial program 85.2%
Taylor expanded in b around inf 83.0%
unpow283.0%
Simplified83.0%
associate-*r/83.0%
*-commutative83.0%
metadata-eval83.0%
div-inv83.0%
associate-*r*85.0%
associate-/r*85.8%
frac-2neg85.8%
distribute-neg-frac85.8%
div-inv85.8%
metadata-eval85.8%
metadata-eval85.8%
distribute-rgt-neg-in85.8%
frac-2neg85.8%
*-commutative85.8%
associate-/l*85.8%
distribute-neg-frac85.8%
metadata-eval85.8%
Applied egg-rr85.8%
associate-/l*85.7%
div-inv85.8%
*-commutative85.8%
clear-num85.8%
remove-double-div85.9%
Applied egg-rr85.9%
Final simplification77.4%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= b 1.8e-67) (/ (* 0.5 (/ PI a)) (* a b)) (/ (/ (/ PI (* a 2.0)) b) b)))
assert(a < b);
double code(double a, double b) {
double tmp;
if (b <= 1.8e-67) {
tmp = (0.5 * (((double) M_PI) / a)) / (a * b);
} else {
tmp = ((((double) M_PI) / (a * 2.0)) / b) / b;
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (b <= 1.8e-67) {
tmp = (0.5 * (Math.PI / a)) / (a * b);
} else {
tmp = ((Math.PI / (a * 2.0)) / b) / b;
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if b <= 1.8e-67: tmp = (0.5 * (math.pi / a)) / (a * b) else: tmp = ((math.pi / (a * 2.0)) / b) / b return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (b <= 1.8e-67) tmp = Float64(Float64(0.5 * Float64(pi / a)) / Float64(a * b)); else tmp = Float64(Float64(Float64(pi / Float64(a * 2.0)) / b) / b); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (b <= 1.8e-67)
tmp = (0.5 * (pi / a)) / (a * b);
else
tmp = ((pi / (a * 2.0)) / b) / 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[b, 1.8e-67], N[(N[(0.5 * N[(Pi / a), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(Pi / N[(a * 2.0), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.8 \cdot 10^{-67}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\pi}{a \cdot 2}}{b}}{b}\\
\end{array}
\end{array}
if b < 1.8e-67Initial program 77.9%
div-inv77.9%
cancel-sign-sub-inv77.9%
metadata-eval77.9%
div-inv77.9%
div-inv77.9%
difference-of-squares84.5%
*-commutative84.5%
frac-add84.5%
associate-*r/84.5%
Applied egg-rr99.6%
associate-*r/99.7%
*-commutative99.7%
+-commutative99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in a around inf 72.9%
if 1.8e-67 < b Initial program 85.2%
Taylor expanded in b around inf 83.0%
unpow283.0%
Simplified83.0%
associate-*r/83.0%
*-commutative83.0%
metadata-eval83.0%
div-inv83.0%
associate-*r*85.0%
associate-/r*85.8%
frac-2neg85.8%
distribute-neg-frac85.8%
div-inv85.8%
metadata-eval85.8%
metadata-eval85.8%
distribute-rgt-neg-in85.8%
frac-2neg85.8%
*-commutative85.8%
associate-/l*85.8%
distribute-neg-frac85.8%
metadata-eval85.8%
Applied egg-rr85.8%
clear-num85.8%
associate-/r*85.8%
times-frac85.8%
associate-/r*85.8%
div-inv85.8%
clear-num85.9%
div-inv85.9%
metadata-eval85.9%
times-frac85.8%
Applied egg-rr85.8%
associate-*l/85.9%
*-lft-identity85.9%
associate-/l/85.9%
Simplified85.9%
Final simplification77.4%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (/ (/ (* 0.5 PI) (+ a b)) (* a b)))
assert(a < b);
double code(double a, double b) {
return ((0.5 * ((double) M_PI)) / (a + b)) / (a * b);
}
assert a < b;
public static double code(double a, double b) {
return ((0.5 * Math.PI) / (a + b)) / (a * b);
}
[a, b] = sort([a, b]) def code(a, b): return ((0.5 * math.pi) / (a + b)) / (a * b)
a, b = sort([a, b]) function code(a, b) return Float64(Float64(Float64(0.5 * pi) / Float64(a + b)) / Float64(a * b)) end
a, b = num2cell(sort([a, b])){:}
function tmp = code(a, b)
tmp = ((0.5 * pi) / (a + b)) / (a * b);
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := N[(N[(N[(0.5 * Pi), $MachinePrecision] / N[(a + b), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{\frac{0.5 \cdot \pi}{a + b}}{a \cdot b}
\end{array}
Initial program 80.4%
div-inv80.4%
cancel-sign-sub-inv80.4%
metadata-eval80.4%
div-inv80.4%
div-inv80.4%
difference-of-squares87.9%
*-commutative87.9%
frac-add87.8%
associate-*r/87.8%
Applied egg-rr99.6%
associate-*r/99.7%
*-commutative99.7%
+-commutative99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (/ 0.5 (* (+ a b) (* b (/ a PI)))))
assert(a < b);
double code(double a, double b) {
return 0.5 / ((a + b) * (b * (a / ((double) M_PI))));
}
assert a < b;
public static double code(double a, double b) {
return 0.5 / ((a + b) * (b * (a / Math.PI)));
}
[a, b] = sort([a, b]) def code(a, b): return 0.5 / ((a + b) * (b * (a / math.pi)))
a, b = sort([a, b]) function code(a, b) return Float64(0.5 / Float64(Float64(a + b) * Float64(b * Float64(a / pi)))) end
a, b = num2cell(sort([a, b])){:}
function tmp = code(a, b)
tmp = 0.5 / ((a + b) * (b * (a / pi)));
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := N[(0.5 / N[(N[(a + b), $MachinePrecision] * N[(b * N[(a / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{0.5}{\left(a + b\right) \cdot \left(b \cdot \frac{a}{\pi}\right)}
\end{array}
Initial program 80.4%
div-inv80.4%
cancel-sign-sub-inv80.4%
metadata-eval80.4%
div-inv80.4%
div-inv80.4%
difference-of-squares87.9%
*-commutative87.9%
frac-add87.8%
associate-*r/87.8%
Applied egg-rr99.6%
associate-*r/99.7%
*-commutative99.7%
+-commutative99.7%
*-commutative99.7%
Simplified99.7%
frac-2neg99.7%
associate-/l/98.6%
distribute-lft-neg-in98.6%
metadata-eval98.6%
*-commutative98.6%
associate-/r*99.7%
frac-2neg99.7%
remove-double-neg99.7%
div-inv99.6%
*-commutative99.6%
associate-/l*99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Applied egg-rr99.6%
clear-num99.6%
frac-times98.5%
metadata-eval98.5%
associate-/l*98.5%
div-inv98.4%
/-rgt-identity98.4%
associate-*l*94.2%
clear-num94.2%
remove-double-div94.3%
Applied egg-rr94.3%
associate-*r*98.5%
associate-*r/98.5%
*-commutative98.5%
associate-*r/98.5%
Simplified98.5%
Final simplification98.5%
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(Float64(pi * Float64(0.5 / 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[(N[(Pi * N[(0.5 / N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{\pi \cdot \frac{0.5}{a + b}}{a \cdot b}
\end{array}
Initial program 80.4%
div-inv80.4%
cancel-sign-sub-inv80.4%
metadata-eval80.4%
div-inv80.4%
div-inv80.4%
difference-of-squares87.9%
*-commutative87.9%
frac-add87.8%
associate-*r/87.8%
Applied egg-rr99.6%
Final simplification99.6%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (* 0.5 (/ PI (* a (* a b)))))
assert(a < b);
double code(double a, double b) {
return 0.5 * (((double) M_PI) / (a * (a * b)));
}
assert a < b;
public static double code(double a, double b) {
return 0.5 * (Math.PI / (a * (a * b)));
}
[a, b] = sort([a, b]) def code(a, b): return 0.5 * (math.pi / (a * (a * b)))
a, b = sort([a, b]) function code(a, b) return Float64(0.5 * Float64(pi / Float64(a * Float64(a * b)))) end
a, b = num2cell(sort([a, b])){:}
function tmp = code(a, b)
tmp = 0.5 * (pi / (a * (a * b)));
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := N[(0.5 * N[(Pi / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
0.5 \cdot \frac{\pi}{a \cdot \left(a \cdot b\right)}
\end{array}
Initial program 80.4%
div-inv80.4%
cancel-sign-sub-inv80.4%
metadata-eval80.4%
div-inv80.4%
div-inv80.4%
difference-of-squares87.9%
*-commutative87.9%
frac-add87.8%
associate-*r/87.8%
Applied egg-rr99.6%
associate-*r/99.7%
*-commutative99.7%
+-commutative99.7%
*-commutative99.7%
Simplified99.7%
frac-2neg99.7%
associate-/l/98.6%
distribute-lft-neg-in98.6%
metadata-eval98.6%
*-commutative98.6%
associate-/r*99.7%
frac-2neg99.7%
remove-double-neg99.7%
div-inv99.6%
*-commutative99.6%
associate-/l*99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in a around inf 56.9%
unpow256.9%
associate-*r*63.8%
Simplified63.8%
Final simplification63.8%
herbie shell --seed 2023297
(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))))