
(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 2.0) (- b a)) (/ (+ (/ 1.0 a) (/ -1.0 b)) (+ b a))))
double code(double a, double b) {
return ((((double) M_PI) / 2.0) / (b - a)) * (((1.0 / a) + (-1.0 / b)) / (b + a));
}
public static double code(double a, double b) {
return ((Math.PI / 2.0) / (b - a)) * (((1.0 / a) + (-1.0 / b)) / (b + a));
}
def code(a, b): return ((math.pi / 2.0) / (b - a)) * (((1.0 / a) + (-1.0 / b)) / (b + a))
function code(a, b) return Float64(Float64(Float64(pi / 2.0) / Float64(b - a)) * Float64(Float64(Float64(1.0 / a) + Float64(-1.0 / b)) / Float64(b + a))) end
function tmp = code(a, b) tmp = ((pi / 2.0) / (b - a)) * (((1.0 / a) + (-1.0 / b)) / (b + a)); end
code[a_, b_] := N[(N[(N[(Pi / 2.0), $MachinePrecision] / N[(b - a), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1.0 / a), $MachinePrecision] + N[(-1.0 / b), $MachinePrecision]), $MachinePrecision] / N[(b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\pi}{2}}{b - a} \cdot \frac{\frac{1}{a} + \frac{-1}{b}}{b + a}
\end{array}
Initial program 80.2%
associate-*r/80.3%
*-rgt-identity80.3%
associate-*l/80.3%
difference-of-squares90.4%
*-commutative90.4%
times-frac99.7%
sub-neg99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (a b) :precision binary64 (if (<= a -5e+98) (* (/ (- PI) a) (/ -0.5 (* b a))) (* 0.5 (/ PI (* b (* a (+ b a)))))))
double code(double a, double b) {
double tmp;
if (a <= -5e+98) {
tmp = (-((double) M_PI) / a) * (-0.5 / (b * a));
} else {
tmp = 0.5 * (((double) M_PI) / (b * (a * (b + a))));
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -5e+98) {
tmp = (-Math.PI / a) * (-0.5 / (b * a));
} else {
tmp = 0.5 * (Math.PI / (b * (a * (b + a))));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -5e+98: tmp = (-math.pi / a) * (-0.5 / (b * a)) else: tmp = 0.5 * (math.pi / (b * (a * (b + a)))) return tmp
function code(a, b) tmp = 0.0 if (a <= -5e+98) tmp = Float64(Float64(Float64(-pi) / a) * Float64(-0.5 / Float64(b * a))); else tmp = Float64(0.5 * Float64(pi / Float64(b * Float64(a * Float64(b + a))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -5e+98) tmp = (-pi / a) * (-0.5 / (b * a)); else tmp = 0.5 * (pi / (b * (a * (b + a)))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -5e+98], N[(N[((-Pi) / a), $MachinePrecision] * N[(-0.5 / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(Pi / N[(b * N[(a * N[(b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5 \cdot 10^{+98}:\\
\;\;\;\;\frac{-\pi}{a} \cdot \frac{-0.5}{b \cdot a}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\pi}{b \cdot \left(a \cdot \left(b + a\right)\right)}\\
\end{array}
\end{array}
if a < -4.9999999999999998e98Initial program 70.6%
associate-*r/70.6%
*-rgt-identity70.6%
associate-*l/70.6%
difference-of-squares88.6%
*-commutative88.6%
times-frac99.8%
sub-neg99.8%
distribute-neg-frac99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in a around inf 99.9%
expm1-log1p-u91.8%
expm1-udef73.0%
*-commutative73.0%
*-commutative73.0%
div-inv73.0%
metadata-eval73.0%
associate-/l*73.0%
Applied egg-rr73.0%
expm1-def91.8%
expm1-log1p99.9%
associate-/l*99.9%
times-frac99.8%
*-commutative99.8%
neg-mul-199.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
times-frac99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in b around 0 99.9%
associate-*r/99.9%
mul-1-neg99.9%
Simplified99.9%
if -4.9999999999999998e98 < a Initial program 82.6%
un-div-inv82.6%
difference-of-squares90.9%
associate-/l/91.1%
frac-sub91.1%
frac-times98.8%
div-inv98.8%
metadata-eval98.8%
*-un-lft-identity98.8%
Applied egg-rr98.8%
Taylor expanded in b around 0 98.8%
*-commutative98.8%
Simplified98.8%
expm1-log1p-u76.5%
expm1-udef54.1%
*-commutative54.1%
*-un-lft-identity54.1%
times-frac54.1%
metadata-eval54.1%
*-commutative54.1%
*-commutative54.1%
Applied egg-rr54.1%
expm1-def76.5%
expm1-log1p98.8%
associate-*l*94.7%
+-commutative94.7%
Simplified94.7%
Final simplification95.8%
(FPCore (a b) :precision binary64 (if (<= a -5e+133) (* (/ (- PI) a) (/ -0.5 (* b a))) (* (/ PI (* a (+ b a))) (/ 0.5 b))))
double code(double a, double b) {
double tmp;
if (a <= -5e+133) {
tmp = (-((double) M_PI) / a) * (-0.5 / (b * a));
} else {
tmp = (((double) M_PI) / (a * (b + a))) * (0.5 / b);
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -5e+133) {
tmp = (-Math.PI / a) * (-0.5 / (b * a));
} else {
tmp = (Math.PI / (a * (b + a))) * (0.5 / b);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -5e+133: tmp = (-math.pi / a) * (-0.5 / (b * a)) else: tmp = (math.pi / (a * (b + a))) * (0.5 / b) return tmp
function code(a, b) tmp = 0.0 if (a <= -5e+133) tmp = Float64(Float64(Float64(-pi) / a) * Float64(-0.5 / Float64(b * a))); else tmp = Float64(Float64(pi / Float64(a * Float64(b + a))) * Float64(0.5 / b)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -5e+133) tmp = (-pi / a) * (-0.5 / (b * a)); else tmp = (pi / (a * (b + a))) * (0.5 / b); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -5e+133], N[(N[((-Pi) / a), $MachinePrecision] * N[(-0.5 / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi / N[(a * N[(b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5 \cdot 10^{+133}:\\
\;\;\;\;\frac{-\pi}{a} \cdot \frac{-0.5}{b \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi}{a \cdot \left(b + a\right)} \cdot \frac{0.5}{b}\\
\end{array}
\end{array}
if a < -4.99999999999999961e133Initial program 60.3%
associate-*r/60.4%
*-rgt-identity60.4%
associate-*l/60.3%
difference-of-squares84.7%
*-commutative84.7%
times-frac99.9%
sub-neg99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in a around inf 100.0%
expm1-log1p-u100.0%
expm1-udef82.2%
*-commutative82.2%
*-commutative82.2%
div-inv82.2%
metadata-eval82.2%
associate-/l*82.2%
Applied egg-rr82.2%
expm1-def100.0%
expm1-log1p100.0%
associate-/l*100.0%
times-frac99.8%
*-commutative99.8%
neg-mul-199.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
times-frac100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in b around 0 100.0%
associate-*r/100.0%
mul-1-neg100.0%
Simplified100.0%
if -4.99999999999999961e133 < a Initial program 83.6%
un-div-inv83.6%
difference-of-squares91.4%
associate-/l/91.7%
frac-sub91.6%
frac-times98.8%
div-inv98.8%
metadata-eval98.8%
*-un-lft-identity98.8%
Applied egg-rr98.8%
Taylor expanded in b around 0 98.9%
*-commutative98.9%
Simplified98.9%
associate-*r*95.0%
times-frac95.8%
Applied egg-rr95.8%
Final simplification96.4%
(FPCore (a b) :precision binary64 (if (<= a -1.36e-117) (* (/ (- PI) a) (/ -0.5 (* b a))) (/ (* PI (/ 0.5 b)) (* b a))))
double code(double a, double b) {
double tmp;
if (a <= -1.36e-117) {
tmp = (-((double) M_PI) / a) * (-0.5 / (b * a));
} else {
tmp = (((double) M_PI) * (0.5 / b)) / (b * a);
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -1.36e-117) {
tmp = (-Math.PI / a) * (-0.5 / (b * a));
} else {
tmp = (Math.PI * (0.5 / b)) / (b * a);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -1.36e-117: tmp = (-math.pi / a) * (-0.5 / (b * a)) else: tmp = (math.pi * (0.5 / b)) / (b * a) return tmp
function code(a, b) tmp = 0.0 if (a <= -1.36e-117) tmp = Float64(Float64(Float64(-pi) / a) * Float64(-0.5 / Float64(b * a))); else tmp = Float64(Float64(pi * Float64(0.5 / b)) / Float64(b * a)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -1.36e-117) tmp = (-pi / a) * (-0.5 / (b * a)); else tmp = (pi * (0.5 / b)) / (b * a); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -1.36e-117], N[(N[((-Pi) / a), $MachinePrecision] * N[(-0.5 / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * N[(0.5 / b), $MachinePrecision]), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.36 \cdot 10^{-117}:\\
\;\;\;\;\frac{-\pi}{a} \cdot \frac{-0.5}{b \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi \cdot \frac{0.5}{b}}{b \cdot a}\\
\end{array}
\end{array}
if a < -1.35999999999999996e-117Initial program 80.6%
associate-*r/80.7%
*-rgt-identity80.7%
associate-*l/80.7%
difference-of-squares90.6%
*-commutative90.6%
times-frac99.7%
sub-neg99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around inf 90.4%
expm1-log1p-u82.1%
expm1-udef67.3%
*-commutative67.3%
*-commutative67.3%
div-inv67.3%
metadata-eval67.3%
associate-/l*67.3%
Applied egg-rr67.3%
expm1-def82.1%
expm1-log1p90.4%
associate-/l*90.4%
times-frac90.3%
*-commutative90.3%
neg-mul-190.3%
distribute-rgt-neg-in90.3%
metadata-eval90.3%
times-frac90.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in b around 0 79.7%
associate-*r/79.7%
mul-1-neg79.7%
Simplified79.7%
if -1.35999999999999996e-117 < a Initial program 80.0%
associate-*r/80.0%
*-rgt-identity80.0%
associate-*l/80.0%
difference-of-squares90.3%
*-commutative90.3%
times-frac99.7%
sub-neg99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around inf 59.9%
expm1-log1p-u48.1%
expm1-udef37.6%
*-commutative37.6%
*-commutative37.6%
div-inv37.6%
metadata-eval37.6%
associate-/l*37.6%
Applied egg-rr37.6%
expm1-def48.1%
expm1-log1p59.9%
associate-/l*59.9%
times-frac59.5%
*-commutative59.5%
neg-mul-159.5%
distribute-rgt-neg-in59.5%
metadata-eval59.5%
times-frac59.9%
*-commutative59.9%
Simplified59.9%
Taylor expanded in b around inf 26.1%
*-commutative26.1%
associate-/l/26.1%
frac-times26.1%
add-sqr-sqrt14.3%
sqrt-unprod49.2%
frac-times49.2%
metadata-eval49.2%
metadata-eval49.2%
frac-times49.2%
sqrt-unprod38.1%
add-sqr-sqrt71.0%
*-commutative71.0%
Applied egg-rr71.0%
Final simplification74.1%
(FPCore (a b) :precision binary64 (if (<= a -7e+126) (/ (/ PI a) (* (* b a) -2.0)) (/ (/ 0.5 b) (* a (/ b PI)))))
double code(double a, double b) {
double tmp;
if (a <= -7e+126) {
tmp = (((double) M_PI) / a) / ((b * a) * -2.0);
} else {
tmp = (0.5 / b) / (a * (b / ((double) M_PI)));
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -7e+126) {
tmp = (Math.PI / a) / ((b * a) * -2.0);
} else {
tmp = (0.5 / b) / (a * (b / Math.PI));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -7e+126: tmp = (math.pi / a) / ((b * a) * -2.0) else: tmp = (0.5 / b) / (a * (b / math.pi)) return tmp
function code(a, b) tmp = 0.0 if (a <= -7e+126) tmp = Float64(Float64(pi / a) / Float64(Float64(b * a) * -2.0)); else tmp = Float64(Float64(0.5 / b) / Float64(a * Float64(b / pi))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -7e+126) tmp = (pi / a) / ((b * a) * -2.0); else tmp = (0.5 / b) / (a * (b / pi)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -7e+126], N[(N[(Pi / a), $MachinePrecision] / N[(N[(b * a), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / b), $MachinePrecision] / N[(a * N[(b / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7 \cdot 10^{+126}:\\
\;\;\;\;\frac{\frac{\pi}{a}}{\left(b \cdot a\right) \cdot -2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{b}}{a \cdot \frac{b}{\pi}}\\
\end{array}
\end{array}
if a < -7.0000000000000005e126Initial program 61.4%
associate-*r/61.4%
*-rgt-identity61.4%
associate-*l/61.4%
difference-of-squares85.1%
*-commutative85.1%
times-frac99.9%
sub-neg99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
Simplified99.9%
associate-*l/99.9%
clear-num99.9%
frac-times99.9%
*-un-lft-identity99.9%
add-sqr-sqrt60.4%
sqrt-unprod79.5%
frac-times79.5%
metadata-eval79.5%
metadata-eval79.5%
frac-times79.5%
sqrt-unprod32.0%
add-sqr-sqrt79.8%
Applied egg-rr79.8%
Taylor expanded in a around 0 79.8%
associate-*r/79.8%
*-commutative79.8%
Simplified79.8%
expm1-log1p-u79.8%
expm1-udef80.1%
times-frac80.1%
Applied egg-rr80.1%
expm1-def79.8%
expm1-log1p79.8%
associate-/l*79.8%
Simplified79.8%
Taylor expanded in b around 0 79.8%
if -7.0000000000000005e126 < a Initial program 83.5%
associate-*r/83.6%
*-rgt-identity83.6%
associate-*l/83.6%
difference-of-squares91.4%
*-commutative91.4%
times-frac99.6%
sub-neg99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in a around inf 65.7%
expm1-log1p-u53.2%
expm1-udef42.6%
*-commutative42.6%
*-commutative42.6%
div-inv42.6%
metadata-eval42.6%
associate-/l*42.6%
Applied egg-rr42.6%
expm1-def53.2%
expm1-log1p65.7%
associate-/l*65.7%
times-frac65.3%
*-commutative65.3%
neg-mul-165.3%
distribute-rgt-neg-in65.3%
metadata-eval65.3%
times-frac65.7%
*-commutative65.7%
Simplified65.7%
Taylor expanded in b around inf 29.8%
clear-num29.8%
associate-/l/29.8%
frac-times29.8%
*-un-lft-identity29.8%
add-sqr-sqrt15.3%
sqrt-unprod46.4%
frac-times46.4%
metadata-eval46.4%
metadata-eval46.4%
frac-times46.4%
sqrt-unprod33.8%
add-sqr-sqrt65.4%
Applied egg-rr65.4%
Final simplification67.5%
(FPCore (a b) :precision binary64 (/ (* PI 0.5) (* (+ b a) (* b a))))
double code(double a, double b) {
return (((double) M_PI) * 0.5) / ((b + a) * (b * a));
}
public static double code(double a, double b) {
return (Math.PI * 0.5) / ((b + a) * (b * a));
}
def code(a, b): return (math.pi * 0.5) / ((b + a) * (b * a))
function code(a, b) return Float64(Float64(pi * 0.5) / Float64(Float64(b + a) * Float64(b * a))) end
function tmp = code(a, b) tmp = (pi * 0.5) / ((b + a) * (b * a)); end
code[a_, b_] := N[(N[(Pi * 0.5), $MachinePrecision] / N[(N[(b + a), $MachinePrecision] * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi \cdot 0.5}{\left(b + a\right) \cdot \left(b \cdot a\right)}
\end{array}
Initial program 80.2%
un-div-inv80.3%
difference-of-squares90.4%
associate-/l/91.2%
frac-sub91.2%
frac-times99.0%
div-inv99.0%
metadata-eval99.0%
*-un-lft-identity99.0%
Applied egg-rr99.0%
Taylor expanded in b around 0 99.0%
*-commutative99.0%
Simplified99.0%
Final simplification99.0%
(FPCore (a b) :precision binary64 (* (/ -0.5 (* b a)) (/ PI b)))
double code(double a, double b) {
return (-0.5 / (b * a)) * (((double) M_PI) / b);
}
public static double code(double a, double b) {
return (-0.5 / (b * a)) * (Math.PI / b);
}
def code(a, b): return (-0.5 / (b * a)) * (math.pi / b)
function code(a, b) return Float64(Float64(-0.5 / Float64(b * a)) * Float64(pi / b)) end
function tmp = code(a, b) tmp = (-0.5 / (b * a)) * (pi / b); end
code[a_, b_] := N[(N[(-0.5 / N[(b * a), $MachinePrecision]), $MachinePrecision] * N[(Pi / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.5}{b \cdot a} \cdot \frac{\pi}{b}
\end{array}
Initial program 80.2%
associate-*r/80.3%
*-rgt-identity80.3%
associate-*l/80.3%
difference-of-squares90.4%
*-commutative90.4%
times-frac99.7%
sub-neg99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around inf 70.7%
expm1-log1p-u60.2%
expm1-udef48.2%
*-commutative48.2%
*-commutative48.2%
div-inv48.2%
metadata-eval48.2%
associate-/l*48.2%
Applied egg-rr48.2%
expm1-def60.2%
expm1-log1p70.7%
associate-/l*70.7%
times-frac70.5%
*-commutative70.5%
neg-mul-170.5%
distribute-rgt-neg-in70.5%
metadata-eval70.5%
times-frac70.7%
*-commutative70.7%
Simplified70.7%
Taylor expanded in b around inf 32.3%
Final simplification32.3%
(FPCore (a b) :precision binary64 (/ PI (* b (/ a (/ 0.5 b)))))
double code(double a, double b) {
return ((double) M_PI) / (b * (a / (0.5 / b)));
}
public static double code(double a, double b) {
return Math.PI / (b * (a / (0.5 / b)));
}
def code(a, b): return math.pi / (b * (a / (0.5 / b)))
function code(a, b) return Float64(pi / Float64(b * Float64(a / Float64(0.5 / b)))) end
function tmp = code(a, b) tmp = pi / (b * (a / (0.5 / b))); end
code[a_, b_] := N[(Pi / N[(b * N[(a / N[(0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi}{b \cdot \frac{a}{\frac{0.5}{b}}}
\end{array}
Initial program 80.2%
associate-*r/80.3%
*-rgt-identity80.3%
associate-*l/80.3%
difference-of-squares90.4%
*-commutative90.4%
times-frac99.7%
sub-neg99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around inf 70.7%
expm1-log1p-u60.2%
expm1-udef48.2%
*-commutative48.2%
*-commutative48.2%
div-inv48.2%
metadata-eval48.2%
associate-/l*48.2%
Applied egg-rr48.2%
expm1-def60.2%
expm1-log1p70.7%
associate-/l*70.7%
times-frac70.5%
*-commutative70.5%
neg-mul-170.5%
distribute-rgt-neg-in70.5%
metadata-eval70.5%
times-frac70.7%
*-commutative70.7%
Simplified70.7%
Taylor expanded in b around inf 32.3%
*-commutative32.3%
associate-/l/32.3%
clear-num32.3%
frac-times32.3%
*-un-lft-identity32.3%
add-sqr-sqrt16.4%
sqrt-unprod46.4%
frac-times46.4%
metadata-eval46.4%
metadata-eval46.4%
frac-times46.4%
sqrt-unprod32.2%
add-sqr-sqrt62.3%
Applied egg-rr62.3%
Final simplification62.3%
(FPCore (a b) :precision binary64 (/ (* PI (/ 0.5 b)) (* b a)))
double code(double a, double b) {
return (((double) M_PI) * (0.5 / b)) / (b * a);
}
public static double code(double a, double b) {
return (Math.PI * (0.5 / b)) / (b * a);
}
def code(a, b): return (math.pi * (0.5 / b)) / (b * a)
function code(a, b) return Float64(Float64(pi * Float64(0.5 / b)) / Float64(b * a)) end
function tmp = code(a, b) tmp = (pi * (0.5 / b)) / (b * a); end
code[a_, b_] := N[(N[(Pi * N[(0.5 / b), $MachinePrecision]), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi \cdot \frac{0.5}{b}}{b \cdot a}
\end{array}
Initial program 80.2%
associate-*r/80.3%
*-rgt-identity80.3%
associate-*l/80.3%
difference-of-squares90.4%
*-commutative90.4%
times-frac99.7%
sub-neg99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around inf 70.7%
expm1-log1p-u60.2%
expm1-udef48.2%
*-commutative48.2%
*-commutative48.2%
div-inv48.2%
metadata-eval48.2%
associate-/l*48.2%
Applied egg-rr48.2%
expm1-def60.2%
expm1-log1p70.7%
associate-/l*70.7%
times-frac70.5%
*-commutative70.5%
neg-mul-170.5%
distribute-rgt-neg-in70.5%
metadata-eval70.5%
times-frac70.7%
*-commutative70.7%
Simplified70.7%
Taylor expanded in b around inf 32.3%
*-commutative32.3%
associate-/l/32.3%
frac-times32.3%
add-sqr-sqrt16.4%
sqrt-unprod46.4%
frac-times46.4%
metadata-eval46.4%
metadata-eval46.4%
frac-times46.4%
sqrt-unprod32.4%
add-sqr-sqrt62.6%
*-commutative62.6%
Applied egg-rr62.6%
Final simplification62.6%
(FPCore (a b) :precision binary64 (/ (/ 0.5 b) (* a (/ b PI))))
double code(double a, double b) {
return (0.5 / b) / (a * (b / ((double) M_PI)));
}
public static double code(double a, double b) {
return (0.5 / b) / (a * (b / Math.PI));
}
def code(a, b): return (0.5 / b) / (a * (b / math.pi))
function code(a, b) return Float64(Float64(0.5 / b) / Float64(a * Float64(b / pi))) end
function tmp = code(a, b) tmp = (0.5 / b) / (a * (b / pi)); end
code[a_, b_] := N[(N[(0.5 / b), $MachinePrecision] / N[(a * N[(b / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5}{b}}{a \cdot \frac{b}{\pi}}
\end{array}
Initial program 80.2%
associate-*r/80.3%
*-rgt-identity80.3%
associate-*l/80.3%
difference-of-squares90.4%
*-commutative90.4%
times-frac99.7%
sub-neg99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around inf 70.7%
expm1-log1p-u60.2%
expm1-udef48.2%
*-commutative48.2%
*-commutative48.2%
div-inv48.2%
metadata-eval48.2%
associate-/l*48.2%
Applied egg-rr48.2%
expm1-def60.2%
expm1-log1p70.7%
associate-/l*70.7%
times-frac70.5%
*-commutative70.5%
neg-mul-170.5%
distribute-rgt-neg-in70.5%
metadata-eval70.5%
times-frac70.7%
*-commutative70.7%
Simplified70.7%
Taylor expanded in b around inf 32.3%
clear-num32.3%
associate-/l/32.3%
frac-times32.3%
*-un-lft-identity32.3%
add-sqr-sqrt16.4%
sqrt-unprod46.4%
frac-times46.4%
metadata-eval46.4%
metadata-eval46.4%
frac-times46.4%
sqrt-unprod32.4%
add-sqr-sqrt62.7%
Applied egg-rr62.7%
Final simplification62.7%
herbie shell --seed 2024019
(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))))