
(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}
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 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.5%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites87.9%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6499.6
Applied rewrites99.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
difference-of-squaresN/A
associate-/r/N/A
lift--.f64N/A
flip-+N/A
lift-+.f64N/A
lower-/.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
(FPCore (a b) :precision binary64 (/ (* (/ 0.5 (+ b a)) PI) (* a b)))
double code(double a, double b) {
return ((0.5 / (b + a)) * ((double) M_PI)) / (a * b);
}
public static double code(double a, double b) {
return ((0.5 / (b + a)) * Math.PI) / (a * b);
}
def code(a, b): return ((0.5 / (b + a)) * math.pi) / (a * b)
function code(a, b) return Float64(Float64(Float64(0.5 / Float64(b + a)) * pi) / Float64(a * b)) end
function tmp = code(a, b) tmp = ((0.5 / (b + a)) * pi) / (a * b); end
code[a_, b_] := N[(N[(N[(0.5 / N[(b + a), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5}{b + a} \cdot \pi}{a \cdot b}
\end{array}
Initial program 78.5%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites87.9%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6499.6
Applied rewrites99.6%
Taylor expanded in a around 0
lower-PI.f6499.6
Applied rewrites99.6%
(FPCore (a b) :precision binary64 (if (<= a -2e+147) (* (/ 0.5 a) (/ PI (* b a))) (/ (* 0.5 PI) (* (* (+ b a) a) b))))
double code(double a, double b) {
double tmp;
if (a <= -2e+147) {
tmp = (0.5 / a) * (((double) M_PI) / (b * a));
} else {
tmp = (0.5 * ((double) M_PI)) / (((b + a) * a) * b);
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -2e+147) {
tmp = (0.5 / a) * (Math.PI / (b * a));
} else {
tmp = (0.5 * Math.PI) / (((b + a) * a) * b);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2e+147: tmp = (0.5 / a) * (math.pi / (b * a)) else: tmp = (0.5 * math.pi) / (((b + a) * a) * b) return tmp
function code(a, b) tmp = 0.0 if (a <= -2e+147) tmp = Float64(Float64(0.5 / a) * Float64(pi / Float64(b * a))); else tmp = Float64(Float64(0.5 * pi) / Float64(Float64(Float64(b + a) * a) * b)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2e+147) tmp = (0.5 / a) * (pi / (b * a)); else tmp = (0.5 * pi) / (((b + a) * a) * b); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2e+147], N[(N[(0.5 / a), $MachinePrecision] * N[(Pi / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * Pi), $MachinePrecision] / N[(N[(N[(b + a), $MachinePrecision] * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{+147}:\\
\;\;\;\;\frac{0.5}{a} \cdot \frac{\pi}{b \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \pi}{\left(\left(b + a\right) \cdot a\right) \cdot b}\\
\end{array}
\end{array}
if a < -2e147Initial program 78.5%
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-/r*N/A
*-lft-identityN/A
/-rgt-identityN/A
mult-flipN/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
div-flipN/A
associate-/r/N/A
lower-*.f64N/A
metadata-evalN/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-pow.f6457.6
Applied rewrites57.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6457.6
lift-pow.f64N/A
pow2N/A
lower-*.f6457.6
Applied rewrites57.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6463.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.3
Applied rewrites63.3%
if -2e147 < a Initial program 78.5%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites87.9%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6499.6
Applied rewrites99.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
difference-of-squaresN/A
associate-/r/N/A
lift--.f64N/A
flip-+N/A
lift-+.f64N/A
lower-/.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6493.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6493.4
Applied rewrites93.4%
(FPCore (a b) :precision binary64 (if (<= a -7.5e+75) (* (/ 0.5 a) (/ PI (* b a))) (* PI (/ 0.5 (* (* (+ b a) a) b)))))
double code(double a, double b) {
double tmp;
if (a <= -7.5e+75) {
tmp = (0.5 / a) * (((double) M_PI) / (b * a));
} else {
tmp = ((double) M_PI) * (0.5 / (((b + a) * a) * b));
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -7.5e+75) {
tmp = (0.5 / a) * (Math.PI / (b * a));
} else {
tmp = Math.PI * (0.5 / (((b + a) * a) * b));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -7.5e+75: tmp = (0.5 / a) * (math.pi / (b * a)) else: tmp = math.pi * (0.5 / (((b + a) * a) * b)) return tmp
function code(a, b) tmp = 0.0 if (a <= -7.5e+75) tmp = Float64(Float64(0.5 / a) * Float64(pi / Float64(b * a))); else tmp = Float64(pi * Float64(0.5 / Float64(Float64(Float64(b + a) * a) * b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -7.5e+75) tmp = (0.5 / a) * (pi / (b * a)); else tmp = pi * (0.5 / (((b + a) * a) * b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -7.5e+75], N[(N[(0.5 / a), $MachinePrecision] * N[(Pi / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(Pi * N[(0.5 / N[(N[(N[(b + a), $MachinePrecision] * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.5 \cdot 10^{+75}:\\
\;\;\;\;\frac{0.5}{a} \cdot \frac{\pi}{b \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \frac{0.5}{\left(\left(b + a\right) \cdot a\right) \cdot b}\\
\end{array}
\end{array}
if a < -7.4999999999999995e75Initial program 78.5%
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-/r*N/A
*-lft-identityN/A
/-rgt-identityN/A
mult-flipN/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
div-flipN/A
associate-/r/N/A
lower-*.f64N/A
metadata-evalN/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-pow.f6457.6
Applied rewrites57.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6457.6
lift-pow.f64N/A
pow2N/A
lower-*.f6457.6
Applied rewrites57.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6463.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.3
Applied rewrites63.3%
if -7.4999999999999995e75 < a Initial program 78.5%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites87.9%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6499.6
Applied rewrites99.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
difference-of-squaresN/A
associate-/r/N/A
lift--.f64N/A
flip-+N/A
lift-+.f64N/A
lower-/.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6493.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6493.4
Applied rewrites93.4%
(FPCore (a b) :precision binary64 (if (<= b 9.5e-52) (* (/ 0.5 a) (/ PI (* b a))) (* 0.5 (/ (/ (/ PI a) b) b))))
double code(double a, double b) {
double tmp;
if (b <= 9.5e-52) {
tmp = (0.5 / a) * (((double) M_PI) / (b * a));
} else {
tmp = 0.5 * (((((double) M_PI) / a) / b) / b);
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (b <= 9.5e-52) {
tmp = (0.5 / a) * (Math.PI / (b * a));
} else {
tmp = 0.5 * (((Math.PI / a) / b) / b);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 9.5e-52: tmp = (0.5 / a) * (math.pi / (b * a)) else: tmp = 0.5 * (((math.pi / a) / b) / b) return tmp
function code(a, b) tmp = 0.0 if (b <= 9.5e-52) tmp = Float64(Float64(0.5 / a) * Float64(pi / Float64(b * a))); else tmp = Float64(0.5 * Float64(Float64(Float64(pi / a) / b) / b)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 9.5e-52) tmp = (0.5 / a) * (pi / (b * a)); else tmp = 0.5 * (((pi / a) / b) / b); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 9.5e-52], N[(N[(0.5 / a), $MachinePrecision] * N[(Pi / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(N[(Pi / a), $MachinePrecision] / b), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9.5 \cdot 10^{-52}:\\
\;\;\;\;\frac{0.5}{a} \cdot \frac{\pi}{b \cdot a}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\frac{\frac{\pi}{a}}{b}}{b}\\
\end{array}
\end{array}
if b < 9.50000000000000007e-52Initial program 78.5%
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-/r*N/A
*-lft-identityN/A
/-rgt-identityN/A
mult-flipN/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
div-flipN/A
associate-/r/N/A
lower-*.f64N/A
metadata-evalN/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-pow.f6457.6
Applied rewrites57.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6457.6
lift-pow.f64N/A
pow2N/A
lower-*.f6457.6
Applied rewrites57.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6463.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.3
Applied rewrites63.3%
if 9.50000000000000007e-52 < b Initial program 78.5%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-pow.f6457.4
Applied rewrites57.4%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f6463.2
Applied rewrites63.2%
(FPCore (a b) :precision binary64 (if (<= b 9.5e-52) (* (/ 0.5 a) (/ PI (* b a))) (* (/ PI b) (/ 0.5 (* a b)))))
double code(double a, double b) {
double tmp;
if (b <= 9.5e-52) {
tmp = (0.5 / a) * (((double) M_PI) / (b * a));
} else {
tmp = (((double) M_PI) / b) * (0.5 / (a * b));
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (b <= 9.5e-52) {
tmp = (0.5 / a) * (Math.PI / (b * a));
} else {
tmp = (Math.PI / b) * (0.5 / (a * b));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 9.5e-52: tmp = (0.5 / a) * (math.pi / (b * a)) else: tmp = (math.pi / b) * (0.5 / (a * b)) return tmp
function code(a, b) tmp = 0.0 if (b <= 9.5e-52) tmp = Float64(Float64(0.5 / a) * Float64(pi / Float64(b * a))); else tmp = Float64(Float64(pi / b) * Float64(0.5 / Float64(a * b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 9.5e-52) tmp = (0.5 / a) * (pi / (b * a)); else tmp = (pi / b) * (0.5 / (a * b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 9.5e-52], N[(N[(0.5 / a), $MachinePrecision] * N[(Pi / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi / b), $MachinePrecision] * N[(0.5 / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9.5 \cdot 10^{-52}:\\
\;\;\;\;\frac{0.5}{a} \cdot \frac{\pi}{b \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi}{b} \cdot \frac{0.5}{a \cdot b}\\
\end{array}
\end{array}
if b < 9.50000000000000007e-52Initial program 78.5%
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-/r*N/A
*-lft-identityN/A
/-rgt-identityN/A
mult-flipN/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
div-flipN/A
associate-/r/N/A
lower-*.f64N/A
metadata-evalN/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-pow.f6457.6
Applied rewrites57.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6457.6
lift-pow.f64N/A
pow2N/A
lower-*.f6457.6
Applied rewrites57.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6463.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.3
Applied rewrites63.3%
if 9.50000000000000007e-52 < b Initial program 78.5%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-pow.f6457.4
Applied rewrites57.4%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
associate-*r*N/A
lift-*.f64N/A
lower-*.f6463.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.0
Applied rewrites63.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6463.2
Applied rewrites63.2%
(FPCore (a b) :precision binary64 (if (<= b 9e-52) (* 0.5 (/ PI (* (* a b) a))) (* (/ PI b) (/ 0.5 (* a b)))))
double code(double a, double b) {
double tmp;
if (b <= 9e-52) {
tmp = 0.5 * (((double) M_PI) / ((a * b) * a));
} else {
tmp = (((double) M_PI) / b) * (0.5 / (a * b));
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (b <= 9e-52) {
tmp = 0.5 * (Math.PI / ((a * b) * a));
} else {
tmp = (Math.PI / b) * (0.5 / (a * b));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 9e-52: tmp = 0.5 * (math.pi / ((a * b) * a)) else: tmp = (math.pi / b) * (0.5 / (a * b)) return tmp
function code(a, b) tmp = 0.0 if (b <= 9e-52) tmp = Float64(0.5 * Float64(pi / Float64(Float64(a * b) * a))); else tmp = Float64(Float64(pi / b) * Float64(0.5 / Float64(a * b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 9e-52) tmp = 0.5 * (pi / ((a * b) * a)); else tmp = (pi / b) * (0.5 / (a * b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 9e-52], N[(0.5 * N[(Pi / N[(N[(a * b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi / b), $MachinePrecision] * N[(0.5 / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9 \cdot 10^{-52}:\\
\;\;\;\;0.5 \cdot \frac{\pi}{\left(a \cdot b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi}{b} \cdot \frac{0.5}{a \cdot b}\\
\end{array}
\end{array}
if b < 9.0000000000000001e-52Initial program 78.5%
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-/r*N/A
*-lft-identityN/A
/-rgt-identityN/A
mult-flipN/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
div-flipN/A
associate-/r/N/A
lower-*.f64N/A
metadata-evalN/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-pow.f6457.6
Applied rewrites57.6%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6463.2
Applied rewrites63.2%
if 9.0000000000000001e-52 < b Initial program 78.5%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-pow.f6457.4
Applied rewrites57.4%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
associate-*r*N/A
lift-*.f64N/A
lower-*.f6463.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.0
Applied rewrites63.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6463.2
Applied rewrites63.2%
(FPCore (a b) :precision binary64 (if (<= b 9e-52) (* 0.5 (/ PI (* (* a b) a))) (* 0.5 (/ PI (* (* b a) b)))))
double code(double a, double b) {
double tmp;
if (b <= 9e-52) {
tmp = 0.5 * (((double) M_PI) / ((a * b) * a));
} else {
tmp = 0.5 * (((double) M_PI) / ((b * a) * b));
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (b <= 9e-52) {
tmp = 0.5 * (Math.PI / ((a * b) * a));
} else {
tmp = 0.5 * (Math.PI / ((b * a) * b));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 9e-52: tmp = 0.5 * (math.pi / ((a * b) * a)) else: tmp = 0.5 * (math.pi / ((b * a) * b)) return tmp
function code(a, b) tmp = 0.0 if (b <= 9e-52) tmp = Float64(0.5 * Float64(pi / Float64(Float64(a * b) * a))); else tmp = Float64(0.5 * Float64(pi / Float64(Float64(b * a) * b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 9e-52) tmp = 0.5 * (pi / ((a * b) * a)); else tmp = 0.5 * (pi / ((b * a) * b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 9e-52], N[(0.5 * N[(Pi / N[(N[(a * b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(Pi / N[(N[(b * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9 \cdot 10^{-52}:\\
\;\;\;\;0.5 \cdot \frac{\pi}{\left(a \cdot b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\pi}{\left(b \cdot a\right) \cdot b}\\
\end{array}
\end{array}
if b < 9.0000000000000001e-52Initial program 78.5%
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-/r*N/A
*-lft-identityN/A
/-rgt-identityN/A
mult-flipN/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
div-flipN/A
associate-/r/N/A
lower-*.f64N/A
metadata-evalN/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-pow.f6457.6
Applied rewrites57.6%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6463.2
Applied rewrites63.2%
if 9.0000000000000001e-52 < b Initial program 78.5%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-pow.f6457.4
Applied rewrites57.4%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
associate-*r*N/A
lift-*.f64N/A
lower-*.f6463.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.0
Applied rewrites63.0%
(FPCore (a b) :precision binary64 (* 0.5 (/ PI (* (* b a) b))))
double code(double a, double b) {
return 0.5 * (((double) M_PI) / ((b * a) * b));
}
public static double code(double a, double b) {
return 0.5 * (Math.PI / ((b * a) * b));
}
def code(a, b): return 0.5 * (math.pi / ((b * a) * b))
function code(a, b) return Float64(0.5 * Float64(pi / Float64(Float64(b * a) * b))) end
function tmp = code(a, b) tmp = 0.5 * (pi / ((b * a) * b)); end
code[a_, b_] := N[(0.5 * N[(Pi / N[(N[(b * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \frac{\pi}{\left(b \cdot a\right) \cdot b}
\end{array}
Initial program 78.5%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-pow.f6457.4
Applied rewrites57.4%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
associate-*r*N/A
lift-*.f64N/A
lower-*.f6463.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.0
Applied rewrites63.0%
herbie shell --seed 2025149
(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))))