
(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 9 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 (/ (/ 0.5 (/ (+ a b) PI)) (* a b)))
double code(double a, double b) {
return (0.5 / ((a + b) / ((double) M_PI))) / (a * b);
}
public static double code(double a, double b) {
return (0.5 / ((a + b) / Math.PI)) / (a * b);
}
def code(a, b): return (0.5 / ((a + b) / math.pi)) / (a * b)
function code(a, b) return Float64(Float64(0.5 / Float64(Float64(a + b) / pi)) / Float64(a * b)) end
function tmp = code(a, b) tmp = (0.5 / ((a + b) / pi)) / (a * b); end
code[a_, b_] := N[(N[(0.5 / N[(N[(a + b), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5}{\frac{a + b}{\pi}}}{a \cdot b}
\end{array}
Initial program 78.3%
un-div-inv78.3%
difference-of-squares86.5%
associate-/r*87.7%
div-inv87.7%
metadata-eval87.7%
Applied egg-rr87.7%
frac-sub87.7%
frac-times99.5%
associate-/l*99.4%
*-un-lft-identity99.4%
*-commutative99.4%
Applied egg-rr99.4%
*-rgt-identity99.4%
associate-/l*99.4%
associate-*r/99.4%
*-commutative99.4%
+-commutative99.4%
*-commutative99.4%
Simplified99.4%
clear-num99.4%
+-commutative99.4%
*-commutative99.4%
clear-num99.4%
frac-times99.4%
metadata-eval99.4%
*-un-lft-identity99.4%
*-commutative99.4%
times-frac99.4%
metadata-eval99.4%
+-commutative99.4%
*-commutative99.4%
*-commutative99.4%
*-un-lft-identity99.4%
times-frac99.4%
*-commutative99.4%
Applied egg-rr99.4%
*-rgt-identity99.4%
/-rgt-identity99.4%
associate-/r*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
(FPCore (a b) :precision binary64 (if (<= a -2e+150) (/ (* 0.5 (/ PI a)) (* a b)) (* (/ (/ 0.5 (+ a b)) a) (/ PI b))))
double code(double a, double b) {
double tmp;
if (a <= -2e+150) {
tmp = (0.5 * (((double) M_PI) / a)) / (a * b);
} else {
tmp = ((0.5 / (a + b)) / a) * (((double) M_PI) / b);
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -2e+150) {
tmp = (0.5 * (Math.PI / a)) / (a * b);
} else {
tmp = ((0.5 / (a + b)) / a) * (Math.PI / b);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2e+150: tmp = (0.5 * (math.pi / a)) / (a * b) else: tmp = ((0.5 / (a + b)) / a) * (math.pi / b) return tmp
function code(a, b) tmp = 0.0 if (a <= -2e+150) 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
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2e+150) tmp = (0.5 * (pi / a)) / (a * b); else tmp = ((0.5 / (a + b)) / a) * (pi / b); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2e+150], 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}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{+150}:\\
\;\;\;\;\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 < -1.99999999999999996e150Initial program 46.2%
un-div-inv46.2%
difference-of-squares72.7%
associate-/r*74.1%
div-inv74.1%
metadata-eval74.1%
Applied egg-rr74.1%
frac-sub74.1%
frac-times99.8%
associate-/l*99.8%
*-un-lft-identity99.8%
*-commutative99.8%
Applied egg-rr99.8%
*-rgt-identity99.8%
associate-/l*99.7%
associate-*r/99.7%
*-commutative99.7%
+-commutative99.7%
*-commutative99.7%
Simplified99.7%
clear-num99.7%
+-commutative99.7%
*-commutative99.7%
clear-num99.7%
frac-times99.9%
metadata-eval99.9%
*-un-lft-identity99.9%
*-commutative99.9%
times-frac99.9%
metadata-eval99.9%
+-commutative99.9%
*-commutative99.9%
*-commutative99.9%
*-un-lft-identity99.9%
times-frac99.8%
*-commutative99.8%
Applied egg-rr99.8%
*-rgt-identity99.8%
/-rgt-identity99.8%
associate-/r*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around inf 99.8%
if -1.99999999999999996e150 < a Initial program 83.2%
un-div-inv83.2%
difference-of-squares88.7%
associate-/r*89.8%
div-inv89.8%
metadata-eval89.8%
Applied egg-rr89.8%
frac-sub89.8%
frac-times99.4%
associate-/l*99.4%
*-un-lft-identity99.4%
*-commutative99.4%
Applied egg-rr99.4%
*-rgt-identity99.4%
associate-/l*99.3%
associate-*r/99.4%
*-commutative99.4%
+-commutative99.4%
*-commutative99.4%
Simplified99.4%
clear-num99.4%
+-commutative99.4%
*-commutative99.4%
clear-num99.4%
frac-times99.3%
metadata-eval99.3%
*-un-lft-identity99.3%
*-commutative99.3%
times-frac99.3%
metadata-eval99.3%
+-commutative99.3%
*-commutative99.3%
*-commutative99.3%
*-un-lft-identity99.3%
times-frac99.4%
*-commutative99.4%
Applied egg-rr99.4%
*-rgt-identity99.4%
/-rgt-identity99.4%
associate-/r*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
associate-/r/99.6%
times-frac97.4%
Applied egg-rr97.4%
(FPCore (a b) :precision binary64 (if (<= a -2.55e+103) (/ (* 0.5 (/ PI a)) (* a b)) (* (/ 0.5 b) (/ (/ PI (+ a b)) a))))
double code(double a, double b) {
double tmp;
if (a <= -2.55e+103) {
tmp = (0.5 * (((double) M_PI) / a)) / (a * b);
} else {
tmp = (0.5 / b) * ((((double) M_PI) / (a + b)) / a);
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -2.55e+103) {
tmp = (0.5 * (Math.PI / a)) / (a * b);
} else {
tmp = (0.5 / b) * ((Math.PI / (a + b)) / a);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2.55e+103: tmp = (0.5 * (math.pi / a)) / (a * b) else: tmp = (0.5 / b) * ((math.pi / (a + b)) / a) return tmp
function code(a, b) tmp = 0.0 if (a <= -2.55e+103) tmp = Float64(Float64(0.5 * Float64(pi / a)) / Float64(a * b)); else tmp = Float64(Float64(0.5 / b) * Float64(Float64(pi / Float64(a + b)) / a)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2.55e+103) tmp = (0.5 * (pi / a)) / (a * b); else tmp = (0.5 / b) * ((pi / (a + b)) / a); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2.55e+103], N[(N[(0.5 * N[(Pi / a), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / b), $MachinePrecision] * N[(N[(Pi / N[(a + b), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.55 \cdot 10^{+103}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{b} \cdot \frac{\frac{\pi}{a + b}}{a}\\
\end{array}
\end{array}
if a < -2.5500000000000001e103Initial program 50.5%
un-div-inv50.5%
difference-of-squares74.8%
associate-/r*76.1%
div-inv76.1%
metadata-eval76.1%
Applied egg-rr76.1%
frac-sub76.1%
frac-times99.7%
associate-/l*99.7%
*-un-lft-identity99.7%
*-commutative99.7%
Applied egg-rr99.7%
*-rgt-identity99.7%
associate-/l*99.7%
associate-*r/99.7%
*-commutative99.7%
+-commutative99.7%
*-commutative99.7%
Simplified99.7%
clear-num99.7%
+-commutative99.7%
*-commutative99.7%
clear-num99.7%
frac-times99.8%
metadata-eval99.8%
*-un-lft-identity99.8%
*-commutative99.8%
times-frac99.8%
metadata-eval99.8%
+-commutative99.8%
*-commutative99.8%
*-commutative99.8%
*-un-lft-identity99.8%
times-frac99.7%
*-commutative99.7%
Applied egg-rr99.7%
*-rgt-identity99.7%
/-rgt-identity99.7%
associate-/r*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around inf 99.7%
if -2.5500000000000001e103 < a Initial program 83.0%
un-div-inv83.0%
difference-of-squares88.5%
associate-/r*89.7%
div-inv89.7%
metadata-eval89.7%
Applied egg-rr89.7%
frac-sub89.7%
frac-times99.4%
associate-/l*99.4%
*-un-lft-identity99.4%
*-commutative99.4%
Applied egg-rr99.4%
*-rgt-identity99.4%
associate-/l*99.3%
associate-*r/99.4%
*-commutative99.4%
+-commutative99.4%
*-commutative99.4%
Simplified99.4%
clear-num99.4%
+-commutative99.4%
*-commutative99.4%
clear-num99.4%
frac-times99.4%
metadata-eval99.4%
*-un-lft-identity99.4%
*-commutative99.4%
times-frac99.4%
metadata-eval99.4%
+-commutative99.4%
*-commutative99.4%
*-commutative99.4%
*-un-lft-identity99.4%
times-frac99.4%
*-commutative99.4%
Applied egg-rr99.4%
*-rgt-identity99.4%
/-rgt-identity99.4%
associate-/r*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
div-inv99.7%
*-commutative99.7%
times-frac97.4%
clear-num97.4%
Applied egg-rr97.4%
(FPCore (a b) :precision binary64 (if (<= a -2.4e-96) (/ (* 0.5 PI) (* a (* a b))) (/ (* 0.5 (/ PI (* a b))) b)))
double code(double a, double b) {
double tmp;
if (a <= -2.4e-96) {
tmp = (0.5 * ((double) M_PI)) / (a * (a * b));
} else {
tmp = (0.5 * (((double) M_PI) / (a * b))) / b;
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -2.4e-96) {
tmp = (0.5 * Math.PI) / (a * (a * b));
} else {
tmp = (0.5 * (Math.PI / (a * b))) / b;
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2.4e-96: tmp = (0.5 * math.pi) / (a * (a * b)) else: tmp = (0.5 * (math.pi / (a * b))) / b return tmp
function code(a, b) tmp = 0.0 if (a <= -2.4e-96) tmp = Float64(Float64(0.5 * pi) / Float64(a * Float64(a * b))); else tmp = Float64(Float64(0.5 * Float64(pi / Float64(a * b))) / b); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2.4e-96) tmp = (0.5 * pi) / (a * (a * b)); else tmp = (0.5 * (pi / (a * b))) / b; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2.4e-96], N[(N[(0.5 * Pi), $MachinePrecision] / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(Pi / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{-96}:\\
\;\;\;\;\frac{0.5 \cdot \pi}{a \cdot \left(a \cdot b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{a \cdot b}}{b}\\
\end{array}
\end{array}
if a < -2.40000000000000019e-96Initial program 75.0%
un-div-inv75.1%
difference-of-squares86.6%
associate-/r*87.2%
div-inv87.2%
metadata-eval87.2%
Applied egg-rr87.2%
frac-sub87.2%
frac-times99.3%
associate-/l*99.1%
*-un-lft-identity99.1%
*-commutative99.1%
Applied egg-rr99.1%
*-rgt-identity99.1%
associate-/l*99.2%
associate-*r/99.3%
*-commutative99.3%
+-commutative99.3%
*-commutative99.3%
Simplified99.3%
*-commutative99.3%
associate-/r*99.6%
pow199.6%
pow199.6%
pow-div99.6%
metadata-eval99.6%
metadata-eval99.6%
*-commutative99.6%
+-commutative99.6%
frac-times99.4%
*-un-lft-identity99.4%
*-commutative99.4%
+-commutative99.4%
Applied egg-rr99.4%
Taylor expanded in a around inf 84.7%
if -2.40000000000000019e-96 < a Initial program 79.7%
un-div-inv79.7%
difference-of-squares86.5%
associate-/r*87.9%
div-inv87.9%
metadata-eval87.9%
Applied egg-rr87.9%
*-commutative87.9%
frac-sub87.9%
frac-times99.5%
*-un-lft-identity99.5%
associate-/l*99.5%
*-commutative99.5%
Applied egg-rr99.5%
associate-*r*98.9%
*-commutative98.9%
*-commutative98.9%
associate-*r*95.8%
times-frac87.0%
*-rgt-identity87.0%
+-commutative87.0%
Applied egg-rr87.0%
associate-*r/95.9%
times-frac96.9%
*-inverses96.9%
*-lft-identity96.9%
Simplified96.9%
Taylor expanded in a around 0 76.3%
Final simplification78.8%
(FPCore (a b) :precision binary64 (if (<= a -2.5e-96) (/ (* 0.5 PI) (* a (* a b))) (/ (* 0.5 PI) (* b (* a b)))))
double code(double a, double b) {
double tmp;
if (a <= -2.5e-96) {
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.5e-96) {
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.5e-96: 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.5e-96) tmp = Float64(Float64(0.5 * pi) / Float64(a * Float64(a * b))); else tmp = Float64(Float64(0.5 * pi) / Float64(b * Float64(a * b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2.5e-96) 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.5e-96], N[(N[(0.5 * Pi), $MachinePrecision] / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * Pi), $MachinePrecision] / N[(b * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.5 \cdot 10^{-96}:\\
\;\;\;\;\frac{0.5 \cdot \pi}{a \cdot \left(a \cdot b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \pi}{b \cdot \left(a \cdot b\right)}\\
\end{array}
\end{array}
if a < -2.49999999999999997e-96Initial program 75.0%
un-div-inv75.1%
difference-of-squares86.6%
associate-/r*87.2%
div-inv87.2%
metadata-eval87.2%
Applied egg-rr87.2%
frac-sub87.2%
frac-times99.3%
associate-/l*99.1%
*-un-lft-identity99.1%
*-commutative99.1%
Applied egg-rr99.1%
*-rgt-identity99.1%
associate-/l*99.2%
associate-*r/99.3%
*-commutative99.3%
+-commutative99.3%
*-commutative99.3%
Simplified99.3%
*-commutative99.3%
associate-/r*99.6%
pow199.6%
pow199.6%
pow-div99.6%
metadata-eval99.6%
metadata-eval99.6%
*-commutative99.6%
+-commutative99.6%
frac-times99.4%
*-un-lft-identity99.4%
*-commutative99.4%
+-commutative99.4%
Applied egg-rr99.4%
Taylor expanded in a around inf 84.7%
if -2.49999999999999997e-96 < a Initial program 79.7%
un-div-inv79.7%
difference-of-squares86.5%
associate-/r*87.9%
div-inv87.9%
metadata-eval87.9%
Applied egg-rr87.9%
frac-sub87.9%
frac-times99.5%
associate-/l*99.5%
*-un-lft-identity99.5%
*-commutative99.5%
Applied egg-rr99.5%
*-rgt-identity99.5%
associate-/l*99.5%
associate-*r/99.5%
*-commutative99.5%
+-commutative99.5%
*-commutative99.5%
Simplified99.5%
*-commutative99.5%
associate-/r*99.7%
pow199.7%
pow199.7%
pow-div99.7%
metadata-eval99.7%
metadata-eval99.7%
*-commutative99.7%
+-commutative99.7%
frac-times99.6%
*-un-lft-identity99.6%
*-commutative99.6%
+-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in a around 0 76.4%
Final simplification78.9%
(FPCore (a b) :precision binary64 (/ (/ 0.5 (+ a b)) (* b (/ a PI))))
double code(double a, double b) {
return (0.5 / (a + b)) / (b * (a / ((double) M_PI)));
}
public static double code(double a, double b) {
return (0.5 / (a + b)) / (b * (a / Math.PI));
}
def code(a, b): return (0.5 / (a + b)) / (b * (a / math.pi))
function code(a, b) return Float64(Float64(0.5 / Float64(a + b)) / Float64(b * Float64(a / pi))) end
function tmp = code(a, b) tmp = (0.5 / (a + b)) / (b * (a / pi)); end
code[a_, b_] := N[(N[(0.5 / N[(a + b), $MachinePrecision]), $MachinePrecision] / N[(b * N[(a / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5}{a + b}}{b \cdot \frac{a}{\pi}}
\end{array}
Initial program 78.3%
un-div-inv78.3%
difference-of-squares86.5%
associate-/r*87.7%
div-inv87.7%
metadata-eval87.7%
Applied egg-rr87.7%
associate-*l/99.6%
associate-/l*99.6%
Applied egg-rr99.6%
associate-/l*99.6%
associate-*r/99.6%
*-commutative99.6%
+-commutative99.6%
sub-neg99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in a around 0 99.7%
un-div-inv99.7%
div-inv99.7%
*-commutative99.7%
associate-*r*99.7%
div-inv99.7%
frac-times93.1%
clear-num93.0%
frac-times99.6%
*-un-lft-identity99.6%
Applied egg-rr99.6%
Final simplification99.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(Float64(pi * Float64(0.5 / 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[(N[(Pi * N[(0.5 / N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi \cdot \frac{0.5}{a + b}}{a \cdot b}
\end{array}
Initial program 78.3%
un-div-inv78.3%
difference-of-squares86.5%
associate-/r*87.7%
div-inv87.7%
metadata-eval87.7%
Applied egg-rr87.7%
frac-sub87.7%
frac-times99.5%
associate-/l*99.4%
*-un-lft-identity99.4%
*-commutative99.4%
Applied egg-rr99.4%
*-rgt-identity99.4%
associate-/l*99.4%
associate-*r/99.4%
*-commutative99.4%
+-commutative99.4%
*-commutative99.4%
Simplified99.4%
*-commutative99.4%
clear-num99.4%
+-commutative99.4%
frac-times99.5%
*-un-lft-identity99.5%
*-commutative99.5%
*-commutative99.5%
*-un-lft-identity99.5%
times-frac99.5%
*-commutative99.5%
pow199.5%
pow199.5%
pow-div99.5%
metadata-eval99.5%
metadata-eval99.5%
+-commutative99.5%
Applied egg-rr99.5%
*-rgt-identity99.5%
/-rgt-identity99.5%
*-commutative99.5%
associate-/r*99.7%
associate-*l/99.7%
*-commutative99.7%
Simplified99.7%
(FPCore (a b) :precision binary64 (/ (* 0.5 PI) (* (+ a b) (* a b))))
double code(double a, double b) {
return (0.5 * ((double) M_PI)) / ((a + b) * (a * b));
}
public static double code(double a, double b) {
return (0.5 * Math.PI) / ((a + b) * (a * b));
}
def code(a, b): return (0.5 * math.pi) / ((a + b) * (a * b))
function code(a, b) return Float64(Float64(0.5 * pi) / Float64(Float64(a + b) * Float64(a * b))) end
function tmp = code(a, b) tmp = (0.5 * pi) / ((a + b) * (a * b)); end
code[a_, b_] := N[(N[(0.5 * Pi), $MachinePrecision] / N[(N[(a + b), $MachinePrecision] * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5 \cdot \pi}{\left(a + b\right) \cdot \left(a \cdot b\right)}
\end{array}
Initial program 78.3%
un-div-inv78.3%
difference-of-squares86.5%
associate-/r*87.7%
div-inv87.7%
metadata-eval87.7%
Applied egg-rr87.7%
frac-sub87.7%
frac-times99.5%
associate-/l*99.4%
*-un-lft-identity99.4%
*-commutative99.4%
Applied egg-rr99.4%
*-rgt-identity99.4%
associate-/l*99.4%
associate-*r/99.4%
*-commutative99.4%
+-commutative99.4%
*-commutative99.4%
Simplified99.4%
*-commutative99.4%
associate-/r*99.7%
pow199.7%
pow199.7%
pow-div99.7%
metadata-eval99.7%
metadata-eval99.7%
*-commutative99.7%
+-commutative99.7%
frac-times99.5%
*-un-lft-identity99.5%
*-commutative99.5%
+-commutative99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (a b) :precision binary64 (/ (* 0.5 PI) (* a (* a b))))
double code(double a, double b) {
return (0.5 * ((double) M_PI)) / (a * (a * b));
}
public static double code(double a, double b) {
return (0.5 * Math.PI) / (a * (a * b));
}
def code(a, b): return (0.5 * math.pi) / (a * (a * b))
function code(a, b) return Float64(Float64(0.5 * pi) / Float64(a * Float64(a * b))) end
function tmp = code(a, b) tmp = (0.5 * pi) / (a * (a * b)); end
code[a_, b_] := N[(N[(0.5 * Pi), $MachinePrecision] / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5 \cdot \pi}{a \cdot \left(a \cdot b\right)}
\end{array}
Initial program 78.3%
un-div-inv78.3%
difference-of-squares86.5%
associate-/r*87.7%
div-inv87.7%
metadata-eval87.7%
Applied egg-rr87.7%
frac-sub87.7%
frac-times99.5%
associate-/l*99.4%
*-un-lft-identity99.4%
*-commutative99.4%
Applied egg-rr99.4%
*-rgt-identity99.4%
associate-/l*99.4%
associate-*r/99.4%
*-commutative99.4%
+-commutative99.4%
*-commutative99.4%
Simplified99.4%
*-commutative99.4%
associate-/r*99.7%
pow199.7%
pow199.7%
pow-div99.7%
metadata-eval99.7%
metadata-eval99.7%
*-commutative99.7%
+-commutative99.7%
frac-times99.5%
*-un-lft-identity99.5%
*-commutative99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in a around inf 62.1%
Final simplification62.1%
herbie shell --seed 2024132
(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))))