
(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 (if (<= b 1.65e+70) (* (/ (* PI 1.0) (* 2.0 (* (+ b a) (- b a)))) (- (/ 1.0 a) (/ 1.0 b))) (/ (/ PI b) (* a (+ b b)))))
double code(double a, double b) {
double tmp;
if (b <= 1.65e+70) {
tmp = ((((double) M_PI) * 1.0) / (2.0 * ((b + a) * (b - a)))) * ((1.0 / a) - (1.0 / b));
} else {
tmp = (((double) M_PI) / b) / (a * (b + b));
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (b <= 1.65e+70) {
tmp = ((Math.PI * 1.0) / (2.0 * ((b + a) * (b - a)))) * ((1.0 / a) - (1.0 / b));
} else {
tmp = (Math.PI / b) / (a * (b + b));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 1.65e+70: tmp = ((math.pi * 1.0) / (2.0 * ((b + a) * (b - a)))) * ((1.0 / a) - (1.0 / b)) else: tmp = (math.pi / b) / (a * (b + b)) return tmp
function code(a, b) tmp = 0.0 if (b <= 1.65e+70) tmp = Float64(Float64(Float64(pi * 1.0) / Float64(2.0 * Float64(Float64(b + a) * Float64(b - a)))) * Float64(Float64(1.0 / a) - Float64(1.0 / b))); else tmp = Float64(Float64(pi / b) / Float64(a * Float64(b + b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 1.65e+70) tmp = ((pi * 1.0) / (2.0 * ((b + a) * (b - a)))) * ((1.0 / a) - (1.0 / b)); else tmp = (pi / b) / (a * (b + b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 1.65e+70], N[(N[(N[(Pi * 1.0), $MachinePrecision] / N[(2.0 * N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / a), $MachinePrecision] - N[(1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi / b), $MachinePrecision] / N[(a * N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.65 \cdot 10^{+70}:\\
\;\;\;\;\frac{\pi \cdot 1}{2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\frac{1}{a} - \frac{1}{b}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\pi}{b}}{a \cdot \left(b + b\right)}\\
\end{array}
\end{array}
if b < 1.65000000000000008e70Initial program 80.3%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6488.2
Applied rewrites88.2%
if 1.65000000000000008e70 < b Initial program 69.8%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6485.9
Applied rewrites85.9%
Applied rewrites85.9%
Taylor expanded in a around 0
lower-/.f64N/A
lift-PI.f6498.3
Applied rewrites98.3%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (+ b b))))
(if (<= b 2.4e+94)
(/ (* (/ PI (* (- b a) (+ a b))) (- b a)) t_0)
(/ (/ PI b) t_0))))
double code(double a, double b) {
double t_0 = a * (b + b);
double tmp;
if (b <= 2.4e+94) {
tmp = ((((double) M_PI) / ((b - a) * (a + b))) * (b - a)) / t_0;
} else {
tmp = (((double) M_PI) / b) / t_0;
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = a * (b + b);
double tmp;
if (b <= 2.4e+94) {
tmp = ((Math.PI / ((b - a) * (a + b))) * (b - a)) / t_0;
} else {
tmp = (Math.PI / b) / t_0;
}
return tmp;
}
def code(a, b): t_0 = a * (b + b) tmp = 0 if b <= 2.4e+94: tmp = ((math.pi / ((b - a) * (a + b))) * (b - a)) / t_0 else: tmp = (math.pi / b) / t_0 return tmp
function code(a, b) t_0 = Float64(a * Float64(b + b)) tmp = 0.0 if (b <= 2.4e+94) tmp = Float64(Float64(Float64(pi / Float64(Float64(b - a) * Float64(a + b))) * Float64(b - a)) / t_0); else tmp = Float64(Float64(pi / b) / t_0); end return tmp end
function tmp_2 = code(a, b) t_0 = a * (b + b); tmp = 0.0; if (b <= 2.4e+94) tmp = ((pi / ((b - a) * (a + b))) * (b - a)) / t_0; else tmp = (pi / b) / t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(b + b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 2.4e+94], N[(N[(N[(Pi / N[(N[(b - a), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(Pi / b), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(b + b\right)\\
\mathbf{if}\;b \leq 2.4 \cdot 10^{+94}:\\
\;\;\;\;\frac{\frac{\pi}{\left(b - a\right) \cdot \left(a + b\right)} \cdot \left(b - a\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\pi}{b}}{t\_0}\\
\end{array}
\end{array}
if b < 2.39999999999999983e94Initial program 80.8%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6488.5
Applied rewrites88.5%
Applied rewrites88.5%
if 2.39999999999999983e94 < b Initial program 66.2%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6484.3
Applied rewrites84.3%
Applied rewrites84.3%
Taylor expanded in a around 0
lower-/.f64N/A
lift-PI.f6499.7
Applied rewrites99.7%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* (+ b b) a)))
(if (<= a -2.35e+129)
(/ (/ (* (/ PI b) 0.5) a) a)
(if (<= a 2.5e+45)
(* (/ PI (* (* (+ a b) (- b a)) t_0)) (- b a))
(/ (/ PI a) t_0)))))
double code(double a, double b) {
double t_0 = (b + b) * a;
double tmp;
if (a <= -2.35e+129) {
tmp = (((((double) M_PI) / b) * 0.5) / a) / a;
} else if (a <= 2.5e+45) {
tmp = (((double) M_PI) / (((a + b) * (b - a)) * t_0)) * (b - a);
} else {
tmp = (((double) M_PI) / a) / t_0;
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = (b + b) * a;
double tmp;
if (a <= -2.35e+129) {
tmp = (((Math.PI / b) * 0.5) / a) / a;
} else if (a <= 2.5e+45) {
tmp = (Math.PI / (((a + b) * (b - a)) * t_0)) * (b - a);
} else {
tmp = (Math.PI / a) / t_0;
}
return tmp;
}
def code(a, b): t_0 = (b + b) * a tmp = 0 if a <= -2.35e+129: tmp = (((math.pi / b) * 0.5) / a) / a elif a <= 2.5e+45: tmp = (math.pi / (((a + b) * (b - a)) * t_0)) * (b - a) else: tmp = (math.pi / a) / t_0 return tmp
function code(a, b) t_0 = Float64(Float64(b + b) * a) tmp = 0.0 if (a <= -2.35e+129) tmp = Float64(Float64(Float64(Float64(pi / b) * 0.5) / a) / a); elseif (a <= 2.5e+45) tmp = Float64(Float64(pi / Float64(Float64(Float64(a + b) * Float64(b - a)) * t_0)) * Float64(b - a)); else tmp = Float64(Float64(pi / a) / t_0); end return tmp end
function tmp_2 = code(a, b) t_0 = (b + b) * a; tmp = 0.0; if (a <= -2.35e+129) tmp = (((pi / b) * 0.5) / a) / a; elseif (a <= 2.5e+45) tmp = (pi / (((a + b) * (b - a)) * t_0)) * (b - a); else tmp = (pi / a) / t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[(b + b), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -2.35e+129], N[(N[(N[(N[(Pi / b), $MachinePrecision] * 0.5), $MachinePrecision] / a), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[a, 2.5e+45], N[(N[(Pi / N[(N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision], N[(N[(Pi / a), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(b + b\right) \cdot a\\
\mathbf{if}\;a \leq -2.35 \cdot 10^{+129}:\\
\;\;\;\;\frac{\frac{\frac{\pi}{b} \cdot 0.5}{a}}{a}\\
\mathbf{elif}\;a \leq 2.5 \cdot 10^{+45}:\\
\;\;\;\;\frac{\pi}{\left(\left(a + b\right) \cdot \left(b - a\right)\right) \cdot t\_0} \cdot \left(b - a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\pi}{a}}{t\_0}\\
\end{array}
\end{array}
if a < -2.35000000000000004e129Initial program 58.2%
Taylor expanded in a around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
pow2N/A
lift-*.f6480.3
Applied rewrites80.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-PI.f6480.3
Applied rewrites80.3%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
if -2.35000000000000004e129 < a < 2.5e45Initial program 85.7%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6490.6
Applied rewrites90.6%
Applied rewrites84.7%
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites84.3%
if 2.5e45 < a Initial program 70.1%
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
*-commutativeN/A
frac-subN/A
associate-*l/N/A
frac-timesN/A
Applied rewrites84.5%
Taylor expanded in a around inf
lift-/.f64N/A
lift-PI.f6496.5
Applied rewrites96.5%
*-commutative96.5
difference-of-squares-rev96.5
associate-*r/96.5
*-rgt-identity96.5
difference-of-squares-rev96.5
+-commutative96.5
*-commutative96.5
*-lft-identity96.5
*-rgt-identity96.5
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
Applied rewrites96.5%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (+ b b))))
(if (<= b 1.65e+70)
(* (- b a) (/ (/ PI (* (- b a) (+ a b))) t_0))
(/ (/ PI b) t_0))))
double code(double a, double b) {
double t_0 = a * (b + b);
double tmp;
if (b <= 1.65e+70) {
tmp = (b - a) * ((((double) M_PI) / ((b - a) * (a + b))) / t_0);
} else {
tmp = (((double) M_PI) / b) / t_0;
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = a * (b + b);
double tmp;
if (b <= 1.65e+70) {
tmp = (b - a) * ((Math.PI / ((b - a) * (a + b))) / t_0);
} else {
tmp = (Math.PI / b) / t_0;
}
return tmp;
}
def code(a, b): t_0 = a * (b + b) tmp = 0 if b <= 1.65e+70: tmp = (b - a) * ((math.pi / ((b - a) * (a + b))) / t_0) else: tmp = (math.pi / b) / t_0 return tmp
function code(a, b) t_0 = Float64(a * Float64(b + b)) tmp = 0.0 if (b <= 1.65e+70) tmp = Float64(Float64(b - a) * Float64(Float64(pi / Float64(Float64(b - a) * Float64(a + b))) / t_0)); else tmp = Float64(Float64(pi / b) / t_0); end return tmp end
function tmp_2 = code(a, b) t_0 = a * (b + b); tmp = 0.0; if (b <= 1.65e+70) tmp = (b - a) * ((pi / ((b - a) * (a + b))) / t_0); else tmp = (pi / b) / t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(b + b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.65e+70], N[(N[(b - a), $MachinePrecision] * N[(N[(Pi / N[(N[(b - a), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(Pi / b), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(b + b\right)\\
\mathbf{if}\;b \leq 1.65 \cdot 10^{+70}:\\
\;\;\;\;\left(b - a\right) \cdot \frac{\frac{\pi}{\left(b - a\right) \cdot \left(a + b\right)}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\pi}{b}}{t\_0}\\
\end{array}
\end{array}
if b < 1.65000000000000008e70Initial program 80.3%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6488.2
Applied rewrites88.2%
Applied rewrites82.8%
if 1.65000000000000008e70 < b Initial program 69.8%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6485.9
Applied rewrites85.9%
Applied rewrites85.9%
Taylor expanded in a around 0
lower-/.f64N/A
lift-PI.f6498.3
Applied rewrites98.3%
(FPCore (a b) :precision binary64 (if (<= b -5.7e-18) (* (/ PI (* b (* a b))) 0.5) (if (<= b 0.6) (/ (/ PI a) (* (+ b b) a)) (/ (/ PI b) (* a (+ b b))))))
double code(double a, double b) {
double tmp;
if (b <= -5.7e-18) {
tmp = (((double) M_PI) / (b * (a * b))) * 0.5;
} else if (b <= 0.6) {
tmp = (((double) M_PI) / a) / ((b + b) * a);
} else {
tmp = (((double) M_PI) / b) / (a * (b + b));
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (b <= -5.7e-18) {
tmp = (Math.PI / (b * (a * b))) * 0.5;
} else if (b <= 0.6) {
tmp = (Math.PI / a) / ((b + b) * a);
} else {
tmp = (Math.PI / b) / (a * (b + b));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= -5.7e-18: tmp = (math.pi / (b * (a * b))) * 0.5 elif b <= 0.6: tmp = (math.pi / a) / ((b + b) * a) else: tmp = (math.pi / b) / (a * (b + b)) return tmp
function code(a, b) tmp = 0.0 if (b <= -5.7e-18) tmp = Float64(Float64(pi / Float64(b * Float64(a * b))) * 0.5); elseif (b <= 0.6) tmp = Float64(Float64(pi / a) / Float64(Float64(b + b) * a)); else tmp = Float64(Float64(pi / b) / Float64(a * Float64(b + b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= -5.7e-18) tmp = (pi / (b * (a * b))) * 0.5; elseif (b <= 0.6) tmp = (pi / a) / ((b + b) * a); else tmp = (pi / b) / (a * (b + b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, -5.7e-18], N[(N[(Pi / N[(b * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[b, 0.6], N[(N[(Pi / a), $MachinePrecision] / N[(N[(b + b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(Pi / b), $MachinePrecision] / N[(a * N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.7 \cdot 10^{-18}:\\
\;\;\;\;\frac{\pi}{b \cdot \left(a \cdot b\right)} \cdot 0.5\\
\mathbf{elif}\;b \leq 0.6:\\
\;\;\;\;\frac{\frac{\pi}{a}}{\left(b + b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\pi}{b}}{a \cdot \left(b + b\right)}\\
\end{array}
\end{array}
if b < -5.69999999999999971e-18Initial program 75.9%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6488.0
Applied rewrites88.0%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6478.3
Applied rewrites78.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6489.2
Applied rewrites89.2%
if -5.69999999999999971e-18 < b < 0.599999999999999978Initial program 80.4%
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
*-commutativeN/A
frac-subN/A
associate-*l/N/A
frac-timesN/A
Applied rewrites86.9%
Taylor expanded in a around inf
lift-/.f64N/A
lift-PI.f6484.0
Applied rewrites84.0%
*-commutative84.0
difference-of-squares-rev84.0
associate-*r/84.0
*-rgt-identity84.0
difference-of-squares-rev84.0
+-commutative84.0
*-commutative84.0
*-lft-identity84.0
*-rgt-identity84.0
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
Applied rewrites84.0%
if 0.599999999999999978 < b Initial program 76.8%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6489.1
Applied rewrites89.1%
Applied rewrites89.1%
Taylor expanded in a around 0
lower-/.f64N/A
lift-PI.f6491.2
Applied rewrites91.2%
(FPCore (a b) :precision binary64 (let* ((t_0 (* (/ PI (* b (* a b))) 0.5))) (if (<= b -5.7e-18) t_0 (if (<= b 0.6) (/ (/ PI a) (* (+ b b) a)) t_0))))
double code(double a, double b) {
double t_0 = (((double) M_PI) / (b * (a * b))) * 0.5;
double tmp;
if (b <= -5.7e-18) {
tmp = t_0;
} else if (b <= 0.6) {
tmp = (((double) M_PI) / a) / ((b + b) * a);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = (Math.PI / (b * (a * b))) * 0.5;
double tmp;
if (b <= -5.7e-18) {
tmp = t_0;
} else if (b <= 0.6) {
tmp = (Math.PI / a) / ((b + b) * a);
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = (math.pi / (b * (a * b))) * 0.5 tmp = 0 if b <= -5.7e-18: tmp = t_0 elif b <= 0.6: tmp = (math.pi / a) / ((b + b) * a) else: tmp = t_0 return tmp
function code(a, b) t_0 = Float64(Float64(pi / Float64(b * Float64(a * b))) * 0.5) tmp = 0.0 if (b <= -5.7e-18) tmp = t_0; elseif (b <= 0.6) tmp = Float64(Float64(pi / a) / Float64(Float64(b + b) * a)); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b) t_0 = (pi / (b * (a * b))) * 0.5; tmp = 0.0; if (b <= -5.7e-18) tmp = t_0; elseif (b <= 0.6) tmp = (pi / a) / ((b + b) * a); else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[(Pi / N[(b * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[b, -5.7e-18], t$95$0, If[LessEqual[b, 0.6], N[(N[(Pi / a), $MachinePrecision] / N[(N[(b + b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\pi}{b \cdot \left(a \cdot b\right)} \cdot 0.5\\
\mathbf{if}\;b \leq -5.7 \cdot 10^{-18}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 0.6:\\
\;\;\;\;\frac{\frac{\pi}{a}}{\left(b + b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -5.69999999999999971e-18 or 0.599999999999999978 < b Initial program 76.4%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6488.6
Applied rewrites88.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6479.5
Applied rewrites79.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6490.0
Applied rewrites90.0%
if -5.69999999999999971e-18 < b < 0.599999999999999978Initial program 80.4%
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
*-commutativeN/A
frac-subN/A
associate-*l/N/A
frac-timesN/A
Applied rewrites86.9%
Taylor expanded in a around inf
lift-/.f64N/A
lift-PI.f6484.0
Applied rewrites84.0%
*-commutative84.0
difference-of-squares-rev84.0
associate-*r/84.0
*-rgt-identity84.0
difference-of-squares-rev84.0
+-commutative84.0
*-commutative84.0
*-lft-identity84.0
*-rgt-identity84.0
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
*-rgt-identityN/A
Applied rewrites84.0%
(FPCore (a b) :precision binary64 (let* ((t_0 (* (/ PI (* b (* a b))) 0.5))) (if (<= b -5.7e-18) t_0 (if (<= b 0.6) (* (/ PI (* a (* a b))) 0.5) t_0))))
double code(double a, double b) {
double t_0 = (((double) M_PI) / (b * (a * b))) * 0.5;
double tmp;
if (b <= -5.7e-18) {
tmp = t_0;
} else if (b <= 0.6) {
tmp = (((double) M_PI) / (a * (a * b))) * 0.5;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = (Math.PI / (b * (a * b))) * 0.5;
double tmp;
if (b <= -5.7e-18) {
tmp = t_0;
} else if (b <= 0.6) {
tmp = (Math.PI / (a * (a * b))) * 0.5;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = (math.pi / (b * (a * b))) * 0.5 tmp = 0 if b <= -5.7e-18: tmp = t_0 elif b <= 0.6: tmp = (math.pi / (a * (a * b))) * 0.5 else: tmp = t_0 return tmp
function code(a, b) t_0 = Float64(Float64(pi / Float64(b * Float64(a * b))) * 0.5) tmp = 0.0 if (b <= -5.7e-18) tmp = t_0; elseif (b <= 0.6) tmp = Float64(Float64(pi / Float64(a * Float64(a * b))) * 0.5); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b) t_0 = (pi / (b * (a * b))) * 0.5; tmp = 0.0; if (b <= -5.7e-18) tmp = t_0; elseif (b <= 0.6) tmp = (pi / (a * (a * b))) * 0.5; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[(Pi / N[(b * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[b, -5.7e-18], t$95$0, If[LessEqual[b, 0.6], N[(N[(Pi / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\pi}{b \cdot \left(a \cdot b\right)} \cdot 0.5\\
\mathbf{if}\;b \leq -5.7 \cdot 10^{-18}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 0.6:\\
\;\;\;\;\frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -5.69999999999999971e-18 or 0.599999999999999978 < b Initial program 76.4%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6488.6
Applied rewrites88.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6479.5
Applied rewrites79.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6490.0
Applied rewrites90.0%
if -5.69999999999999971e-18 < b < 0.599999999999999978Initial program 80.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6471.3
Applied rewrites71.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f6483.7
Applied rewrites83.7%
(FPCore (a b) :precision binary64 (let* ((t_0 (* (/ PI (* (* b b) a)) 0.5))) (if (<= b -5.7e-18) t_0 (if (<= b 0.6) (* (/ PI (* a (* a b))) 0.5) t_0))))
double code(double a, double b) {
double t_0 = (((double) M_PI) / ((b * b) * a)) * 0.5;
double tmp;
if (b <= -5.7e-18) {
tmp = t_0;
} else if (b <= 0.6) {
tmp = (((double) M_PI) / (a * (a * b))) * 0.5;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = (Math.PI / ((b * b) * a)) * 0.5;
double tmp;
if (b <= -5.7e-18) {
tmp = t_0;
} else if (b <= 0.6) {
tmp = (Math.PI / (a * (a * b))) * 0.5;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = (math.pi / ((b * b) * a)) * 0.5 tmp = 0 if b <= -5.7e-18: tmp = t_0 elif b <= 0.6: tmp = (math.pi / (a * (a * b))) * 0.5 else: tmp = t_0 return tmp
function code(a, b) t_0 = Float64(Float64(pi / Float64(Float64(b * b) * a)) * 0.5) tmp = 0.0 if (b <= -5.7e-18) tmp = t_0; elseif (b <= 0.6) tmp = Float64(Float64(pi / Float64(a * Float64(a * b))) * 0.5); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b) t_0 = (pi / ((b * b) * a)) * 0.5; tmp = 0.0; if (b <= -5.7e-18) tmp = t_0; elseif (b <= 0.6) tmp = (pi / (a * (a * b))) * 0.5; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[(Pi / N[(N[(b * b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[b, -5.7e-18], t$95$0, If[LessEqual[b, 0.6], N[(N[(Pi / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\pi}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
\mathbf{if}\;b \leq -5.7 \cdot 10^{-18}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 0.6:\\
\;\;\;\;\frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -5.69999999999999971e-18 or 0.599999999999999978 < b Initial program 76.4%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6479.5
Applied rewrites79.5%
if -5.69999999999999971e-18 < b < 0.599999999999999978Initial program 80.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6471.3
Applied rewrites71.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f6483.7
Applied rewrites83.7%
(FPCore (a b) :precision binary64 (* (/ PI (* a (* a b))) 0.5))
double code(double a, double b) {
return (((double) M_PI) / (a * (a * b))) * 0.5;
}
public static double code(double a, double b) {
return (Math.PI / (a * (a * b))) * 0.5;
}
def code(a, b): return (math.pi / (a * (a * b))) * 0.5
function code(a, b) return Float64(Float64(pi / Float64(a * Float64(a * b))) * 0.5) end
function tmp = code(a, b) tmp = (pi / (a * (a * b))) * 0.5; end
code[a_, b_] := N[(N[(Pi / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot 0.5
\end{array}
Initial program 78.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6456.7
Applied rewrites56.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f6462.7
Applied rewrites62.7%
herbie shell --seed 2025101
(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))))