
(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 (+ a b)) (/ (* a b) 0.5)))
double code(double a, double b) {
return (((double) M_PI) / (a + b)) / ((a * b) / 0.5);
}
public static double code(double a, double b) {
return (Math.PI / (a + b)) / ((a * b) / 0.5);
}
def code(a, b): return (math.pi / (a + b)) / ((a * b) / 0.5)
function code(a, b) return Float64(Float64(pi / Float64(a + b)) / Float64(Float64(a * b) / 0.5)) end
function tmp = code(a, b) tmp = (pi / (a + b)) / ((a * b) / 0.5); end
code[a_, b_] := N[(N[(Pi / N[(a + b), $MachinePrecision]), $MachinePrecision] / N[(N[(a * b), $MachinePrecision] / 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\pi}{a + b}}{\frac{a \cdot b}{0.5}}
\end{array}
Initial program 77.4%
*-commutative77.4%
associate-*l/77.4%
associate-*r/77.4%
associate-/l*77.4%
sub-neg77.4%
distribute-neg-frac77.4%
metadata-eval77.4%
associate-*r/77.4%
*-rgt-identity77.4%
difference-of-squares85.2%
associate-/r*85.2%
Simplified85.2%
div-inv85.2%
associate-/r/85.1%
Applied egg-rr85.1%
associate-*r/85.2%
*-rgt-identity85.2%
associate-*l/85.3%
+-commutative85.3%
Simplified85.3%
associate-/r/99.6%
Applied egg-rr99.6%
associate-*l/99.6%
*-commutative99.6%
times-frac99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
sub-neg99.6%
Simplified99.6%
Taylor expanded in a around 0 99.6%
associate-*l/99.7%
*-un-lft-identity99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-/l*99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (a b) :precision binary64 (if (<= a -2.4e-90) (/ (* PI (/ 0.5 a)) (* a b)) (* (/ 1.0 (* a b)) (/ (/ PI b) 2.0))))
double code(double a, double b) {
double tmp;
if (a <= -2.4e-90) {
tmp = (((double) M_PI) * (0.5 / a)) / (a * b);
} else {
tmp = (1.0 / (a * b)) * ((((double) M_PI) / b) / 2.0);
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -2.4e-90) {
tmp = (Math.PI * (0.5 / a)) / (a * b);
} else {
tmp = (1.0 / (a * b)) * ((Math.PI / b) / 2.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2.4e-90: tmp = (math.pi * (0.5 / a)) / (a * b) else: tmp = (1.0 / (a * b)) * ((math.pi / b) / 2.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -2.4e-90) tmp = Float64(Float64(pi * Float64(0.5 / a)) / Float64(a * b)); else tmp = Float64(Float64(1.0 / Float64(a * b)) * Float64(Float64(pi / b) / 2.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2.4e-90) tmp = (pi * (0.5 / a)) / (a * b); else tmp = (1.0 / (a * b)) * ((pi / b) / 2.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2.4e-90], N[(N[(Pi * N[(0.5 / a), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(a * b), $MachinePrecision]), $MachinePrecision] * N[(N[(Pi / b), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{-90}:\\
\;\;\;\;\frac{\pi \cdot \frac{0.5}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot b} \cdot \frac{\frac{\pi}{b}}{2}\\
\end{array}
\end{array}
if a < -2.4000000000000002e-90Initial program 81.0%
Taylor expanded in b around 0 68.6%
unpow268.6%
Simplified68.6%
associate-*r/68.6%
associate-*l*78.7%
frac-times78.6%
associate-*r/78.6%
Applied egg-rr78.6%
if -2.4000000000000002e-90 < a Initial program 75.7%
*-commutative75.7%
associate-*l/75.7%
associate-*r/75.7%
associate-/l*75.7%
sub-neg75.7%
distribute-neg-frac75.7%
metadata-eval75.7%
associate-*r/75.8%
*-rgt-identity75.8%
difference-of-squares83.9%
associate-/r*83.9%
Simplified83.9%
div-inv83.8%
associate-/r/83.7%
Applied egg-rr83.7%
associate-*r/83.8%
*-rgt-identity83.8%
associate-*l/83.9%
+-commutative83.9%
Simplified83.9%
associate-/r/99.7%
Applied egg-rr99.7%
associate-*l/99.7%
*-commutative99.7%
times-frac99.7%
metadata-eval99.7%
distribute-neg-frac99.7%
sub-neg99.7%
Simplified99.7%
Taylor expanded in a around 0 99.6%
Taylor expanded in a around 0 76.7%
Final simplification77.3%
(FPCore (a b) :precision binary64 (if (<= a -2.4e-90) (* 0.5 (/ PI (* a (* a b)))) (* 0.5 (/ PI (* a (* b b))))))
double code(double a, double b) {
double tmp;
if (a <= -2.4e-90) {
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-90) {
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-90: 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-90) tmp = Float64(0.5 * Float64(pi / Float64(a * Float64(a * b)))); else tmp = Float64(0.5 * Float64(pi / Float64(a * Float64(b * b)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2.4e-90) 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-90], N[(0.5 * N[(Pi / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(Pi / N[(a * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{-90}:\\
\;\;\;\;0.5 \cdot \frac{\pi}{a \cdot \left(a \cdot b\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\pi}{a \cdot \left(b \cdot b\right)}\\
\end{array}
\end{array}
if a < -2.4000000000000002e-90Initial program 81.0%
*-commutative81.0%
associate-*l/81.0%
associate-*r/81.0%
associate-/l*80.8%
sub-neg80.8%
distribute-neg-frac80.8%
metadata-eval80.8%
associate-*r/80.9%
*-rgt-identity80.9%
difference-of-squares88.1%
associate-/r*88.1%
Simplified88.1%
clear-num88.1%
inv-pow88.1%
associate-/r/88.0%
Applied egg-rr88.0%
unpow-188.0%
associate-/l*98.3%
associate-/r/98.2%
+-commutative98.2%
Simplified98.2%
Taylor expanded in a around inf 68.6%
unpow268.6%
associate-*l*78.7%
Simplified78.7%
if -2.4000000000000002e-90 < a Initial program 75.7%
Taylor expanded in b around inf 64.3%
unpow264.3%
Simplified64.3%
Final simplification68.9%
(FPCore (a b) :precision binary64 (if (<= a -2.2e-92) (* 0.5 (/ PI (* a (* a b)))) (* 0.5 (/ PI (* b (* a b))))))
double code(double a, double b) {
double tmp;
if (a <= -2.2e-92) {
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.2e-92) {
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.2e-92: 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.2e-92) tmp = Float64(0.5 * Float64(pi / Float64(a * Float64(a * b)))); else tmp = Float64(0.5 * Float64(pi / Float64(b * Float64(a * b)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2.2e-92) 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.2e-92], N[(0.5 * N[(Pi / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(Pi / N[(b * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.2 \cdot 10^{-92}:\\
\;\;\;\;0.5 \cdot \frac{\pi}{a \cdot \left(a \cdot b\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\pi}{b \cdot \left(a \cdot b\right)}\\
\end{array}
\end{array}
if a < -2.19999999999999987e-92Initial program 81.0%
*-commutative81.0%
associate-*l/81.0%
associate-*r/81.0%
associate-/l*80.8%
sub-neg80.8%
distribute-neg-frac80.8%
metadata-eval80.8%
associate-*r/80.9%
*-rgt-identity80.9%
difference-of-squares88.1%
associate-/r*88.1%
Simplified88.1%
clear-num88.1%
inv-pow88.1%
associate-/r/88.0%
Applied egg-rr88.0%
unpow-188.0%
associate-/l*98.3%
associate-/r/98.2%
+-commutative98.2%
Simplified98.2%
Taylor expanded in a around inf 68.6%
unpow268.6%
associate-*l*78.7%
Simplified78.7%
if -2.19999999999999987e-92 < a Initial program 75.7%
*-commutative75.7%
associate-*l/75.7%
associate-*r/75.7%
associate-/l*75.7%
sub-neg75.7%
distribute-neg-frac75.7%
metadata-eval75.7%
associate-*r/75.8%
*-rgt-identity75.8%
difference-of-squares83.9%
associate-/r*83.9%
Simplified83.9%
clear-num83.8%
inv-pow83.8%
associate-/r/83.8%
Applied egg-rr83.8%
unpow-183.8%
associate-/l*98.9%
associate-/r/98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in a around 0 64.3%
unpow264.3%
*-lft-identity64.3%
*-lft-identity64.3%
associate-*r*76.2%
Simplified76.2%
Final simplification77.0%
(FPCore (a b) :precision binary64 (if (<= a -2.4e-90) (* (/ 0.5 a) (/ PI (* a b))) (* 0.5 (/ PI (* b (* a b))))))
double code(double a, double b) {
double tmp;
if (a <= -2.4e-90) {
tmp = (0.5 / a) * (((double) M_PI) / (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.4e-90) {
tmp = (0.5 / a) * (Math.PI / (a * b));
} else {
tmp = 0.5 * (Math.PI / (b * (a * b)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2.4e-90: tmp = (0.5 / a) * (math.pi / (a * b)) else: tmp = 0.5 * (math.pi / (b * (a * b))) return tmp
function code(a, b) tmp = 0.0 if (a <= -2.4e-90) tmp = Float64(Float64(0.5 / a) * Float64(pi / Float64(a * b))); else tmp = Float64(0.5 * Float64(pi / Float64(b * Float64(a * b)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2.4e-90) tmp = (0.5 / a) * (pi / (a * b)); else tmp = 0.5 * (pi / (b * (a * b))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2.4e-90], N[(N[(0.5 / a), $MachinePrecision] * N[(Pi / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(Pi / N[(b * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{-90}:\\
\;\;\;\;\frac{0.5}{a} \cdot \frac{\pi}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\pi}{b \cdot \left(a \cdot b\right)}\\
\end{array}
\end{array}
if a < -2.4000000000000002e-90Initial program 81.0%
*-commutative81.0%
associate-*l/81.0%
associate-*r/81.0%
associate-/l*80.8%
sub-neg80.8%
distribute-neg-frac80.8%
metadata-eval80.8%
associate-*r/80.9%
*-rgt-identity80.9%
difference-of-squares88.1%
associate-/r*88.1%
Simplified88.1%
div-inv88.1%
associate-/r/88.1%
Applied egg-rr88.1%
associate-*r/88.1%
*-rgt-identity88.1%
associate-*l/88.2%
+-commutative88.2%
Simplified88.2%
associate-/r/99.6%
Applied egg-rr99.6%
associate-*l/99.6%
*-commutative99.6%
times-frac99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
sub-neg99.6%
Simplified99.6%
Taylor expanded in a around inf 68.6%
unpow268.6%
associate-*r*78.7%
associate-*r/78.7%
times-frac78.6%
Simplified78.6%
if -2.4000000000000002e-90 < a Initial program 75.7%
*-commutative75.7%
associate-*l/75.7%
associate-*r/75.7%
associate-/l*75.7%
sub-neg75.7%
distribute-neg-frac75.7%
metadata-eval75.7%
associate-*r/75.8%
*-rgt-identity75.8%
difference-of-squares83.9%
associate-/r*83.9%
Simplified83.9%
clear-num83.8%
inv-pow83.8%
associate-/r/83.8%
Applied egg-rr83.8%
unpow-183.8%
associate-/l*98.9%
associate-/r/98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in a around 0 64.3%
unpow264.3%
*-lft-identity64.3%
*-lft-identity64.3%
associate-*r*76.2%
Simplified76.2%
Final simplification77.0%
(FPCore (a b) :precision binary64 (if (<= a -2.4e-90) (/ (* PI (/ 0.5 a)) (* a b)) (* 0.5 (/ PI (* b (* a b))))))
double code(double a, double b) {
double tmp;
if (a <= -2.4e-90) {
tmp = (((double) M_PI) * (0.5 / 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.4e-90) {
tmp = (Math.PI * (0.5 / a)) / (a * b);
} else {
tmp = 0.5 * (Math.PI / (b * (a * b)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2.4e-90: tmp = (math.pi * (0.5 / a)) / (a * b) else: tmp = 0.5 * (math.pi / (b * (a * b))) return tmp
function code(a, b) tmp = 0.0 if (a <= -2.4e-90) tmp = Float64(Float64(pi * Float64(0.5 / a)) / Float64(a * b)); else tmp = Float64(0.5 * Float64(pi / Float64(b * Float64(a * b)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2.4e-90) tmp = (pi * (0.5 / a)) / (a * b); else tmp = 0.5 * (pi / (b * (a * b))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2.4e-90], N[(N[(Pi * N[(0.5 / a), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(Pi / N[(b * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{-90}:\\
\;\;\;\;\frac{\pi \cdot \frac{0.5}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\pi}{b \cdot \left(a \cdot b\right)}\\
\end{array}
\end{array}
if a < -2.4000000000000002e-90Initial program 81.0%
Taylor expanded in b around 0 68.6%
unpow268.6%
Simplified68.6%
associate-*r/68.6%
associate-*l*78.7%
frac-times78.6%
associate-*r/78.6%
Applied egg-rr78.6%
if -2.4000000000000002e-90 < a Initial program 75.7%
*-commutative75.7%
associate-*l/75.7%
associate-*r/75.7%
associate-/l*75.7%
sub-neg75.7%
distribute-neg-frac75.7%
metadata-eval75.7%
associate-*r/75.8%
*-rgt-identity75.8%
difference-of-squares83.9%
associate-/r*83.9%
Simplified83.9%
clear-num83.8%
inv-pow83.8%
associate-/r/83.8%
Applied egg-rr83.8%
unpow-183.8%
associate-/l*98.9%
associate-/r/98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in a around 0 64.3%
unpow264.3%
*-lft-identity64.3%
*-lft-identity64.3%
associate-*r*76.2%
Simplified76.2%
Final simplification77.0%
(FPCore (a b) :precision binary64 (/ PI (* (+ a b) (* a (* b 2.0)))))
double code(double a, double b) {
return ((double) M_PI) / ((a + b) * (a * (b * 2.0)));
}
public static double code(double a, double b) {
return Math.PI / ((a + b) * (a * (b * 2.0)));
}
def code(a, b): return math.pi / ((a + b) * (a * (b * 2.0)))
function code(a, b) return Float64(pi / Float64(Float64(a + b) * Float64(a * Float64(b * 2.0)))) end
function tmp = code(a, b) tmp = pi / ((a + b) * (a * (b * 2.0))); end
code[a_, b_] := N[(Pi / N[(N[(a + b), $MachinePrecision] * N[(a * N[(b * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi}{\left(a + b\right) \cdot \left(a \cdot \left(b \cdot 2\right)\right)}
\end{array}
Initial program 77.4%
*-commutative77.4%
associate-*l/77.4%
associate-*r/77.4%
associate-/l*77.4%
sub-neg77.4%
distribute-neg-frac77.4%
metadata-eval77.4%
associate-*r/77.4%
*-rgt-identity77.4%
difference-of-squares85.2%
associate-/r*85.2%
Simplified85.2%
div-inv85.2%
associate-/r/85.1%
Applied egg-rr85.1%
associate-*r/85.2%
*-rgt-identity85.2%
associate-*l/85.3%
+-commutative85.3%
Simplified85.3%
associate-/r/99.6%
Applied egg-rr99.6%
associate-*l/99.6%
*-commutative99.6%
times-frac99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
sub-neg99.6%
Simplified99.6%
Taylor expanded in a around 0 99.6%
expm1-log1p-u82.0%
expm1-udef50.9%
frac-times50.9%
*-un-lft-identity50.9%
Applied egg-rr50.9%
expm1-def82.0%
expm1-log1p99.7%
associate-/l/98.8%
associate-*l*98.8%
Simplified98.8%
Final simplification98.8%
(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(0.5 * Float64(pi / Float64(a * Float64(a * b)))) end
function tmp = code(a, b) tmp = 0.5 * (pi / (a * (a * b))); end
code[a_, b_] := N[(0.5 * N[(Pi / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \frac{\pi}{a \cdot \left(a \cdot b\right)}
\end{array}
Initial program 77.4%
*-commutative77.4%
associate-*l/77.4%
associate-*r/77.4%
associate-/l*77.4%
sub-neg77.4%
distribute-neg-frac77.4%
metadata-eval77.4%
associate-*r/77.4%
*-rgt-identity77.4%
difference-of-squares85.2%
associate-/r*85.2%
Simplified85.2%
clear-num85.2%
inv-pow85.2%
associate-/r/85.2%
Applied egg-rr85.2%
unpow-185.2%
associate-/l*98.7%
associate-/r/98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in a around inf 54.3%
unpow254.3%
associate-*l*59.8%
Simplified59.8%
Final simplification59.8%
herbie shell --seed 2023283
(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))))