
(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 (/ (* (/ PI (+ b a)) 0.5) (* b a)))
double code(double a, double b) {
return ((((double) M_PI) / (b + a)) * 0.5) / (b * a);
}
public static double code(double a, double b) {
return ((Math.PI / (b + a)) * 0.5) / (b * a);
}
def code(a, b): return ((math.pi / (b + a)) * 0.5) / (b * a)
function code(a, b) return Float64(Float64(Float64(pi / Float64(b + a)) * 0.5) / Float64(b * a)) end
function tmp = code(a, b) tmp = ((pi / (b + a)) * 0.5) / (b * a); end
code[a_, b_] := N[(N[(N[(Pi / N[(b + a), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\pi}{b + a} \cdot 0.5}{b \cdot a}
\end{array}
Initial program 82.1%
lift-PI.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
remove-double-negN/A
un-div-invN/A
remove-double-negN/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
Applied rewrites99.6%
lift-PI.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*r/N/A
associate-*r/N/A
Applied rewrites99.7%
(FPCore (a b) :precision binary64 (if (<= a -1.9e+87) (* PI (/ 0.5 (* a (* b a)))) (/ (* PI 0.5) (* b (* a (+ b a))))))
double code(double a, double b) {
double tmp;
if (a <= -1.9e+87) {
tmp = ((double) M_PI) * (0.5 / (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 (a <= -1.9e+87) {
tmp = Math.PI * (0.5 / (a * (b * a)));
} else {
tmp = (Math.PI * 0.5) / (b * (a * (b + a)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -1.9e+87: tmp = math.pi * (0.5 / (a * (b * a))) else: tmp = (math.pi * 0.5) / (b * (a * (b + a))) return tmp
function code(a, b) tmp = 0.0 if (a <= -1.9e+87) tmp = Float64(pi * Float64(0.5 / Float64(a * Float64(b * a)))); else tmp = Float64(Float64(pi * 0.5) / Float64(b * Float64(a * Float64(b + a)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -1.9e+87) tmp = pi * (0.5 / (a * (b * a))); else tmp = (pi * 0.5) / (b * (a * (b + a))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -1.9e+87], N[(Pi * N[(0.5 / N[(a * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * 0.5), $MachinePrecision] / N[(b * N[(a * N[(b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9 \cdot 10^{+87}:\\
\;\;\;\;\pi \cdot \frac{0.5}{a \cdot \left(b \cdot a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi \cdot 0.5}{b \cdot \left(a \cdot \left(b + a\right)\right)}\\
\end{array}
\end{array}
if a < -1.90000000000000006e87Initial program 74.1%
Taylor expanded in b around 0
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6499.4
Applied rewrites99.4%
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.4
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6486.3
Applied rewrites86.3%
associate-*r*N/A
lift-*.f64N/A
lower-*.f6499.4
Applied rewrites99.4%
if -1.90000000000000006e87 < a Initial program 84.3%
lift-PI.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
remove-double-negN/A
un-div-invN/A
remove-double-negN/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
Applied rewrites99.6%
lift-PI.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*r/N/A
frac-timesN/A
*-commutativeN/A
Applied rewrites95.5%
Final simplification96.3%
(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 * Float64(0.5 / 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 * N[(0.5 / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b + a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi \cdot \frac{0.5}{b \cdot a}}{b + a}
\end{array}
Initial program 82.1%
lift-PI.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
remove-double-negN/A
un-div-invN/A
remove-double-negN/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
Applied rewrites99.6%
lift-PI.f64N/A
lift-+.f64N/A
div-invN/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
div-invN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.6%
Final simplification99.6%
(FPCore (a b) :precision binary64 (* (/ PI (+ b a)) (/ 0.5 (* b a))))
double code(double a, double b) {
return (((double) M_PI) / (b + a)) * (0.5 / (b * a));
}
public static double code(double a, double b) {
return (Math.PI / (b + a)) * (0.5 / (b * a));
}
def code(a, b): return (math.pi / (b + a)) * (0.5 / (b * a))
function code(a, b) return Float64(Float64(pi / Float64(b + a)) * Float64(0.5 / Float64(b * a))) end
function tmp = code(a, b) tmp = (pi / (b + a)) * (0.5 / (b * a)); end
code[a_, b_] := N[(N[(Pi / N[(b + a), $MachinePrecision]), $MachinePrecision] * N[(0.5 / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi}{b + a} \cdot \frac{0.5}{b \cdot a}
\end{array}
Initial program 82.1%
lift-PI.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
remove-double-negN/A
un-div-invN/A
remove-double-negN/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
Applied rewrites99.6%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*r/N/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f6499.6
Applied rewrites99.6%
(FPCore (a b) :precision binary64 (if (<= a -1.4e-24) (* PI (/ 0.5 (* a (* b a)))) (/ (* PI 0.5) (* b (* b a)))))
double code(double a, double b) {
double tmp;
if (a <= -1.4e-24) {
tmp = ((double) M_PI) * (0.5 / (a * (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.4e-24) {
tmp = Math.PI * (0.5 / (a * (b * a)));
} else {
tmp = (Math.PI * 0.5) / (b * (b * a));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -1.4e-24: tmp = math.pi * (0.5 / (a * (b * a))) else: tmp = (math.pi * 0.5) / (b * (b * a)) return tmp
function code(a, b) tmp = 0.0 if (a <= -1.4e-24) tmp = Float64(pi * Float64(0.5 / Float64(a * Float64(b * a)))); else tmp = Float64(Float64(pi * 0.5) / Float64(b * Float64(b * a))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -1.4e-24) tmp = pi * (0.5 / (a * (b * a))); else tmp = (pi * 0.5) / (b * (b * a)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -1.4e-24], N[(Pi * N[(0.5 / N[(a * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * 0.5), $MachinePrecision] / N[(b * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.4 \cdot 10^{-24}:\\
\;\;\;\;\pi \cdot \frac{0.5}{a \cdot \left(b \cdot a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi \cdot 0.5}{b \cdot \left(b \cdot a\right)}\\
\end{array}
\end{array}
if a < -1.4000000000000001e-24Initial program 82.7%
Taylor expanded in b around 0
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6490.6
Applied rewrites90.6%
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6490.6
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.0
Applied rewrites82.0%
associate-*r*N/A
lift-*.f64N/A
lower-*.f6490.6
Applied rewrites90.6%
if -1.4000000000000001e-24 < a Initial program 81.7%
lift-PI.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
remove-double-negN/A
un-div-invN/A
remove-double-negN/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
Applied rewrites99.6%
lift-PI.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*r/N/A
associate-*r/N/A
Applied rewrites99.7%
Taylor expanded in b around inf
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6466.8
Applied rewrites66.8%
lift-PI.f64N/A
*-commutativeN/A
lift-*.f64N/A
remove-double-negN/A
distribute-frac-negN/A
distribute-frac-neg2N/A
lift-*.f64N/A
associate-/l/N/A
distribute-rgt-neg-inN/A
frac-2negN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6466.8
Applied rewrites66.8%
Final simplification74.7%
(FPCore (a b) :precision binary64 (if (<= a -1.4e-24) (* PI (/ 0.5 (* a (* b a)))) (* PI (/ 0.5 (* b (* b a))))))
double code(double a, double b) {
double tmp;
if (a <= -1.4e-24) {
tmp = ((double) M_PI) * (0.5 / (a * (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.4e-24) {
tmp = Math.PI * (0.5 / (a * (b * a)));
} else {
tmp = Math.PI * (0.5 / (b * (b * a)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -1.4e-24: tmp = math.pi * (0.5 / (a * (b * a))) else: tmp = math.pi * (0.5 / (b * (b * a))) return tmp
function code(a, b) tmp = 0.0 if (a <= -1.4e-24) tmp = Float64(pi * Float64(0.5 / Float64(a * Float64(b * a)))); else tmp = Float64(pi * Float64(0.5 / Float64(b * Float64(b * a)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -1.4e-24) tmp = pi * (0.5 / (a * (b * a))); else tmp = pi * (0.5 / (b * (b * a))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -1.4e-24], N[(Pi * N[(0.5 / N[(a * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(Pi * N[(0.5 / N[(b * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.4 \cdot 10^{-24}:\\
\;\;\;\;\pi \cdot \frac{0.5}{a \cdot \left(b \cdot a\right)}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \frac{0.5}{b \cdot \left(b \cdot a\right)}\\
\end{array}
\end{array}
if a < -1.4000000000000001e-24Initial program 82.7%
Taylor expanded in b around 0
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6490.6
Applied rewrites90.6%
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6490.6
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.0
Applied rewrites82.0%
associate-*r*N/A
lift-*.f64N/A
lower-*.f6490.6
Applied rewrites90.6%
if -1.4000000000000001e-24 < a Initial program 81.7%
lift-PI.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
remove-double-negN/A
un-div-invN/A
remove-double-negN/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
Applied rewrites99.6%
lift-PI.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*r/N/A
associate-*r/N/A
Applied rewrites99.7%
Taylor expanded in b around inf
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6466.8
Applied rewrites66.8%
lift-PI.f64N/A
*-commutativeN/A
lift-*.f64N/A
remove-double-negN/A
distribute-frac-negN/A
distribute-frac-neg2N/A
lift-*.f64N/A
associate-/l/N/A
distribute-rgt-neg-inN/A
frac-2negN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6466.8
Applied rewrites66.8%
Final simplification74.7%
(FPCore (a b) :precision binary64 (if (<= a -1.4e-24) (* PI (/ 0.5 (* b (* a a)))) (* PI (/ 0.5 (* b (* b a))))))
double code(double a, double b) {
double tmp;
if (a <= -1.4e-24) {
tmp = ((double) M_PI) * (0.5 / (b * (a * 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.4e-24) {
tmp = Math.PI * (0.5 / (b * (a * a)));
} else {
tmp = Math.PI * (0.5 / (b * (b * a)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -1.4e-24: tmp = math.pi * (0.5 / (b * (a * a))) else: tmp = math.pi * (0.5 / (b * (b * a))) return tmp
function code(a, b) tmp = 0.0 if (a <= -1.4e-24) tmp = Float64(pi * Float64(0.5 / Float64(b * Float64(a * a)))); else tmp = Float64(pi * Float64(0.5 / Float64(b * Float64(b * a)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -1.4e-24) tmp = pi * (0.5 / (b * (a * a))); else tmp = pi * (0.5 / (b * (b * a))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -1.4e-24], N[(Pi * N[(0.5 / N[(b * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(Pi * N[(0.5 / N[(b * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.4 \cdot 10^{-24}:\\
\;\;\;\;\pi \cdot \frac{0.5}{b \cdot \left(a \cdot a\right)}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \frac{0.5}{b \cdot \left(b \cdot a\right)}\\
\end{array}
\end{array}
if a < -1.4000000000000001e-24Initial program 82.7%
Taylor expanded in b around 0
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6490.6
Applied rewrites90.6%
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6490.6
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.0
Applied rewrites82.0%
if -1.4000000000000001e-24 < a Initial program 81.7%
lift-PI.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
remove-double-negN/A
un-div-invN/A
remove-double-negN/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
Applied rewrites99.6%
lift-PI.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*r/N/A
associate-*r/N/A
Applied rewrites99.7%
Taylor expanded in b around inf
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6466.8
Applied rewrites66.8%
lift-PI.f64N/A
*-commutativeN/A
lift-*.f64N/A
remove-double-negN/A
distribute-frac-negN/A
distribute-frac-neg2N/A
lift-*.f64N/A
associate-/l/N/A
distribute-rgt-neg-inN/A
frac-2negN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6466.8
Applied rewrites66.8%
(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 82.1%
lift-PI.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
remove-double-negN/A
un-div-invN/A
remove-double-negN/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
Applied rewrites99.6%
lift-PI.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*r/N/A
associate-*r/N/A
Applied rewrites99.7%
lift-PI.f64N/A
lift-+.f64N/A
frac-2negN/A
frac-2negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
(FPCore (a b) :precision binary64 (* PI (/ 0.5 (* b (* a a)))))
double code(double a, double b) {
return ((double) M_PI) * (0.5 / (b * (a * a)));
}
public static double code(double a, double b) {
return Math.PI * (0.5 / (b * (a * a)));
}
def code(a, b): return math.pi * (0.5 / (b * (a * a)))
function code(a, b) return Float64(pi * Float64(0.5 / Float64(b * Float64(a * a)))) end
function tmp = code(a, b) tmp = pi * (0.5 / (b * (a * a))); end
code[a_, b_] := N[(Pi * N[(0.5 / N[(b * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \frac{0.5}{b \cdot \left(a \cdot a\right)}
\end{array}
Initial program 82.1%
Taylor expanded in b around 0
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6468.7
Applied rewrites68.7%
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6468.7
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.6
Applied rewrites62.6%
herbie shell --seed 2024219
(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))))