
(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 10 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}
(FPCore (a b) :precision binary64 (* (* PI 0.5) (/ (/ 1.0 (+ a b)) (* a b))))
double code(double a, double b) {
return (((double) M_PI) * 0.5) * ((1.0 / (a + b)) / (a * b));
}
public static double code(double a, double b) {
return (Math.PI * 0.5) * ((1.0 / (a + b)) / (a * b));
}
def code(a, b): return (math.pi * 0.5) * ((1.0 / (a + b)) / (a * b))
function code(a, b) return Float64(Float64(pi * 0.5) * Float64(Float64(1.0 / Float64(a + b)) / Float64(a * b))) end
function tmp = code(a, b) tmp = (pi * 0.5) * ((1.0 / (a + b)) / (a * b)); end
code[a_, b_] := N[(N[(Pi * 0.5), $MachinePrecision] * N[(N[(1.0 / N[(a + b), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\pi \cdot 0.5\right) \cdot \frac{\frac{1}{a + b}}{a \cdot b}
\end{array}
Initial program 77.2%
associate-*l*77.2%
*-rgt-identity77.2%
associate-/l*77.2%
metadata-eval77.2%
associate-*l/77.3%
*-lft-identity77.3%
sub-neg77.3%
distribute-neg-frac77.3%
metadata-eval77.3%
Simplified77.3%
*-un-lft-identity77.3%
clear-num76.7%
frac-add76.7%
associate-/r/76.7%
*-un-lft-identity76.7%
*-commutative76.7%
neg-mul-176.7%
sub-neg76.7%
flip-+98.5%
+-commutative98.5%
Applied egg-rr98.5%
*-lft-identity98.5%
associate-/r*99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (a b) :precision binary64 (if (<= b 5.8e+99) (* PI (/ 0.5 (* a (* b (+ a b))))) (/ (/ (* 0.5 (/ PI b)) a) b)))
double code(double a, double b) {
double tmp;
if (b <= 5.8e+99) {
tmp = ((double) M_PI) * (0.5 / (a * (b * (a + b))));
} else {
tmp = ((0.5 * (((double) M_PI) / b)) / a) / b;
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (b <= 5.8e+99) {
tmp = Math.PI * (0.5 / (a * (b * (a + b))));
} else {
tmp = ((0.5 * (Math.PI / b)) / a) / b;
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 5.8e+99: tmp = math.pi * (0.5 / (a * (b * (a + b)))) else: tmp = ((0.5 * (math.pi / b)) / a) / b return tmp
function code(a, b) tmp = 0.0 if (b <= 5.8e+99) tmp = Float64(pi * Float64(0.5 / Float64(a * Float64(b * Float64(a + b))))); else tmp = Float64(Float64(Float64(0.5 * Float64(pi / b)) / a) / b); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 5.8e+99) tmp = pi * (0.5 / (a * (b * (a + b)))); else tmp = ((0.5 * (pi / b)) / a) / b; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 5.8e+99], N[(Pi * N[(0.5 / N[(a * N[(b * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[(Pi / b), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.8 \cdot 10^{+99}:\\
\;\;\;\;\pi \cdot \frac{0.5}{a \cdot \left(b \cdot \left(a + b\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5 \cdot \frac{\pi}{b}}{a}}{b}\\
\end{array}
\end{array}
if b < 5.8000000000000004e99Initial program 82.7%
*-commutative82.7%
associate-*r*82.7%
associate-*r/82.7%
associate-*r*82.7%
*-rgt-identity82.7%
sub-neg82.7%
distribute-neg-frac82.7%
metadata-eval82.7%
Simplified82.7%
associate-*l/82.7%
div-inv82.7%
metadata-eval82.7%
*-commutative82.7%
associate-*r*82.7%
Applied egg-rr98.8%
Taylor expanded in a around 0 90.8%
unpow290.8%
distribute-rgt-in95.2%
Simplified95.2%
if 5.8000000000000004e99 < b Initial program 54.8%
associate-*l*54.8%
*-rgt-identity54.8%
associate-/l*54.8%
metadata-eval54.8%
associate-*l/54.8%
*-lft-identity54.8%
sub-neg54.8%
distribute-neg-frac54.8%
metadata-eval54.8%
Simplified54.8%
metadata-eval54.8%
div-inv54.8%
clear-num54.8%
clear-num53.2%
frac-times53.3%
metadata-eval53.3%
frac-add53.3%
associate-/r/53.3%
*-un-lft-identity53.3%
*-commutative53.3%
neg-mul-153.3%
sub-neg53.3%
flip-+97.2%
+-commutative97.2%
Applied egg-rr97.2%
associate-/l/97.2%
associate-/r*99.7%
Simplified99.7%
div-inv99.7%
clear-num99.7%
*-commutative99.7%
associate-/l/97.2%
*-commutative97.2%
div-inv97.3%
div-inv97.3%
metadata-eval97.3%
times-frac99.6%
Applied egg-rr99.6%
Taylor expanded in a around 0 99.6%
associate-*r/99.7%
associate-/r*99.8%
*-commutative99.8%
Applied egg-rr99.8%
Final simplification96.1%
(FPCore (a b) :precision binary64 (let* ((t_0 (/ 0.5 (* a b)))) (if (<= a -1.65e-80) (* t_0 (/ PI a)) (* t_0 (/ PI b)))))
double code(double a, double b) {
double t_0 = 0.5 / (a * b);
double tmp;
if (a <= -1.65e-80) {
tmp = t_0 * (((double) M_PI) / a);
} else {
tmp = t_0 * (((double) M_PI) / b);
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = 0.5 / (a * b);
double tmp;
if (a <= -1.65e-80) {
tmp = t_0 * (Math.PI / a);
} else {
tmp = t_0 * (Math.PI / b);
}
return tmp;
}
def code(a, b): t_0 = 0.5 / (a * b) tmp = 0 if a <= -1.65e-80: tmp = t_0 * (math.pi / a) else: tmp = t_0 * (math.pi / b) return tmp
function code(a, b) t_0 = Float64(0.5 / Float64(a * b)) tmp = 0.0 if (a <= -1.65e-80) tmp = Float64(t_0 * Float64(pi / a)); else tmp = Float64(t_0 * Float64(pi / b)); end return tmp end
function tmp_2 = code(a, b) t_0 = 0.5 / (a * b); tmp = 0.0; if (a <= -1.65e-80) tmp = t_0 * (pi / a); else tmp = t_0 * (pi / b); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(0.5 / N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.65e-80], N[(t$95$0 * N[(Pi / a), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(Pi / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{0.5}{a \cdot b}\\
\mathbf{if}\;a \leq -1.65 \cdot 10^{-80}:\\
\;\;\;\;t\_0 \cdot \frac{\pi}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{\pi}{b}\\
\end{array}
\end{array}
if a < -1.65e-80Initial program 80.2%
associate-*l*80.1%
*-rgt-identity80.1%
associate-/l*80.1%
metadata-eval80.1%
associate-*l/80.1%
*-lft-identity80.1%
sub-neg80.1%
distribute-neg-frac80.1%
metadata-eval80.1%
Simplified80.1%
metadata-eval80.1%
div-inv80.1%
clear-num80.1%
clear-num79.1%
frac-times79.0%
metadata-eval79.0%
frac-add79.0%
associate-/r/79.1%
*-un-lft-identity79.1%
*-commutative79.1%
neg-mul-179.1%
sub-neg79.1%
flip-+97.8%
+-commutative97.8%
Applied egg-rr97.8%
associate-/l/97.9%
associate-/r*99.6%
Simplified99.6%
div-inv99.6%
clear-num99.6%
*-commutative99.6%
associate-/l/97.9%
*-commutative97.9%
div-inv98.0%
div-inv98.0%
metadata-eval98.0%
times-frac99.7%
Applied egg-rr99.7%
Taylor expanded in a around inf 87.6%
if -1.65e-80 < a Initial program 76.1%
associate-*l*76.1%
*-rgt-identity76.1%
associate-/l*76.1%
metadata-eval76.1%
associate-*l/76.2%
*-lft-identity76.2%
sub-neg76.2%
distribute-neg-frac76.2%
metadata-eval76.2%
Simplified76.2%
metadata-eval76.2%
div-inv76.2%
clear-num76.2%
clear-num75.7%
frac-times75.7%
metadata-eval75.7%
frac-add75.7%
associate-/r/75.7%
*-un-lft-identity75.7%
*-commutative75.7%
neg-mul-175.7%
sub-neg75.7%
flip-+98.6%
+-commutative98.6%
Applied egg-rr98.6%
associate-/l/98.6%
associate-/r*99.6%
Simplified99.6%
div-inv99.7%
clear-num99.7%
*-commutative99.7%
associate-/l/98.7%
*-commutative98.7%
div-inv98.7%
div-inv98.7%
metadata-eval98.7%
times-frac99.6%
Applied egg-rr99.6%
Taylor expanded in a around 0 75.9%
Final simplification79.2%
(FPCore (a b) :precision binary64 (if (<= a -2.8e-62) (* (/ 0.5 (* a b)) (/ PI a)) (* PI (/ (/ 0.5 b) (* a b)))))
double code(double a, double b) {
double tmp;
if (a <= -2.8e-62) {
tmp = (0.5 / (a * b)) * (((double) M_PI) / a);
} else {
tmp = ((double) M_PI) * ((0.5 / b) / (a * b));
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -2.8e-62) {
tmp = (0.5 / (a * b)) * (Math.PI / a);
} else {
tmp = Math.PI * ((0.5 / b) / (a * b));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2.8e-62: tmp = (0.5 / (a * b)) * (math.pi / a) else: tmp = math.pi * ((0.5 / b) / (a * b)) return tmp
function code(a, b) tmp = 0.0 if (a <= -2.8e-62) tmp = Float64(Float64(0.5 / Float64(a * b)) * Float64(pi / a)); else tmp = Float64(pi * Float64(Float64(0.5 / b) / Float64(a * b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2.8e-62) tmp = (0.5 / (a * b)) * (pi / a); else tmp = pi * ((0.5 / b) / (a * b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2.8e-62], N[(N[(0.5 / N[(a * b), $MachinePrecision]), $MachinePrecision] * N[(Pi / a), $MachinePrecision]), $MachinePrecision], N[(Pi * N[(N[(0.5 / b), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.8 \cdot 10^{-62}:\\
\;\;\;\;\frac{0.5}{a \cdot b} \cdot \frac{\pi}{a}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \frac{\frac{0.5}{b}}{a \cdot b}\\
\end{array}
\end{array}
if a < -2.80000000000000002e-62Initial program 79.3%
associate-*l*79.2%
*-rgt-identity79.2%
associate-/l*79.2%
metadata-eval79.2%
associate-*l/79.3%
*-lft-identity79.3%
sub-neg79.3%
distribute-neg-frac79.3%
metadata-eval79.3%
Simplified79.3%
metadata-eval79.3%
div-inv79.3%
clear-num79.3%
clear-num78.2%
frac-times78.1%
metadata-eval78.1%
frac-add78.1%
associate-/r/78.2%
*-un-lft-identity78.2%
*-commutative78.2%
neg-mul-178.2%
sub-neg78.2%
flip-+97.7%
+-commutative97.7%
Applied egg-rr97.7%
associate-/l/97.8%
associate-/r*99.6%
Simplified99.6%
div-inv99.6%
clear-num99.6%
*-commutative99.6%
associate-/l/97.8%
*-commutative97.8%
div-inv98.0%
div-inv98.0%
metadata-eval98.0%
times-frac99.7%
Applied egg-rr99.7%
Taylor expanded in a around inf 87.0%
if -2.80000000000000002e-62 < a Initial program 76.5%
associate-*l*76.5%
*-rgt-identity76.5%
associate-/l*76.5%
metadata-eval76.5%
associate-*l/76.5%
*-lft-identity76.5%
sub-neg76.5%
distribute-neg-frac76.5%
metadata-eval76.5%
Simplified76.5%
metadata-eval76.5%
div-inv76.5%
clear-num76.5%
clear-num76.1%
frac-times76.1%
metadata-eval76.1%
frac-add76.1%
associate-/r/76.1%
*-un-lft-identity76.1%
*-commutative76.1%
neg-mul-176.1%
sub-neg76.1%
flip-+98.7%
+-commutative98.7%
Applied egg-rr98.7%
associate-/l/98.6%
associate-/r*99.6%
Simplified99.6%
div-inv99.7%
clear-num99.7%
*-commutative99.7%
div-inv99.7%
metadata-eval99.7%
associate-*l*99.7%
associate-/l/98.7%
*-commutative98.7%
div-inv98.7%
*-commutative98.7%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in a around 0 75.3%
Final simplification78.5%
(FPCore (a b) :precision binary64 (if (<= a -2.8e-62) (/ (* 0.5 (/ PI a)) (* a b)) (* PI (/ (/ 0.5 b) (* a b)))))
double code(double a, double b) {
double tmp;
if (a <= -2.8e-62) {
tmp = (0.5 * (((double) M_PI) / a)) / (a * b);
} else {
tmp = ((double) M_PI) * ((0.5 / b) / (a * b));
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -2.8e-62) {
tmp = (0.5 * (Math.PI / a)) / (a * b);
} else {
tmp = Math.PI * ((0.5 / b) / (a * b));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2.8e-62: tmp = (0.5 * (math.pi / a)) / (a * b) else: tmp = math.pi * ((0.5 / b) / (a * b)) return tmp
function code(a, b) tmp = 0.0 if (a <= -2.8e-62) tmp = Float64(Float64(0.5 * Float64(pi / a)) / Float64(a * b)); else tmp = Float64(pi * Float64(Float64(0.5 / b) / Float64(a * b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2.8e-62) tmp = (0.5 * (pi / a)) / (a * b); else tmp = pi * ((0.5 / b) / (a * b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2.8e-62], N[(N[(0.5 * N[(Pi / a), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision], N[(Pi * N[(N[(0.5 / b), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.8 \cdot 10^{-62}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \frac{\frac{0.5}{b}}{a \cdot b}\\
\end{array}
\end{array}
if a < -2.80000000000000002e-62Initial program 79.3%
associate-*l*79.2%
*-rgt-identity79.2%
associate-/l*79.2%
metadata-eval79.2%
associate-*l/79.3%
*-lft-identity79.3%
sub-neg79.3%
distribute-neg-frac79.3%
metadata-eval79.3%
Simplified79.3%
*-un-lft-identity79.3%
clear-num78.2%
frac-add78.2%
associate-/r/78.3%
*-un-lft-identity78.3%
*-commutative78.3%
neg-mul-178.3%
sub-neg78.3%
flip-+97.8%
+-commutative97.8%
Applied egg-rr97.8%
*-lft-identity97.8%
associate-/r*99.6%
Simplified99.6%
metadata-eval99.6%
div-inv99.6%
clear-num99.6%
associate-/l/97.8%
*-commutative97.8%
frac-times97.7%
metadata-eval97.7%
Applied egg-rr97.7%
*-commutative97.7%
associate-/r*97.8%
associate-/r*99.6%
associate-/r/99.6%
associate-/r*99.6%
*-commutative99.6%
associate-/r*99.6%
associate-/l/99.6%
associate-/r*99.6%
metadata-eval99.6%
*-commutative99.6%
associate-*r/99.7%
associate-/l*99.8%
associate-/l/98.0%
distribute-lft-out83.7%
associate-*l*83.7%
unpow283.7%
*-commutative83.7%
Simplified99.9%
Taylor expanded in b around 0 87.2%
*-commutative85.2%
Simplified87.2%
if -2.80000000000000002e-62 < a Initial program 76.5%
associate-*l*76.5%
*-rgt-identity76.5%
associate-/l*76.5%
metadata-eval76.5%
associate-*l/76.5%
*-lft-identity76.5%
sub-neg76.5%
distribute-neg-frac76.5%
metadata-eval76.5%
Simplified76.5%
metadata-eval76.5%
div-inv76.5%
clear-num76.5%
clear-num76.1%
frac-times76.1%
metadata-eval76.1%
frac-add76.1%
associate-/r/76.1%
*-un-lft-identity76.1%
*-commutative76.1%
neg-mul-176.1%
sub-neg76.1%
flip-+98.7%
+-commutative98.7%
Applied egg-rr98.7%
associate-/l/98.6%
associate-/r*99.6%
Simplified99.6%
div-inv99.7%
clear-num99.7%
*-commutative99.7%
div-inv99.7%
metadata-eval99.7%
associate-*l*99.7%
associate-/l/98.7%
*-commutative98.7%
div-inv98.7%
*-commutative98.7%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in a around 0 75.3%
Final simplification78.5%
(FPCore (a b) :precision binary64 (if (<= a -2.8e-62) (/ (* 0.5 (/ PI a)) (* a b)) (/ (/ (* 0.5 (/ PI b)) a) b)))
double code(double a, double b) {
double tmp;
if (a <= -2.8e-62) {
tmp = (0.5 * (((double) M_PI) / a)) / (a * b);
} else {
tmp = ((0.5 * (((double) M_PI) / b)) / a) / b;
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -2.8e-62) {
tmp = (0.5 * (Math.PI / a)) / (a * b);
} else {
tmp = ((0.5 * (Math.PI / b)) / a) / b;
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2.8e-62: tmp = (0.5 * (math.pi / a)) / (a * b) else: tmp = ((0.5 * (math.pi / b)) / a) / b return tmp
function code(a, b) tmp = 0.0 if (a <= -2.8e-62) tmp = Float64(Float64(0.5 * Float64(pi / a)) / Float64(a * b)); else tmp = Float64(Float64(Float64(0.5 * Float64(pi / b)) / a) / b); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2.8e-62) tmp = (0.5 * (pi / a)) / (a * b); else tmp = ((0.5 * (pi / b)) / a) / b; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2.8e-62], N[(N[(0.5 * N[(Pi / a), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[(Pi / b), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.8 \cdot 10^{-62}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5 \cdot \frac{\pi}{b}}{a}}{b}\\
\end{array}
\end{array}
if a < -2.80000000000000002e-62Initial program 79.3%
associate-*l*79.2%
*-rgt-identity79.2%
associate-/l*79.2%
metadata-eval79.2%
associate-*l/79.3%
*-lft-identity79.3%
sub-neg79.3%
distribute-neg-frac79.3%
metadata-eval79.3%
Simplified79.3%
*-un-lft-identity79.3%
clear-num78.2%
frac-add78.2%
associate-/r/78.3%
*-un-lft-identity78.3%
*-commutative78.3%
neg-mul-178.3%
sub-neg78.3%
flip-+97.8%
+-commutative97.8%
Applied egg-rr97.8%
*-lft-identity97.8%
associate-/r*99.6%
Simplified99.6%
metadata-eval99.6%
div-inv99.6%
clear-num99.6%
associate-/l/97.8%
*-commutative97.8%
frac-times97.7%
metadata-eval97.7%
Applied egg-rr97.7%
*-commutative97.7%
associate-/r*97.8%
associate-/r*99.6%
associate-/r/99.6%
associate-/r*99.6%
*-commutative99.6%
associate-/r*99.6%
associate-/l/99.6%
associate-/r*99.6%
metadata-eval99.6%
*-commutative99.6%
associate-*r/99.7%
associate-/l*99.8%
associate-/l/98.0%
distribute-lft-out83.7%
associate-*l*83.7%
unpow283.7%
*-commutative83.7%
Simplified99.9%
Taylor expanded in b around 0 87.2%
*-commutative85.2%
Simplified87.2%
if -2.80000000000000002e-62 < a Initial program 76.5%
associate-*l*76.5%
*-rgt-identity76.5%
associate-/l*76.5%
metadata-eval76.5%
associate-*l/76.5%
*-lft-identity76.5%
sub-neg76.5%
distribute-neg-frac76.5%
metadata-eval76.5%
Simplified76.5%
metadata-eval76.5%
div-inv76.5%
clear-num76.5%
clear-num76.1%
frac-times76.1%
metadata-eval76.1%
frac-add76.1%
associate-/r/76.1%
*-un-lft-identity76.1%
*-commutative76.1%
neg-mul-176.1%
sub-neg76.1%
flip-+98.7%
+-commutative98.7%
Applied egg-rr98.7%
associate-/l/98.6%
associate-/r*99.6%
Simplified99.6%
div-inv99.7%
clear-num99.7%
*-commutative99.7%
associate-/l/98.7%
*-commutative98.7%
div-inv98.7%
div-inv98.7%
metadata-eval98.7%
times-frac99.6%
Applied egg-rr99.6%
Taylor expanded in a around 0 75.3%
associate-*r/75.3%
associate-/r*75.3%
*-commutative75.3%
Applied egg-rr75.3%
Final simplification78.6%
(FPCore (a b) :precision binary64 (* PI (/ 0.5 (* (+ a b) (* a b)))))
double code(double a, double b) {
return ((double) M_PI) * (0.5 / ((a + b) * (a * b)));
}
public static double code(double a, double b) {
return Math.PI * (0.5 / ((a + b) * (a * b)));
}
def code(a, b): return math.pi * (0.5 / ((a + b) * (a * b)))
function code(a, b) return Float64(pi * Float64(0.5 / Float64(Float64(a + b) * Float64(a * b)))) end
function tmp = code(a, b) tmp = pi * (0.5 / ((a + b) * (a * b))); end
code[a_, b_] := N[(Pi * N[(0.5 / N[(N[(a + b), $MachinePrecision] * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \frac{0.5}{\left(a + b\right) \cdot \left(a \cdot b\right)}
\end{array}
Initial program 77.2%
*-commutative77.2%
associate-*r*77.2%
associate-*r/77.3%
associate-*r*77.3%
*-rgt-identity77.3%
sub-neg77.3%
distribute-neg-frac77.3%
metadata-eval77.3%
Simplified77.3%
associate-*l/77.3%
div-inv77.3%
metadata-eval77.3%
*-commutative77.3%
associate-*r*77.3%
Applied egg-rr98.5%
Final simplification98.5%
(FPCore (a b) :precision binary64 (* (/ PI (+ a b)) (/ 0.5 (* a b))))
double code(double a, double b) {
return (((double) M_PI) / (a + b)) * (0.5 / (a * b));
}
public static double code(double a, double b) {
return (Math.PI / (a + b)) * (0.5 / (a * b));
}
def code(a, b): return (math.pi / (a + b)) * (0.5 / (a * b))
function code(a, b) return Float64(Float64(pi / Float64(a + b)) * Float64(0.5 / Float64(a * b))) end
function tmp = code(a, b) tmp = (pi / (a + b)) * (0.5 / (a * b)); end
code[a_, b_] := N[(N[(Pi / N[(a + b), $MachinePrecision]), $MachinePrecision] * N[(0.5 / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi}{a + b} \cdot \frac{0.5}{a \cdot b}
\end{array}
Initial program 77.2%
associate-*l*77.2%
*-rgt-identity77.2%
associate-/l*77.2%
metadata-eval77.2%
associate-*l/77.3%
*-lft-identity77.3%
sub-neg77.3%
distribute-neg-frac77.3%
metadata-eval77.3%
Simplified77.3%
metadata-eval77.3%
div-inv77.3%
clear-num77.3%
clear-num76.7%
frac-times76.7%
metadata-eval76.7%
frac-add76.6%
associate-/r/76.7%
*-un-lft-identity76.7%
*-commutative76.7%
neg-mul-176.7%
sub-neg76.7%
flip-+98.4%
+-commutative98.4%
Applied egg-rr98.4%
associate-/l/98.4%
associate-/r*99.6%
Simplified99.6%
div-inv99.7%
clear-num99.7%
*-commutative99.7%
associate-/l/98.5%
*-commutative98.5%
div-inv98.5%
div-inv98.5%
metadata-eval98.5%
times-frac99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (a b) :precision binary64 (* PI (/ 0.5 (* a (* a b)))))
double code(double a, double b) {
return ((double) M_PI) * (0.5 / (a * (a * b)));
}
public static double code(double a, double b) {
return Math.PI * (0.5 / (a * (a * b)));
}
def code(a, b): return math.pi * (0.5 / (a * (a * b)))
function code(a, b) return Float64(pi * Float64(0.5 / Float64(a * Float64(a * b)))) end
function tmp = code(a, b) tmp = pi * (0.5 / (a * (a * b))); end
code[a_, b_] := N[(Pi * N[(0.5 / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \frac{0.5}{a \cdot \left(a \cdot b\right)}
\end{array}
Initial program 77.2%
*-commutative77.2%
associate-*r*77.2%
associate-*r/77.3%
associate-*r*77.3%
*-rgt-identity77.3%
sub-neg77.3%
distribute-neg-frac77.3%
metadata-eval77.3%
Simplified77.3%
associate-*l/77.3%
div-inv77.3%
metadata-eval77.3%
*-commutative77.3%
associate-*r*77.3%
Applied egg-rr98.5%
Taylor expanded in a around 0 83.9%
unpow283.9%
distribute-rgt-in89.7%
Simplified89.7%
Taylor expanded in b around 0 60.8%
*-commutative60.8%
Simplified60.8%
Final simplification60.8%
(FPCore (a b) :precision binary64 (* (/ 0.5 (* a b)) (/ PI a)))
double code(double a, double b) {
return (0.5 / (a * b)) * (((double) M_PI) / a);
}
public static double code(double a, double b) {
return (0.5 / (a * b)) * (Math.PI / a);
}
def code(a, b): return (0.5 / (a * b)) * (math.pi / a)
function code(a, b) return Float64(Float64(0.5 / Float64(a * b)) * Float64(pi / a)) end
function tmp = code(a, b) tmp = (0.5 / (a * b)) * (pi / a); end
code[a_, b_] := N[(N[(0.5 / N[(a * b), $MachinePrecision]), $MachinePrecision] * N[(Pi / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{a \cdot b} \cdot \frac{\pi}{a}
\end{array}
Initial program 77.2%
associate-*l*77.2%
*-rgt-identity77.2%
associate-/l*77.2%
metadata-eval77.2%
associate-*l/77.3%
*-lft-identity77.3%
sub-neg77.3%
distribute-neg-frac77.3%
metadata-eval77.3%
Simplified77.3%
metadata-eval77.3%
div-inv77.3%
clear-num77.3%
clear-num76.7%
frac-times76.7%
metadata-eval76.7%
frac-add76.6%
associate-/r/76.7%
*-un-lft-identity76.7%
*-commutative76.7%
neg-mul-176.7%
sub-neg76.7%
flip-+98.4%
+-commutative98.4%
Applied egg-rr98.4%
associate-/l/98.4%
associate-/r*99.6%
Simplified99.6%
div-inv99.7%
clear-num99.7%
*-commutative99.7%
associate-/l/98.5%
*-commutative98.5%
div-inv98.5%
div-inv98.5%
metadata-eval98.5%
times-frac99.6%
Applied egg-rr99.6%
Taylor expanded in a around inf 61.3%
Final simplification61.3%
herbie shell --seed 2024130
(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))))