
(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 8 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) (+ 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(Float64(pi * 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[(N[(Pi * 0.5), $MachinePrecision] / N[(a + b), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\pi \cdot 0.5}{a + b}}{a \cdot b}
\end{array}
Initial program 78.1%
*-commutative78.1%
associate-*r*78.1%
associate-*r/78.1%
associate-*r*78.1%
*-rgt-identity78.1%
sub-neg78.1%
distribute-neg-frac78.1%
metadata-eval78.1%
Simplified78.1%
*-commutative78.1%
difference-of-squares88.3%
times-frac99.3%
div-inv99.3%
metadata-eval99.3%
add-sqr-sqrt50.2%
sqrt-unprod72.4%
frac-times72.4%
metadata-eval72.4%
metadata-eval72.4%
frac-times72.4%
sqrt-unprod31.8%
add-sqr-sqrt71.5%
Applied egg-rr71.5%
*-commutative71.5%
+-commutative71.5%
associate-/l*71.5%
+-commutative71.5%
Simplified71.5%
Taylor expanded in b around inf 99.6%
associate-*r/99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-un-lft-identity99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (a b) :precision binary64 (if (<= b 2.25e-27) (/ (* (/ PI a) -0.5) (* a (- b))) (* (/ 1.0 (* a b)) (* PI (/ 0.5 b)))))
double code(double a, double b) {
double tmp;
if (b <= 2.25e-27) {
tmp = ((((double) M_PI) / a) * -0.5) / (a * -b);
} else {
tmp = (1.0 / (a * b)) * (((double) M_PI) * (0.5 / b));
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (b <= 2.25e-27) {
tmp = ((Math.PI / a) * -0.5) / (a * -b);
} else {
tmp = (1.0 / (a * b)) * (Math.PI * (0.5 / b));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 2.25e-27: tmp = ((math.pi / a) * -0.5) / (a * -b) else: tmp = (1.0 / (a * b)) * (math.pi * (0.5 / b)) return tmp
function code(a, b) tmp = 0.0 if (b <= 2.25e-27) tmp = Float64(Float64(Float64(pi / a) * -0.5) / Float64(a * Float64(-b))); else tmp = Float64(Float64(1.0 / Float64(a * b)) * Float64(pi * Float64(0.5 / b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 2.25e-27) tmp = ((pi / a) * -0.5) / (a * -b); else tmp = (1.0 / (a * b)) * (pi * (0.5 / b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 2.25e-27], N[(N[(N[(Pi / a), $MachinePrecision] * -0.5), $MachinePrecision] / N[(a * (-b)), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(a * b), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.25 \cdot 10^{-27}:\\
\;\;\;\;\frac{\frac{\pi}{a} \cdot -0.5}{a \cdot \left(-b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot b} \cdot \left(\pi \cdot \frac{0.5}{b}\right)\\
\end{array}
\end{array}
if b < 2.2500000000000001e-27Initial program 79.7%
*-commutative79.7%
associate-*r*79.8%
associate-*r/79.8%
associate-*r*79.8%
*-rgt-identity79.8%
sub-neg79.8%
distribute-neg-frac79.8%
metadata-eval79.8%
Simplified79.8%
*-commutative79.8%
difference-of-squares88.2%
times-frac99.2%
div-inv99.2%
metadata-eval99.2%
add-sqr-sqrt67.3%
sqrt-unprod65.1%
frac-times65.1%
metadata-eval65.1%
metadata-eval65.1%
frac-times65.1%
sqrt-unprod10.7%
add-sqr-sqrt63.9%
Applied egg-rr63.9%
*-commutative63.9%
+-commutative63.9%
associate-/l*63.9%
+-commutative63.9%
Simplified63.9%
Taylor expanded in b around inf 99.6%
Taylor expanded in a around inf 68.1%
associate-*l/68.2%
*-un-lft-identity68.2%
associate-*r/68.2%
*-commutative68.2%
associate-*r/68.2%
frac-2neg68.2%
*-commutative68.2%
distribute-rgt-neg-in68.2%
metadata-eval68.2%
distribute-rgt-neg-in68.2%
Applied egg-rr68.2%
if 2.2500000000000001e-27 < b Initial program 73.3%
*-commutative73.3%
associate-*r*73.3%
associate-*r/73.3%
associate-*r*73.3%
*-rgt-identity73.3%
sub-neg73.3%
distribute-neg-frac73.3%
metadata-eval73.3%
Simplified73.3%
*-commutative73.3%
difference-of-squares88.7%
times-frac99.6%
div-inv99.6%
metadata-eval99.6%
add-sqr-sqrt0.0%
sqrt-unprod93.9%
frac-times93.9%
metadata-eval93.9%
metadata-eval93.9%
frac-times93.9%
sqrt-unprod93.9%
add-sqr-sqrt93.9%
Applied egg-rr93.9%
*-commutative93.9%
+-commutative93.9%
associate-/l*94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in b around inf 99.6%
Taylor expanded in a around 0 84.0%
Final simplification72.2%
(FPCore (a b) :precision binary64 (if (<= b 2e+142) (* (/ PI a) (/ (/ 0.5 b) (+ a b))) (* (/ 1.0 (* a b)) (* PI (/ 0.5 b)))))
double code(double a, double b) {
double tmp;
if (b <= 2e+142) {
tmp = (((double) M_PI) / a) * ((0.5 / b) / (a + b));
} else {
tmp = (1.0 / (a * b)) * (((double) M_PI) * (0.5 / b));
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (b <= 2e+142) {
tmp = (Math.PI / a) * ((0.5 / b) / (a + b));
} else {
tmp = (1.0 / (a * b)) * (Math.PI * (0.5 / b));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 2e+142: tmp = (math.pi / a) * ((0.5 / b) / (a + b)) else: tmp = (1.0 / (a * b)) * (math.pi * (0.5 / b)) return tmp
function code(a, b) tmp = 0.0 if (b <= 2e+142) tmp = Float64(Float64(pi / a) * Float64(Float64(0.5 / b) / Float64(a + b))); else tmp = Float64(Float64(1.0 / Float64(a * b)) * Float64(pi * Float64(0.5 / b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 2e+142) tmp = (pi / a) * ((0.5 / b) / (a + b)); else tmp = (1.0 / (a * b)) * (pi * (0.5 / b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 2e+142], N[(N[(Pi / a), $MachinePrecision] * N[(N[(0.5 / b), $MachinePrecision] / N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(a * b), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2 \cdot 10^{+142}:\\
\;\;\;\;\frac{\pi}{a} \cdot \frac{\frac{0.5}{b}}{a + b}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot b} \cdot \left(\pi \cdot \frac{0.5}{b}\right)\\
\end{array}
\end{array}
if b < 2.0000000000000001e142Initial program 82.9%
*-commutative82.9%
associate-*r*82.9%
associate-*r/82.9%
associate-*r*82.9%
*-rgt-identity82.9%
sub-neg82.9%
distribute-neg-frac82.9%
metadata-eval82.9%
Simplified82.9%
*-commutative82.9%
difference-of-squares90.0%
times-frac99.2%
div-inv99.2%
metadata-eval99.2%
add-sqr-sqrt56.6%
sqrt-unprod68.9%
frac-times68.9%
metadata-eval68.9%
metadata-eval68.9%
frac-times68.9%
sqrt-unprod23.2%
add-sqr-sqrt67.9%
Applied egg-rr67.9%
*-commutative67.9%
+-commutative67.9%
associate-/l*67.9%
+-commutative67.9%
Simplified67.9%
Taylor expanded in b around inf 99.6%
associate-*r/99.7%
+-commutative99.7%
Applied egg-rr99.7%
clear-num99.6%
frac-2neg99.6%
metadata-eval99.6%
frac-2neg99.6%
metadata-eval99.6%
frac-times99.4%
metadata-eval99.4%
distribute-rgt-neg-in99.4%
distribute-neg-frac299.4%
+-commutative99.4%
distribute-rgt-neg-in99.4%
metadata-eval99.4%
Applied egg-rr99.4%
distribute-rgt-neg-out99.4%
distribute-lft-neg-out99.4%
associate-*r/99.4%
associate-*r*96.6%
*-commutative96.6%
distribute-frac-neg296.6%
*-commutative96.6%
distribute-rgt-neg-in96.6%
metadata-eval96.6%
associate-/r/96.6%
associate-*l/96.6%
*-lft-identity96.6%
times-frac96.8%
associate-/r*96.3%
Simplified96.3%
if 2.0000000000000001e142 < b Initial program 40.7%
*-commutative40.7%
associate-*r*40.7%
associate-*r/40.7%
associate-*r*40.7%
*-rgt-identity40.7%
sub-neg40.7%
distribute-neg-frac40.7%
metadata-eval40.7%
Simplified40.7%
*-commutative40.7%
difference-of-squares75.2%
times-frac99.8%
div-inv99.8%
metadata-eval99.8%
add-sqr-sqrt0.0%
sqrt-unprod99.8%
frac-times99.8%
metadata-eval99.8%
metadata-eval99.8%
frac-times99.8%
sqrt-unprod99.8%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
*-commutative99.8%
+-commutative99.8%
associate-/l*99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in b around inf 99.8%
Taylor expanded in a around 0 99.8%
Final simplification96.7%
(FPCore (a b) :precision binary64 (if (<= b 1.15e+76) (* (/ PI a) (/ (/ 0.5 b) (+ a b))) (/ (* 0.5 (/ PI (* a b))) (- b a))))
double code(double a, double b) {
double tmp;
if (b <= 1.15e+76) {
tmp = (((double) M_PI) / a) * ((0.5 / b) / (a + b));
} else {
tmp = (0.5 * (((double) M_PI) / (a * b))) / (b - a);
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (b <= 1.15e+76) {
tmp = (Math.PI / a) * ((0.5 / b) / (a + b));
} else {
tmp = (0.5 * (Math.PI / (a * b))) / (b - a);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 1.15e+76: tmp = (math.pi / a) * ((0.5 / b) / (a + b)) else: tmp = (0.5 * (math.pi / (a * b))) / (b - a) return tmp
function code(a, b) tmp = 0.0 if (b <= 1.15e+76) tmp = Float64(Float64(pi / a) * Float64(Float64(0.5 / b) / Float64(a + b))); else tmp = Float64(Float64(0.5 * Float64(pi / Float64(a * b))) / Float64(b - a)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 1.15e+76) tmp = (pi / a) * ((0.5 / b) / (a + b)); else tmp = (0.5 * (pi / (a * b))) / (b - a); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 1.15e+76], N[(N[(Pi / a), $MachinePrecision] * N[(N[(0.5 / b), $MachinePrecision] / N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(Pi / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b - a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.15 \cdot 10^{+76}:\\
\;\;\;\;\frac{\pi}{a} \cdot \frac{\frac{0.5}{b}}{a + b}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{a \cdot b}}{b - a}\\
\end{array}
\end{array}
if b < 1.15000000000000001e76Initial program 81.9%
*-commutative81.9%
associate-*r*81.9%
associate-*r/81.9%
associate-*r*81.9%
*-rgt-identity81.9%
sub-neg81.9%
distribute-neg-frac81.9%
metadata-eval81.9%
Simplified81.9%
*-commutative81.9%
difference-of-squares89.4%
times-frac99.2%
div-inv99.2%
metadata-eval99.2%
add-sqr-sqrt60.1%
sqrt-unprod67.4%
frac-times67.4%
metadata-eval67.4%
metadata-eval67.4%
frac-times67.4%
sqrt-unprod18.9%
add-sqr-sqrt66.4%
Applied egg-rr66.4%
*-commutative66.4%
+-commutative66.4%
associate-/l*66.4%
+-commutative66.4%
Simplified66.4%
Taylor expanded in b around inf 99.6%
associate-*r/99.7%
+-commutative99.7%
Applied egg-rr99.7%
clear-num99.6%
frac-2neg99.6%
metadata-eval99.6%
frac-2neg99.6%
metadata-eval99.6%
frac-times99.4%
metadata-eval99.4%
distribute-rgt-neg-in99.4%
distribute-neg-frac299.4%
+-commutative99.4%
distribute-rgt-neg-in99.4%
metadata-eval99.4%
Applied egg-rr99.4%
distribute-rgt-neg-out99.4%
distribute-lft-neg-out99.4%
associate-*r/99.4%
associate-*r*96.4%
*-commutative96.4%
distribute-frac-neg296.4%
*-commutative96.4%
distribute-rgt-neg-in96.4%
metadata-eval96.4%
associate-/r/96.4%
associate-*l/96.4%
*-lft-identity96.4%
times-frac96.6%
associate-/r*96.2%
Simplified96.2%
if 1.15000000000000001e76 < b Initial program 58.9%
associate-*l*58.9%
*-rgt-identity58.9%
associate-/l*58.9%
metadata-eval58.9%
associate-*l/58.9%
*-lft-identity58.9%
sub-neg58.9%
distribute-neg-frac58.9%
metadata-eval58.9%
Simplified58.9%
metadata-eval58.9%
div-inv58.9%
associate-*r/58.9%
*-commutative58.9%
difference-of-squares82.7%
associate-/r*99.7%
Applied egg-rr97.5%
Taylor expanded in a around 0 97.5%
Final simplification96.4%
(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.1%
*-commutative78.1%
associate-*r*78.1%
associate-*r/78.1%
associate-*r*78.1%
*-rgt-identity78.1%
sub-neg78.1%
distribute-neg-frac78.1%
metadata-eval78.1%
Simplified78.1%
*-commutative78.1%
difference-of-squares88.3%
times-frac99.3%
div-inv99.3%
metadata-eval99.3%
add-sqr-sqrt50.2%
sqrt-unprod72.4%
frac-times72.4%
metadata-eval72.4%
metadata-eval72.4%
frac-times72.4%
sqrt-unprod31.8%
add-sqr-sqrt71.5%
Applied egg-rr71.5%
*-commutative71.5%
+-commutative71.5%
associate-/l*71.5%
+-commutative71.5%
Simplified71.5%
Taylor expanded in b around inf 99.6%
associate-*l/99.7%
*-un-lft-identity99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (a b) :precision binary64 (/ (* (/ PI a) -0.5) (* a (- b))))
double code(double a, double b) {
return ((((double) M_PI) / a) * -0.5) / (a * -b);
}
public static double code(double a, double b) {
return ((Math.PI / a) * -0.5) / (a * -b);
}
def code(a, b): return ((math.pi / a) * -0.5) / (a * -b)
function code(a, b) return Float64(Float64(Float64(pi / a) * -0.5) / Float64(a * Float64(-b))) end
function tmp = code(a, b) tmp = ((pi / a) * -0.5) / (a * -b); end
code[a_, b_] := N[(N[(N[(Pi / a), $MachinePrecision] * -0.5), $MachinePrecision] / N[(a * (-b)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\pi}{a} \cdot -0.5}{a \cdot \left(-b\right)}
\end{array}
Initial program 78.1%
*-commutative78.1%
associate-*r*78.1%
associate-*r/78.1%
associate-*r*78.1%
*-rgt-identity78.1%
sub-neg78.1%
distribute-neg-frac78.1%
metadata-eval78.1%
Simplified78.1%
*-commutative78.1%
difference-of-squares88.3%
times-frac99.3%
div-inv99.3%
metadata-eval99.3%
add-sqr-sqrt50.2%
sqrt-unprod72.4%
frac-times72.4%
metadata-eval72.4%
metadata-eval72.4%
frac-times72.4%
sqrt-unprod31.8%
add-sqr-sqrt71.5%
Applied egg-rr71.5%
*-commutative71.5%
+-commutative71.5%
associate-/l*71.5%
+-commutative71.5%
Simplified71.5%
Taylor expanded in b around inf 99.6%
Taylor expanded in a around inf 64.8%
associate-*l/64.9%
*-un-lft-identity64.9%
associate-*r/64.9%
*-commutative64.9%
associate-*r/64.9%
frac-2neg64.9%
*-commutative64.9%
distribute-rgt-neg-in64.9%
metadata-eval64.9%
distribute-rgt-neg-in64.9%
Applied egg-rr64.9%
Final simplification64.9%
(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(Float64(pi * 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[(N[(Pi * 0.5), $MachinePrecision] / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi \cdot 0.5}{a \cdot \left(a \cdot b\right)}
\end{array}
Initial program 78.1%
*-commutative78.1%
associate-*r*78.1%
associate-*r/78.1%
associate-*r*78.1%
*-rgt-identity78.1%
sub-neg78.1%
distribute-neg-frac78.1%
metadata-eval78.1%
Simplified78.1%
*-commutative78.1%
difference-of-squares88.3%
times-frac99.3%
div-inv99.3%
metadata-eval99.3%
add-sqr-sqrt50.2%
sqrt-unprod72.4%
frac-times72.4%
metadata-eval72.4%
metadata-eval72.4%
frac-times72.4%
sqrt-unprod31.8%
add-sqr-sqrt71.5%
Applied egg-rr71.5%
*-commutative71.5%
+-commutative71.5%
associate-/l*71.5%
+-commutative71.5%
Simplified71.5%
Taylor expanded in b around inf 99.6%
Taylor expanded in a around inf 64.8%
associate-*r/64.9%
frac-times64.7%
*-un-lft-identity64.7%
Applied egg-rr64.7%
Final simplification64.7%
(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(Float64(pi * Float64(0.5 / a)) / Float64(a * b)) end
function tmp = code(a, b) tmp = (pi * (0.5 / a)) / (a * b); end
code[a_, b_] := N[(N[(Pi * N[(0.5 / a), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi \cdot \frac{0.5}{a}}{a \cdot b}
\end{array}
Initial program 78.1%
*-commutative78.1%
associate-*r*78.1%
associate-*r/78.1%
associate-*r*78.1%
*-rgt-identity78.1%
sub-neg78.1%
distribute-neg-frac78.1%
metadata-eval78.1%
Simplified78.1%
*-commutative78.1%
difference-of-squares88.3%
times-frac99.3%
div-inv99.3%
metadata-eval99.3%
add-sqr-sqrt50.2%
sqrt-unprod72.4%
frac-times72.4%
metadata-eval72.4%
metadata-eval72.4%
frac-times72.4%
sqrt-unprod31.8%
add-sqr-sqrt71.5%
Applied egg-rr71.5%
*-commutative71.5%
+-commutative71.5%
associate-/l*71.5%
+-commutative71.5%
Simplified71.5%
Taylor expanded in b around inf 99.6%
Taylor expanded in a around inf 64.8%
associate-*l/64.9%
*-un-lft-identity64.9%
Applied egg-rr64.9%
Final simplification64.9%
herbie shell --seed 2024089
(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))))