
(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 11 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) (+ b a)) (/ (- (/ 1.0 a) (/ 1.0 b)) (- b a))))
double code(double a, double b) {
return ((((double) M_PI) * 0.5) / (b + a)) * (((1.0 / a) - (1.0 / b)) / (b - a));
}
public static double code(double a, double b) {
return ((Math.PI * 0.5) / (b + a)) * (((1.0 / a) - (1.0 / b)) / (b - a));
}
def code(a, b): return ((math.pi * 0.5) / (b + a)) * (((1.0 / a) - (1.0 / b)) / (b - a))
function code(a, b) return Float64(Float64(Float64(pi * 0.5) / Float64(b + a)) * Float64(Float64(Float64(1.0 / a) - Float64(1.0 / b)) / Float64(b - a))) end
function tmp = code(a, b) tmp = ((pi * 0.5) / (b + a)) * (((1.0 / a) - (1.0 / b)) / (b - a)); end
code[a_, b_] := N[(N[(N[(Pi * 0.5), $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{\pi \cdot 0.5}{b + a} \cdot \frac{\frac{1}{a} - \frac{1}{b}}{b - a}
\end{array}
Initial program 81.9%
un-div-inv82.0%
difference-of-squares90.2%
associate-/r*90.2%
div-inv90.2%
metadata-eval90.2%
Applied egg-rr90.2%
associate-*l/99.6%
Applied egg-rr99.6%
associate-/l*99.6%
Applied egg-rr99.6%
(FPCore (a b) :precision binary64 (if (<= a -3.15e-142) (/ (/ (* PI -0.5) (* b a)) (- b a)) (* (/ PI (* a (- b a))) (/ 0.5 (+ b a)))))
double code(double a, double b) {
double tmp;
if (a <= -3.15e-142) {
tmp = ((((double) M_PI) * -0.5) / (b * a)) / (b - a);
} else {
tmp = (((double) M_PI) / (a * (b - a))) * (0.5 / (b + a));
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -3.15e-142) {
tmp = ((Math.PI * -0.5) / (b * a)) / (b - a);
} else {
tmp = (Math.PI / (a * (b - a))) * (0.5 / (b + a));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -3.15e-142: tmp = ((math.pi * -0.5) / (b * a)) / (b - a) else: tmp = (math.pi / (a * (b - a))) * (0.5 / (b + a)) return tmp
function code(a, b) tmp = 0.0 if (a <= -3.15e-142) tmp = Float64(Float64(Float64(pi * -0.5) / Float64(b * a)) / Float64(b - a)); else tmp = Float64(Float64(pi / Float64(a * Float64(b - a))) * Float64(0.5 / Float64(b + a))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -3.15e-142) tmp = ((pi * -0.5) / (b * a)) / (b - a); else tmp = (pi / (a * (b - a))) * (0.5 / (b + a)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -3.15e-142], N[(N[(N[(Pi * -0.5), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision] / N[(b - a), $MachinePrecision]), $MachinePrecision], N[(N[(Pi / N[(a * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / N[(b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.15 \cdot 10^{-142}:\\
\;\;\;\;\frac{\frac{\pi \cdot -0.5}{b \cdot a}}{b - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi}{a \cdot \left(b - a\right)} \cdot \frac{0.5}{b + a}\\
\end{array}
\end{array}
if a < -3.1499999999999999e-142Initial program 86.0%
un-div-inv86.0%
difference-of-squares90.4%
associate-/r*90.5%
div-inv90.5%
metadata-eval90.5%
Applied egg-rr90.5%
associate-*l/99.6%
Applied egg-rr99.6%
Taylor expanded in b around 0 83.6%
associate-*r/83.6%
Simplified83.6%
if -3.1499999999999999e-142 < a Initial program 79.6%
un-div-inv79.7%
difference-of-squares90.0%
associate-/r*90.0%
div-inv90.0%
metadata-eval90.0%
Applied egg-rr90.0%
Taylor expanded in a around 0 61.8%
*-commutative61.8%
associate-/l/61.7%
frac-times61.7%
*-un-lft-identity61.7%
Applied egg-rr61.7%
associate-*r*70.2%
times-frac70.1%
+-commutative70.1%
Applied egg-rr70.1%
Final simplification74.9%
(FPCore (a b) :precision binary64 (if (<= b 1.03e-112) (/ (/ (* PI -0.5) (* b a)) (- b a)) (/ (/ (* PI 0.5) (* b a)) (- b a))))
double code(double a, double b) {
double tmp;
if (b <= 1.03e-112) {
tmp = ((((double) M_PI) * -0.5) / (b * a)) / (b - a);
} else {
tmp = ((((double) M_PI) * 0.5) / (b * a)) / (b - a);
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (b <= 1.03e-112) {
tmp = ((Math.PI * -0.5) / (b * a)) / (b - a);
} else {
tmp = ((Math.PI * 0.5) / (b * a)) / (b - a);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 1.03e-112: tmp = ((math.pi * -0.5) / (b * a)) / (b - a) else: tmp = ((math.pi * 0.5) / (b * a)) / (b - a) return tmp
function code(a, b) tmp = 0.0 if (b <= 1.03e-112) tmp = Float64(Float64(Float64(pi * -0.5) / Float64(b * a)) / Float64(b - a)); else tmp = Float64(Float64(Float64(pi * 0.5) / Float64(b * a)) / Float64(b - a)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 1.03e-112) tmp = ((pi * -0.5) / (b * a)) / (b - a); else tmp = ((pi * 0.5) / (b * a)) / (b - a); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 1.03e-112], N[(N[(N[(Pi * -0.5), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision] / N[(b - a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(Pi * 0.5), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision] / N[(b - a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.03 \cdot 10^{-112}:\\
\;\;\;\;\frac{\frac{\pi \cdot -0.5}{b \cdot a}}{b - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\pi \cdot 0.5}{b \cdot a}}{b - a}\\
\end{array}
\end{array}
if b < 1.03000000000000002e-112Initial program 82.1%
un-div-inv82.2%
difference-of-squares90.6%
associate-/r*90.7%
div-inv90.7%
metadata-eval90.7%
Applied egg-rr90.7%
associate-*l/99.6%
Applied egg-rr99.6%
Taylor expanded in b around 0 73.8%
associate-*r/73.8%
Simplified73.8%
if 1.03000000000000002e-112 < b Initial program 81.4%
associate-*l*81.4%
*-rgt-identity81.4%
associate-/l*81.4%
metadata-eval81.4%
associate-*l/81.5%
*-lft-identity81.5%
sub-neg81.5%
distribute-neg-frac81.5%
metadata-eval81.5%
Simplified81.5%
metadata-eval81.5%
div-inv81.5%
associate-*r/81.4%
*-commutative81.4%
difference-of-squares89.0%
associate-/r*99.5%
Applied egg-rr78.2%
Taylor expanded in a around 0 78.3%
associate-*r/78.3%
Simplified78.3%
Final simplification75.2%
(FPCore (a b) :precision binary64 (if (<= b 4.35e-113) (/ (/ (* PI -0.5) (* b a)) (- b a)) (/ (* 0.5 (/ PI b)) (* a (- b a)))))
double code(double a, double b) {
double tmp;
if (b <= 4.35e-113) {
tmp = ((((double) M_PI) * -0.5) / (b * a)) / (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 (b <= 4.35e-113) {
tmp = ((Math.PI * -0.5) / (b * a)) / (b - a);
} else {
tmp = (0.5 * (Math.PI / b)) / (a * (b - a));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 4.35e-113: tmp = ((math.pi * -0.5) / (b * a)) / (b - a) else: tmp = (0.5 * (math.pi / b)) / (a * (b - a)) return tmp
function code(a, b) tmp = 0.0 if (b <= 4.35e-113) tmp = Float64(Float64(Float64(pi * -0.5) / Float64(b * a)) / Float64(b - a)); else tmp = Float64(Float64(0.5 * Float64(pi / b)) / Float64(a * Float64(b - a))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 4.35e-113) tmp = ((pi * -0.5) / (b * a)) / (b - a); else tmp = (0.5 * (pi / b)) / (a * (b - a)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 4.35e-113], N[(N[(N[(Pi * -0.5), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision] / N[(b - a), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(Pi / b), $MachinePrecision]), $MachinePrecision] / N[(a * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.35 \cdot 10^{-113}:\\
\;\;\;\;\frac{\frac{\pi \cdot -0.5}{b \cdot a}}{b - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{b}}{a \cdot \left(b - a\right)}\\
\end{array}
\end{array}
if b < 4.34999999999999977e-113Initial program 82.1%
un-div-inv82.2%
difference-of-squares90.6%
associate-/r*90.7%
div-inv90.7%
metadata-eval90.7%
Applied egg-rr90.7%
associate-*l/99.6%
Applied egg-rr99.6%
Taylor expanded in b around 0 73.8%
associate-*r/73.8%
Simplified73.8%
if 4.34999999999999977e-113 < b Initial program 81.4%
associate-*l*81.4%
*-rgt-identity81.4%
associate-/l*81.4%
metadata-eval81.4%
associate-*l/81.5%
*-lft-identity81.5%
sub-neg81.5%
distribute-neg-frac81.5%
metadata-eval81.5%
Simplified81.5%
metadata-eval81.5%
div-inv81.5%
associate-*r/81.4%
*-commutative81.4%
difference-of-squares89.0%
associate-/r*99.5%
Applied egg-rr78.2%
Taylor expanded in a around 0 78.3%
associate-*r/78.3%
*-commutative78.3%
times-frac78.3%
Simplified78.3%
*-un-lft-identity78.3%
associate-/l*68.9%
Applied egg-rr68.9%
*-lft-identity68.9%
Simplified68.9%
*-commutative68.9%
frac-times78.2%
*-commutative78.2%
associate-*r/78.3%
*-commutative78.3%
*-un-lft-identity78.3%
times-frac78.3%
metadata-eval78.3%
Applied egg-rr78.3%
Final simplification75.2%
(FPCore (a b) :precision binary64 (if (<= b 1.15e-111) (/ (* PI (/ (/ -0.5 b) a)) (- b a)) (/ (* 0.5 (/ PI b)) (* a (- b a)))))
double code(double a, double b) {
double tmp;
if (b <= 1.15e-111) {
tmp = (((double) M_PI) * ((-0.5 / b) / a)) / (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 (b <= 1.15e-111) {
tmp = (Math.PI * ((-0.5 / b) / a)) / (b - a);
} else {
tmp = (0.5 * (Math.PI / b)) / (a * (b - a));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 1.15e-111: tmp = (math.pi * ((-0.5 / b) / a)) / (b - a) else: tmp = (0.5 * (math.pi / b)) / (a * (b - a)) return tmp
function code(a, b) tmp = 0.0 if (b <= 1.15e-111) tmp = Float64(Float64(pi * Float64(Float64(-0.5 / b) / a)) / Float64(b - a)); else tmp = Float64(Float64(0.5 * Float64(pi / b)) / Float64(a * Float64(b - a))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 1.15e-111) tmp = (pi * ((-0.5 / b) / a)) / (b - a); else tmp = (0.5 * (pi / b)) / (a * (b - a)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 1.15e-111], N[(N[(Pi * N[(N[(-0.5 / b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / N[(b - a), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(Pi / b), $MachinePrecision]), $MachinePrecision] / N[(a * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.15 \cdot 10^{-111}:\\
\;\;\;\;\frac{\pi \cdot \frac{\frac{-0.5}{b}}{a}}{b - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{b}}{a \cdot \left(b - a\right)}\\
\end{array}
\end{array}
if b < 1.15e-111Initial program 82.1%
un-div-inv82.2%
difference-of-squares90.6%
associate-/r*90.7%
div-inv90.7%
metadata-eval90.7%
Applied egg-rr90.7%
associate-*l/99.6%
Applied egg-rr99.6%
Taylor expanded in a around inf 79.2%
Taylor expanded in b around 0 73.8%
metadata-eval73.8%
distribute-lft-neg-in73.8%
associate-*r/73.8%
*-commutative73.8%
associate-/l*73.8%
associate-/l/73.8%
distribute-rgt-neg-in73.8%
distribute-neg-frac73.8%
distribute-neg-frac73.8%
metadata-eval73.8%
Simplified73.8%
if 1.15e-111 < b Initial program 81.4%
associate-*l*81.4%
*-rgt-identity81.4%
associate-/l*81.4%
metadata-eval81.4%
associate-*l/81.5%
*-lft-identity81.5%
sub-neg81.5%
distribute-neg-frac81.5%
metadata-eval81.5%
Simplified81.5%
metadata-eval81.5%
div-inv81.5%
associate-*r/81.4%
*-commutative81.4%
difference-of-squares89.0%
associate-/r*99.5%
Applied egg-rr78.2%
Taylor expanded in a around 0 78.3%
associate-*r/78.3%
*-commutative78.3%
times-frac78.3%
Simplified78.3%
*-un-lft-identity78.3%
associate-/l*68.9%
Applied egg-rr68.9%
*-lft-identity68.9%
Simplified68.9%
*-commutative68.9%
frac-times78.2%
*-commutative78.2%
associate-*r/78.3%
*-commutative78.3%
*-un-lft-identity78.3%
times-frac78.3%
metadata-eval78.3%
Applied egg-rr78.3%
Final simplification75.1%
(FPCore (a b) :precision binary64 (* (/ (* PI 0.5) (+ b a)) (/ (/ 1.0 a) b)))
double code(double a, double b) {
return ((((double) M_PI) * 0.5) / (b + a)) * ((1.0 / a) / b);
}
public static double code(double a, double b) {
return ((Math.PI * 0.5) / (b + a)) * ((1.0 / a) / b);
}
def code(a, b): return ((math.pi * 0.5) / (b + a)) * ((1.0 / a) / b)
function code(a, b) return Float64(Float64(Float64(pi * 0.5) / Float64(b + a)) * Float64(Float64(1.0 / a) / b)) end
function tmp = code(a, b) tmp = ((pi * 0.5) / (b + a)) * ((1.0 / a) / b); end
code[a_, b_] := N[(N[(N[(Pi * 0.5), $MachinePrecision] / N[(b + a), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi \cdot 0.5}{b + a} \cdot \frac{\frac{1}{a}}{b}
\end{array}
Initial program 81.9%
un-div-inv82.0%
difference-of-squares90.2%
associate-/r*90.2%
div-inv90.2%
metadata-eval90.2%
Applied egg-rr90.2%
associate-*l/99.6%
Applied egg-rr99.6%
associate-/l*99.6%
Applied egg-rr99.6%
Taylor expanded in a around 0 99.6%
associate-/r*99.6%
Simplified99.6%
(FPCore (a b) :precision binary64 (* (/ (* PI 0.5) (+ b a)) (/ 1.0 (* b a))))
double code(double a, double b) {
return ((((double) M_PI) * 0.5) / (b + a)) * (1.0 / (b * a));
}
public static double code(double a, double b) {
return ((Math.PI * 0.5) / (b + a)) * (1.0 / (b * a));
}
def code(a, b): return ((math.pi * 0.5) / (b + a)) * (1.0 / (b * a))
function code(a, b) return Float64(Float64(Float64(pi * 0.5) / Float64(b + a)) * Float64(1.0 / Float64(b * a))) end
function tmp = code(a, b) tmp = ((pi * 0.5) / (b + a)) * (1.0 / (b * a)); end
code[a_, b_] := N[(N[(N[(Pi * 0.5), $MachinePrecision] / N[(b + a), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi \cdot 0.5}{b + a} \cdot \frac{1}{b \cdot a}
\end{array}
Initial program 81.9%
un-div-inv82.0%
difference-of-squares90.2%
associate-/r*90.2%
div-inv90.2%
metadata-eval90.2%
Applied egg-rr90.2%
associate-*l/99.6%
Applied egg-rr99.6%
associate-/l*99.6%
Applied egg-rr99.6%
Taylor expanded in a around 0 99.6%
Final simplification99.6%
(FPCore (a b) :precision binary64 (/ (* 0.5 (/ PI b)) (* a (- b a))))
double code(double a, double b) {
return (0.5 * (((double) M_PI) / b)) / (a * (b - a));
}
public static double code(double a, double b) {
return (0.5 * (Math.PI / b)) / (a * (b - a));
}
def code(a, b): return (0.5 * (math.pi / b)) / (a * (b - a))
function code(a, b) return Float64(Float64(0.5 * Float64(pi / b)) / Float64(a * Float64(b - a))) end
function tmp = code(a, b) tmp = (0.5 * (pi / b)) / (a * (b - a)); end
code[a_, b_] := N[(N[(0.5 * N[(Pi / b), $MachinePrecision]), $MachinePrecision] / N[(a * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5 \cdot \frac{\pi}{b}}{a \cdot \left(b - a\right)}
\end{array}
Initial program 81.9%
associate-*l*81.9%
*-rgt-identity81.9%
associate-/l*81.9%
metadata-eval81.9%
associate-*l/82.0%
*-lft-identity82.0%
sub-neg82.0%
distribute-neg-frac82.0%
metadata-eval82.0%
Simplified82.0%
metadata-eval82.0%
div-inv82.0%
associate-*r/81.9%
*-commutative81.9%
difference-of-squares90.1%
associate-/r*99.6%
Applied egg-rr61.0%
Taylor expanded in a around 0 61.1%
associate-*r/61.1%
*-commutative61.1%
times-frac61.0%
Simplified61.0%
*-un-lft-identity61.0%
associate-/l*55.6%
Applied egg-rr55.6%
*-lft-identity55.6%
Simplified55.6%
*-commutative55.6%
frac-times61.1%
*-commutative61.1%
associate-*r/61.1%
*-commutative61.1%
*-un-lft-identity61.1%
times-frac61.1%
metadata-eval61.1%
Applied egg-rr61.1%
Final simplification61.1%
(FPCore (a b) :precision binary64 (* (/ (/ 0.5 b) a) (/ PI (- b a))))
double code(double a, double b) {
return ((0.5 / b) / a) * (((double) M_PI) / (b - a));
}
public static double code(double a, double b) {
return ((0.5 / b) / a) * (Math.PI / (b - a));
}
def code(a, b): return ((0.5 / b) / a) * (math.pi / (b - a))
function code(a, b) return Float64(Float64(Float64(0.5 / b) / a) * Float64(pi / Float64(b - a))) end
function tmp = code(a, b) tmp = ((0.5 / b) / a) * (pi / (b - a)); end
code[a_, b_] := N[(N[(N[(0.5 / b), $MachinePrecision] / a), $MachinePrecision] * N[(Pi / N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5}{b}}{a} \cdot \frac{\pi}{b - a}
\end{array}
Initial program 81.9%
associate-*l*81.9%
*-rgt-identity81.9%
associate-/l*81.9%
metadata-eval81.9%
associate-*l/82.0%
*-lft-identity82.0%
sub-neg82.0%
distribute-neg-frac82.0%
metadata-eval82.0%
Simplified82.0%
metadata-eval82.0%
div-inv82.0%
associate-*r/81.9%
*-commutative81.9%
difference-of-squares90.1%
associate-/r*99.6%
Applied egg-rr61.0%
Taylor expanded in a around 0 61.1%
associate-*r/61.1%
*-commutative61.1%
times-frac61.0%
Simplified61.0%
associate-*l/61.1%
Applied egg-rr61.1%
associate-/l/61.1%
*-commutative61.1%
frac-times55.6%
*-commutative55.6%
frac-times61.1%
*-commutative61.1%
times-frac61.1%
Applied egg-rr61.1%
(FPCore (a b) :precision binary64 (* (/ PI a) (/ (/ 0.5 b) (- b a))))
double code(double a, double b) {
return (((double) M_PI) / a) * ((0.5 / b) / (b - a));
}
public static double code(double a, double b) {
return (Math.PI / a) * ((0.5 / b) / (b - a));
}
def code(a, b): return (math.pi / a) * ((0.5 / b) / (b - a))
function code(a, b) return Float64(Float64(pi / a) * Float64(Float64(0.5 / b) / Float64(b - a))) end
function tmp = code(a, b) tmp = (pi / a) * ((0.5 / b) / (b - a)); end
code[a_, b_] := N[(N[(Pi / a), $MachinePrecision] * N[(N[(0.5 / b), $MachinePrecision] / N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi}{a} \cdot \frac{\frac{0.5}{b}}{b - a}
\end{array}
Initial program 81.9%
associate-*l*81.9%
*-rgt-identity81.9%
associate-/l*81.9%
metadata-eval81.9%
associate-*l/82.0%
*-lft-identity82.0%
sub-neg82.0%
distribute-neg-frac82.0%
metadata-eval82.0%
Simplified82.0%
metadata-eval82.0%
div-inv82.0%
associate-*r/81.9%
*-commutative81.9%
difference-of-squares90.1%
associate-/r*99.6%
Applied egg-rr61.0%
Taylor expanded in a around 0 61.1%
associate-*r/61.1%
*-commutative61.1%
times-frac61.0%
Simplified61.0%
*-un-lft-identity61.0%
associate-/l*55.6%
Applied egg-rr55.6%
*-lft-identity55.6%
Simplified55.6%
(FPCore (a b) :precision binary64 (* (/ PI a) (/ -0.5 (* b a))))
double code(double a, double b) {
return (((double) M_PI) / a) * (-0.5 / (b * a));
}
public static double code(double a, double b) {
return (Math.PI / a) * (-0.5 / (b * a));
}
def code(a, b): return (math.pi / a) * (-0.5 / (b * a))
function code(a, b) return Float64(Float64(pi / a) * Float64(-0.5 / Float64(b * a))) end
function tmp = code(a, b) tmp = (pi / a) * (-0.5 / (b * a)); end
code[a_, b_] := N[(N[(Pi / a), $MachinePrecision] * N[(-0.5 / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi}{a} \cdot \frac{-0.5}{b \cdot a}
\end{array}
Initial program 81.9%
associate-*l*81.9%
*-rgt-identity81.9%
associate-/l*81.9%
metadata-eval81.9%
associate-*l/82.0%
*-lft-identity82.0%
sub-neg82.0%
distribute-neg-frac82.0%
metadata-eval82.0%
Simplified82.0%
metadata-eval82.0%
div-inv82.0%
associate-*r/81.9%
*-commutative81.9%
difference-of-squares90.1%
associate-/r*99.6%
Applied egg-rr61.0%
Taylor expanded in a around 0 61.1%
associate-*r/61.1%
*-commutative61.1%
times-frac61.0%
Simplified61.0%
*-un-lft-identity61.0%
associate-/l*55.6%
Applied egg-rr55.6%
*-lft-identity55.6%
Simplified55.6%
Taylor expanded in b around 0 28.9%
Final simplification28.9%
herbie shell --seed 2024101
(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))))