
(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 14 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}
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= b 1.2e+96) (/ (* 0.5 (/ PI a)) (* b (+ b a))) (* (* 0.5 (/ PI (* b a))) (/ 1.0 b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (b <= 1.2e+96) {
tmp = (0.5 * (((double) M_PI) / a)) / (b * (b + a));
} else {
tmp = (0.5 * (((double) M_PI) / (b * a))) * (1.0 / b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (b <= 1.2e+96) {
tmp = (0.5 * (Math.PI / a)) / (b * (b + a));
} else {
tmp = (0.5 * (Math.PI / (b * a))) * (1.0 / b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if b <= 1.2e+96: tmp = (0.5 * (math.pi / a)) / (b * (b + a)) else: tmp = (0.5 * (math.pi / (b * a))) * (1.0 / b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (b <= 1.2e+96) tmp = Float64(Float64(0.5 * Float64(pi / a)) / Float64(b * Float64(b + a))); else tmp = Float64(Float64(0.5 * Float64(pi / Float64(b * a))) * Float64(1.0 / b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (b <= 1.2e+96)
tmp = (0.5 * (pi / a)) / (b * (b + a));
else
tmp = (0.5 * (pi / (b * a))) * (1.0 / b);
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[b, 1.2e+96], N[(N[(0.5 * N[(Pi / a), $MachinePrecision]), $MachinePrecision] / N[(b * N[(b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(Pi / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.2 \cdot 10^{+96}:\\
\;\;\;\;\frac{0.5 \cdot \frac{\pi}{a}}{b \cdot \left(b + a\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \frac{\pi}{b \cdot a}\right) \cdot \frac{1}{b}\\
\end{array}
\end{array}
if b < 1.19999999999999996e96Initial program 79.9%
*-commutative79.9%
associate-*r*79.9%
associate-*r/80.0%
associate-*r*80.0%
*-rgt-identity80.0%
sub-neg80.0%
distribute-neg-frac80.0%
metadata-eval80.0%
Simplified80.0%
*-un-lft-identity80.0%
difference-of-squares88.1%
times-frac99.6%
add-sqr-sqrt64.5%
sqrt-unprod66.4%
frac-times66.4%
metadata-eval66.4%
metadata-eval66.4%
frac-times66.4%
sqrt-unprod16.6%
add-sqr-sqrt63.8%
div-inv63.8%
metadata-eval63.8%
Applied egg-rr63.8%
Taylor expanded in a around 0 99.7%
associate-/r*99.7%
associate-*r/99.7%
frac-times95.6%
*-un-lft-identity95.6%
+-commutative95.6%
Applied egg-rr95.6%
if 1.19999999999999996e96 < b Initial program 64.8%
*-commutative64.8%
associate-*r*64.9%
associate-*r/64.7%
associate-*r*64.7%
*-rgt-identity64.7%
sub-neg64.7%
distribute-neg-frac64.7%
metadata-eval64.7%
Simplified64.7%
*-un-lft-identity64.7%
difference-of-squares79.9%
times-frac99.7%
add-sqr-sqrt0.0%
sqrt-unprod99.7%
frac-times99.7%
metadata-eval99.7%
metadata-eval99.7%
frac-times99.7%
sqrt-unprod99.7%
add-sqr-sqrt99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in a around 0 99.8%
Taylor expanded in b around inf 99.8%
Final simplification96.4%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -5e+146) (/ (/ (/ (* PI -0.5) a) b) (- a)) (* (/ 0.5 b) (/ (/ PI a) (+ b a)))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -5e+146) {
tmp = (((((double) M_PI) * -0.5) / a) / b) / -a;
} else {
tmp = (0.5 / b) * ((((double) M_PI) / a) / (b + a));
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -5e+146) {
tmp = (((Math.PI * -0.5) / a) / b) / -a;
} else {
tmp = (0.5 / b) * ((Math.PI / a) / (b + a));
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -5e+146: tmp = (((math.pi * -0.5) / a) / b) / -a else: tmp = (0.5 / b) * ((math.pi / a) / (b + a)) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -5e+146) tmp = Float64(Float64(Float64(Float64(pi * -0.5) / a) / b) / Float64(-a)); else tmp = Float64(Float64(0.5 / b) * Float64(Float64(pi / a) / Float64(b + a))); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -5e+146)
tmp = (((pi * -0.5) / a) / b) / -a;
else
tmp = (0.5 / b) * ((pi / a) / (b + a));
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[a, -5e+146], N[(N[(N[(N[(Pi * -0.5), $MachinePrecision] / a), $MachinePrecision] / b), $MachinePrecision] / (-a)), $MachinePrecision], N[(N[(0.5 / b), $MachinePrecision] * N[(N[(Pi / a), $MachinePrecision] / N[(b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5 \cdot 10^{+146}:\\
\;\;\;\;\frac{\frac{\frac{\pi \cdot -0.5}{a}}{b}}{-a}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{b} \cdot \frac{\frac{\pi}{a}}{b + a}\\
\end{array}
\end{array}
if a < -4.9999999999999999e146Initial program 64.0%
*-commutative64.0%
associate-*r*64.0%
associate-*r/64.0%
associate-*r*64.0%
*-rgt-identity64.0%
sub-neg64.0%
distribute-neg-frac64.0%
metadata-eval64.0%
Simplified64.0%
*-un-lft-identity64.0%
difference-of-squares81.2%
times-frac99.8%
add-sqr-sqrt45.6%
sqrt-unprod72.1%
frac-times72.1%
metadata-eval72.1%
metadata-eval72.1%
frac-times72.1%
sqrt-unprod43.3%
add-sqr-sqrt75.3%
div-inv75.3%
metadata-eval75.3%
Applied egg-rr75.3%
Taylor expanded in a around 0 99.9%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in b around 0 99.9%
associate-*l/100.0%
*-un-lft-identity100.0%
frac-2neg100.0%
associate-*r/100.0%
distribute-neg-frac100.0%
associate-*r/100.0%
*-commutative100.0%
distribute-neg-frac100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Applied egg-rr100.0%
if -4.9999999999999999e146 < a Initial program 79.3%
*-commutative79.3%
associate-*r*79.3%
associate-*r/79.3%
associate-*r*79.3%
*-rgt-identity79.3%
sub-neg79.3%
distribute-neg-frac79.3%
metadata-eval79.3%
Simplified79.3%
*-un-lft-identity79.3%
difference-of-squares87.5%
times-frac99.6%
add-sqr-sqrt54.0%
sqrt-unprod72.4%
frac-times72.4%
metadata-eval72.4%
metadata-eval72.4%
frac-times72.4%
sqrt-unprod29.7%
add-sqr-sqrt69.5%
div-inv69.5%
metadata-eval69.5%
Applied egg-rr69.5%
Taylor expanded in a around 0 99.7%
associate-*l/99.7%
*-un-lft-identity99.7%
associate-*r/99.7%
*-commutative99.7%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
div-inv99.6%
associate-*r/99.6%
*-commutative99.6%
associate-*r/99.6%
*-commutative99.6%
associate-*l*99.6%
div-inv99.6%
times-frac91.7%
*-commutative91.7%
times-frac95.5%
Applied egg-rr95.5%
Final simplification96.1%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= b 2e+95) (* (/ PI a) (/ (/ 0.5 b) (+ b a))) (* (* 0.5 (/ PI (* b a))) (/ 1.0 b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (b <= 2e+95) {
tmp = (((double) M_PI) / a) * ((0.5 / b) / (b + a));
} else {
tmp = (0.5 * (((double) M_PI) / (b * a))) * (1.0 / b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (b <= 2e+95) {
tmp = (Math.PI / a) * ((0.5 / b) / (b + a));
} else {
tmp = (0.5 * (Math.PI / (b * a))) * (1.0 / b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if b <= 2e+95: tmp = (math.pi / a) * ((0.5 / b) / (b + a)) else: tmp = (0.5 * (math.pi / (b * a))) * (1.0 / b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (b <= 2e+95) tmp = Float64(Float64(pi / a) * Float64(Float64(0.5 / b) / Float64(b + a))); else tmp = Float64(Float64(0.5 * Float64(pi / Float64(b * a))) * Float64(1.0 / b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (b <= 2e+95)
tmp = (pi / a) * ((0.5 / b) / (b + a));
else
tmp = (0.5 * (pi / (b * a))) * (1.0 / b);
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[b, 2e+95], N[(N[(Pi / a), $MachinePrecision] * N[(N[(0.5 / b), $MachinePrecision] / N[(b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(Pi / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2 \cdot 10^{+95}:\\
\;\;\;\;\frac{\pi}{a} \cdot \frac{\frac{0.5}{b}}{b + a}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \frac{\pi}{b \cdot a}\right) \cdot \frac{1}{b}\\
\end{array}
\end{array}
if b < 2.00000000000000004e95Initial program 79.9%
*-commutative79.9%
associate-*r*79.9%
associate-*r/80.0%
associate-*r*80.0%
*-rgt-identity80.0%
sub-neg80.0%
distribute-neg-frac80.0%
metadata-eval80.0%
Simplified80.0%
*-un-lft-identity80.0%
difference-of-squares88.1%
times-frac99.6%
add-sqr-sqrt64.5%
sqrt-unprod66.4%
frac-times66.4%
metadata-eval66.4%
metadata-eval66.4%
frac-times66.4%
sqrt-unprod16.6%
add-sqr-sqrt63.8%
div-inv63.8%
metadata-eval63.8%
Applied egg-rr63.8%
Taylor expanded in a around 0 99.7%
associate-*l/99.8%
*-un-lft-identity99.8%
associate-*r/99.8%
*-commutative99.8%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-/l*95.6%
Simplified95.6%
if 2.00000000000000004e95 < b Initial program 64.8%
*-commutative64.8%
associate-*r*64.9%
associate-*r/64.7%
associate-*r*64.7%
*-rgt-identity64.7%
sub-neg64.7%
distribute-neg-frac64.7%
metadata-eval64.7%
Simplified64.7%
*-un-lft-identity64.7%
difference-of-squares79.9%
times-frac99.7%
add-sqr-sqrt0.0%
sqrt-unprod99.7%
frac-times99.7%
metadata-eval99.7%
metadata-eval99.7%
frac-times99.7%
sqrt-unprod99.7%
add-sqr-sqrt99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in a around 0 99.8%
Taylor expanded in b around inf 99.8%
Final simplification96.3%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -8.2e-127) (/ (/ (/ (* PI -0.5) a) b) (- a)) (* (* 0.5 (/ PI (* b a))) (/ 1.0 b))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -8.2e-127) {
tmp = (((((double) M_PI) * -0.5) / a) / b) / -a;
} else {
tmp = (0.5 * (((double) M_PI) / (b * a))) * (1.0 / b);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -8.2e-127) {
tmp = (((Math.PI * -0.5) / a) / b) / -a;
} else {
tmp = (0.5 * (Math.PI / (b * a))) * (1.0 / b);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -8.2e-127: tmp = (((math.pi * -0.5) / a) / b) / -a else: tmp = (0.5 * (math.pi / (b * a))) * (1.0 / b) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -8.2e-127) tmp = Float64(Float64(Float64(Float64(pi * -0.5) / a) / b) / Float64(-a)); else tmp = Float64(Float64(0.5 * Float64(pi / Float64(b * a))) * Float64(1.0 / b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -8.2e-127)
tmp = (((pi * -0.5) / a) / b) / -a;
else
tmp = (0.5 * (pi / (b * a))) * (1.0 / b);
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[a, -8.2e-127], N[(N[(N[(N[(Pi * -0.5), $MachinePrecision] / a), $MachinePrecision] / b), $MachinePrecision] / (-a)), $MachinePrecision], N[(N[(0.5 * N[(Pi / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.2 \cdot 10^{-127}:\\
\;\;\;\;\frac{\frac{\frac{\pi \cdot -0.5}{a}}{b}}{-a}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \frac{\pi}{b \cdot a}\right) \cdot \frac{1}{b}\\
\end{array}
\end{array}
if a < -8.199999999999999e-127Initial program 82.6%
*-commutative82.6%
associate-*r*82.7%
associate-*r/82.7%
associate-*r*82.7%
*-rgt-identity82.7%
sub-neg82.7%
distribute-neg-frac82.7%
metadata-eval82.7%
Simplified82.7%
*-un-lft-identity82.7%
difference-of-squares89.5%
times-frac99.7%
add-sqr-sqrt46.4%
sqrt-unprod69.0%
frac-times69.0%
metadata-eval69.0%
metadata-eval69.0%
frac-times69.0%
sqrt-unprod33.5%
add-sqr-sqrt63.4%
div-inv63.4%
metadata-eval63.4%
Applied egg-rr63.4%
Taylor expanded in a around 0 99.8%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in b around 0 80.2%
associate-*l/80.2%
*-un-lft-identity80.2%
frac-2neg80.2%
associate-*r/80.2%
distribute-neg-frac80.2%
associate-*r/80.2%
*-commutative80.2%
distribute-neg-frac80.2%
distribute-rgt-neg-in80.2%
metadata-eval80.2%
Applied egg-rr80.2%
if -8.199999999999999e-127 < a Initial program 74.4%
*-commutative74.4%
associate-*r*74.4%
associate-*r/74.4%
associate-*r*74.4%
*-rgt-identity74.4%
sub-neg74.4%
distribute-neg-frac74.4%
metadata-eval74.4%
Simplified74.4%
*-un-lft-identity74.4%
difference-of-squares85.1%
times-frac99.6%
add-sqr-sqrt56.3%
sqrt-unprod74.2%
frac-times74.2%
metadata-eval74.2%
metadata-eval74.2%
frac-times74.2%
sqrt-unprod30.5%
add-sqr-sqrt73.9%
div-inv73.9%
metadata-eval73.9%
Applied egg-rr73.9%
Taylor expanded in a around 0 99.7%
Taylor expanded in b around inf 74.1%
Final simplification76.2%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (let* ((t_0 (/ (/ (* PI -0.5) a) b))) (if (<= a -8.2e-127) (/ t_0 (- a)) (/ t_0 (- b)))))
assert(a < b);
double code(double a, double b) {
double t_0 = ((((double) M_PI) * -0.5) / a) / b;
double tmp;
if (a <= -8.2e-127) {
tmp = t_0 / -a;
} else {
tmp = t_0 / -b;
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double t_0 = ((Math.PI * -0.5) / a) / b;
double tmp;
if (a <= -8.2e-127) {
tmp = t_0 / -a;
} else {
tmp = t_0 / -b;
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): t_0 = ((math.pi * -0.5) / a) / b tmp = 0 if a <= -8.2e-127: tmp = t_0 / -a else: tmp = t_0 / -b return tmp
a, b = sort([a, b]) function code(a, b) t_0 = Float64(Float64(Float64(pi * -0.5) / a) / b) tmp = 0.0 if (a <= -8.2e-127) tmp = Float64(t_0 / Float64(-a)); else tmp = Float64(t_0 / Float64(-b)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
t_0 = ((pi * -0.5) / a) / b;
tmp = 0.0;
if (a <= -8.2e-127)
tmp = t_0 / -a;
else
tmp = t_0 / -b;
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function.
code[a_, b_] := Block[{t$95$0 = N[(N[(N[(Pi * -0.5), $MachinePrecision] / a), $MachinePrecision] / b), $MachinePrecision]}, If[LessEqual[a, -8.2e-127], N[(t$95$0 / (-a)), $MachinePrecision], N[(t$95$0 / (-b)), $MachinePrecision]]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{\pi \cdot -0.5}{a}}{b}\\
\mathbf{if}\;a \leq -8.2 \cdot 10^{-127}:\\
\;\;\;\;\frac{t\_0}{-a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{-b}\\
\end{array}
\end{array}
if a < -8.199999999999999e-127Initial program 82.6%
*-commutative82.6%
associate-*r*82.7%
associate-*r/82.7%
associate-*r*82.7%
*-rgt-identity82.7%
sub-neg82.7%
distribute-neg-frac82.7%
metadata-eval82.7%
Simplified82.7%
*-un-lft-identity82.7%
difference-of-squares89.5%
times-frac99.7%
add-sqr-sqrt46.4%
sqrt-unprod69.0%
frac-times69.0%
metadata-eval69.0%
metadata-eval69.0%
frac-times69.0%
sqrt-unprod33.5%
add-sqr-sqrt63.4%
div-inv63.4%
metadata-eval63.4%
Applied egg-rr63.4%
Taylor expanded in a around 0 99.8%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in b around 0 80.2%
associate-*l/80.2%
*-un-lft-identity80.2%
frac-2neg80.2%
associate-*r/80.2%
distribute-neg-frac80.2%
associate-*r/80.2%
*-commutative80.2%
distribute-neg-frac80.2%
distribute-rgt-neg-in80.2%
metadata-eval80.2%
Applied egg-rr80.2%
if -8.199999999999999e-127 < a Initial program 74.4%
*-commutative74.4%
associate-*r*74.4%
associate-*r/74.4%
associate-*r*74.4%
*-rgt-identity74.4%
sub-neg74.4%
distribute-neg-frac74.4%
metadata-eval74.4%
Simplified74.4%
*-un-lft-identity74.4%
difference-of-squares85.1%
times-frac99.6%
add-sqr-sqrt56.3%
sqrt-unprod74.2%
frac-times74.2%
metadata-eval74.2%
metadata-eval74.2%
frac-times74.2%
sqrt-unprod30.5%
add-sqr-sqrt73.9%
div-inv73.9%
metadata-eval73.9%
Applied egg-rr73.9%
Taylor expanded in a around 0 99.7%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in b around inf 73.9%
associate-*l/74.0%
*-un-lft-identity74.0%
frac-2neg74.0%
associate-*r/74.0%
distribute-neg-frac74.0%
associate-*r/74.0%
*-commutative74.0%
distribute-neg-frac74.0%
distribute-rgt-neg-in74.0%
metadata-eval74.0%
Applied egg-rr74.0%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -8.2e-127) (/ (/ (/ (* PI -0.5) a) b) (- a)) (/ (* PI (/ 0.5 b)) (* b a))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -8.2e-127) {
tmp = (((((double) M_PI) * -0.5) / a) / b) / -a;
} else {
tmp = (((double) M_PI) * (0.5 / b)) / (b * a);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -8.2e-127) {
tmp = (((Math.PI * -0.5) / a) / b) / -a;
} else {
tmp = (Math.PI * (0.5 / b)) / (b * a);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -8.2e-127: tmp = (((math.pi * -0.5) / a) / b) / -a else: tmp = (math.pi * (0.5 / b)) / (b * a) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -8.2e-127) tmp = Float64(Float64(Float64(Float64(pi * -0.5) / a) / b) / Float64(-a)); else tmp = Float64(Float64(pi * Float64(0.5 / b)) / Float64(b * a)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -8.2e-127)
tmp = (((pi * -0.5) / a) / b) / -a;
else
tmp = (pi * (0.5 / b)) / (b * a);
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[a, -8.2e-127], N[(N[(N[(N[(Pi * -0.5), $MachinePrecision] / a), $MachinePrecision] / b), $MachinePrecision] / (-a)), $MachinePrecision], N[(N[(Pi * N[(0.5 / b), $MachinePrecision]), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.2 \cdot 10^{-127}:\\
\;\;\;\;\frac{\frac{\frac{\pi \cdot -0.5}{a}}{b}}{-a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi \cdot \frac{0.5}{b}}{b \cdot a}\\
\end{array}
\end{array}
if a < -8.199999999999999e-127Initial program 82.6%
*-commutative82.6%
associate-*r*82.7%
associate-*r/82.7%
associate-*r*82.7%
*-rgt-identity82.7%
sub-neg82.7%
distribute-neg-frac82.7%
metadata-eval82.7%
Simplified82.7%
*-un-lft-identity82.7%
difference-of-squares89.5%
times-frac99.7%
add-sqr-sqrt46.4%
sqrt-unprod69.0%
frac-times69.0%
metadata-eval69.0%
metadata-eval69.0%
frac-times69.0%
sqrt-unprod33.5%
add-sqr-sqrt63.4%
div-inv63.4%
metadata-eval63.4%
Applied egg-rr63.4%
Taylor expanded in a around 0 99.8%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in b around 0 80.2%
associate-*l/80.2%
*-un-lft-identity80.2%
frac-2neg80.2%
associate-*r/80.2%
distribute-neg-frac80.2%
associate-*r/80.2%
*-commutative80.2%
distribute-neg-frac80.2%
distribute-rgt-neg-in80.2%
metadata-eval80.2%
Applied egg-rr80.2%
if -8.199999999999999e-127 < a Initial program 74.4%
*-commutative74.4%
associate-*r*74.4%
associate-*r/74.4%
associate-*r*74.4%
*-rgt-identity74.4%
sub-neg74.4%
distribute-neg-frac74.4%
metadata-eval74.4%
Simplified74.4%
*-un-lft-identity74.4%
difference-of-squares85.1%
times-frac99.6%
add-sqr-sqrt56.3%
sqrt-unprod74.2%
frac-times74.2%
metadata-eval74.2%
metadata-eval74.2%
frac-times74.2%
sqrt-unprod30.5%
add-sqr-sqrt73.9%
div-inv73.9%
metadata-eval73.9%
Applied egg-rr73.9%
Taylor expanded in a around 0 99.7%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in b around inf 73.9%
associate-*r/73.9%
*-commutative73.9%
associate-*r/73.9%
associate-*l/73.9%
frac-times74.1%
*-un-lft-identity74.1%
Applied egg-rr74.1%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -8.2e-127) (/ (* (/ 0.5 b) (/ PI a)) a) (/ (* PI (/ 0.5 b)) (* b a))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -8.2e-127) {
tmp = ((0.5 / b) * (((double) M_PI) / a)) / a;
} else {
tmp = (((double) M_PI) * (0.5 / b)) / (b * a);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -8.2e-127) {
tmp = ((0.5 / b) * (Math.PI / a)) / a;
} else {
tmp = (Math.PI * (0.5 / b)) / (b * a);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -8.2e-127: tmp = ((0.5 / b) * (math.pi / a)) / a else: tmp = (math.pi * (0.5 / b)) / (b * a) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -8.2e-127) tmp = Float64(Float64(Float64(0.5 / b) * Float64(pi / a)) / a); else tmp = Float64(Float64(pi * Float64(0.5 / b)) / Float64(b * a)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -8.2e-127)
tmp = ((0.5 / b) * (pi / a)) / a;
else
tmp = (pi * (0.5 / b)) / (b * a);
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[a, -8.2e-127], N[(N[(N[(0.5 / b), $MachinePrecision] * N[(Pi / a), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(Pi * N[(0.5 / b), $MachinePrecision]), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.2 \cdot 10^{-127}:\\
\;\;\;\;\frac{\frac{0.5}{b} \cdot \frac{\pi}{a}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi \cdot \frac{0.5}{b}}{b \cdot a}\\
\end{array}
\end{array}
if a < -8.199999999999999e-127Initial program 82.6%
*-commutative82.6%
associate-*r*82.7%
associate-*r/82.7%
associate-*r*82.7%
*-rgt-identity82.7%
sub-neg82.7%
distribute-neg-frac82.7%
metadata-eval82.7%
Simplified82.7%
*-un-lft-identity82.7%
difference-of-squares89.5%
times-frac99.7%
add-sqr-sqrt46.4%
sqrt-unprod69.0%
frac-times69.0%
metadata-eval69.0%
metadata-eval69.0%
frac-times69.0%
sqrt-unprod33.5%
add-sqr-sqrt63.4%
div-inv63.4%
metadata-eval63.4%
Applied egg-rr63.4%
Taylor expanded in a around 0 99.8%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in b around 0 80.2%
associate-*l/80.2%
*-un-lft-identity80.2%
associate-*r/80.2%
*-commutative80.2%
associate-*r/80.1%
Applied egg-rr80.1%
if -8.199999999999999e-127 < a Initial program 74.4%
*-commutative74.4%
associate-*r*74.4%
associate-*r/74.4%
associate-*r*74.4%
*-rgt-identity74.4%
sub-neg74.4%
distribute-neg-frac74.4%
metadata-eval74.4%
Simplified74.4%
*-un-lft-identity74.4%
difference-of-squares85.1%
times-frac99.6%
add-sqr-sqrt56.3%
sqrt-unprod74.2%
frac-times74.2%
metadata-eval74.2%
metadata-eval74.2%
frac-times74.2%
sqrt-unprod30.5%
add-sqr-sqrt73.9%
div-inv73.9%
metadata-eval73.9%
Applied egg-rr73.9%
Taylor expanded in a around 0 99.7%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in b around inf 73.9%
associate-*r/73.9%
*-commutative73.9%
associate-*r/73.9%
associate-*l/73.9%
frac-times74.1%
*-un-lft-identity74.1%
Applied egg-rr74.1%
Final simplification76.2%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -6.7e-127) (/ (* 0.5 PI) (* a (* b a))) (/ (* PI (/ 0.5 b)) (* b a))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -6.7e-127) {
tmp = (0.5 * ((double) M_PI)) / (a * (b * a));
} else {
tmp = (((double) M_PI) * (0.5 / b)) / (b * a);
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -6.7e-127) {
tmp = (0.5 * Math.PI) / (a * (b * a));
} else {
tmp = (Math.PI * (0.5 / b)) / (b * a);
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -6.7e-127: tmp = (0.5 * math.pi) / (a * (b * a)) else: tmp = (math.pi * (0.5 / b)) / (b * a) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -6.7e-127) tmp = Float64(Float64(0.5 * pi) / Float64(a * Float64(b * a))); else tmp = Float64(Float64(pi * Float64(0.5 / b)) / Float64(b * a)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -6.7e-127)
tmp = (0.5 * pi) / (a * (b * a));
else
tmp = (pi * (0.5 / b)) / (b * a);
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[a, -6.7e-127], N[(N[(0.5 * Pi), $MachinePrecision] / N[(a * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * N[(0.5 / b), $MachinePrecision]), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.7 \cdot 10^{-127}:\\
\;\;\;\;\frac{0.5 \cdot \pi}{a \cdot \left(b \cdot a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi \cdot \frac{0.5}{b}}{b \cdot a}\\
\end{array}
\end{array}
if a < -6.7000000000000001e-127Initial program 82.6%
*-commutative82.6%
associate-*r*82.7%
associate-*r/82.7%
associate-*r*82.7%
*-rgt-identity82.7%
sub-neg82.7%
distribute-neg-frac82.7%
metadata-eval82.7%
Simplified82.7%
*-un-lft-identity82.7%
difference-of-squares89.5%
times-frac99.7%
add-sqr-sqrt46.4%
sqrt-unprod69.0%
frac-times69.0%
metadata-eval69.0%
metadata-eval69.0%
frac-times69.0%
sqrt-unprod33.5%
add-sqr-sqrt63.4%
div-inv63.4%
metadata-eval63.4%
Applied egg-rr63.4%
Taylor expanded in a around 0 99.8%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in b around 0 80.2%
associate-*r/80.2%
*-commutative80.2%
associate-*r/80.1%
frac-times80.2%
frac-times80.1%
*-un-lft-identity80.1%
Applied egg-rr80.1%
if -6.7000000000000001e-127 < a Initial program 74.4%
*-commutative74.4%
associate-*r*74.4%
associate-*r/74.4%
associate-*r*74.4%
*-rgt-identity74.4%
sub-neg74.4%
distribute-neg-frac74.4%
metadata-eval74.4%
Simplified74.4%
*-un-lft-identity74.4%
difference-of-squares85.1%
times-frac99.6%
add-sqr-sqrt56.3%
sqrt-unprod74.2%
frac-times74.2%
metadata-eval74.2%
metadata-eval74.2%
frac-times74.2%
sqrt-unprod30.5%
add-sqr-sqrt73.9%
div-inv73.9%
metadata-eval73.9%
Applied egg-rr73.9%
Taylor expanded in a around 0 99.7%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in b around inf 73.9%
associate-*r/73.9%
*-commutative73.9%
associate-*r/73.9%
associate-*l/73.9%
frac-times74.1%
*-un-lft-identity74.1%
Applied egg-rr74.1%
Final simplification76.1%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -8.2e-127) (/ (* 0.5 PI) (* a (* b a))) (/ (* 0.5 PI) (* b (* b a)))))
assert(a < b);
double code(double a, double b) {
double tmp;
if (a <= -8.2e-127) {
tmp = (0.5 * ((double) M_PI)) / (a * (b * a));
} else {
tmp = (0.5 * ((double) M_PI)) / (b * (b * a));
}
return tmp;
}
assert a < b;
public static double code(double a, double b) {
double tmp;
if (a <= -8.2e-127) {
tmp = (0.5 * Math.PI) / (a * (b * a));
} else {
tmp = (0.5 * Math.PI) / (b * (b * a));
}
return tmp;
}
[a, b] = sort([a, b]) def code(a, b): tmp = 0 if a <= -8.2e-127: tmp = (0.5 * math.pi) / (a * (b * a)) else: tmp = (0.5 * math.pi) / (b * (b * a)) return tmp
a, b = sort([a, b]) function code(a, b) tmp = 0.0 if (a <= -8.2e-127) tmp = Float64(Float64(0.5 * pi) / Float64(a * Float64(b * a))); else tmp = Float64(Float64(0.5 * pi) / Float64(b * Float64(b * a))); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(a, b)
tmp = 0.0;
if (a <= -8.2e-127)
tmp = (0.5 * pi) / (a * (b * a));
else
tmp = (0.5 * pi) / (b * (b * a));
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := If[LessEqual[a, -8.2e-127], N[(N[(0.5 * Pi), $MachinePrecision] / N[(a * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * Pi), $MachinePrecision] / N[(b * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.2 \cdot 10^{-127}:\\
\;\;\;\;\frac{0.5 \cdot \pi}{a \cdot \left(b \cdot a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \pi}{b \cdot \left(b \cdot a\right)}\\
\end{array}
\end{array}
if a < -8.199999999999999e-127Initial program 82.6%
*-commutative82.6%
associate-*r*82.7%
associate-*r/82.7%
associate-*r*82.7%
*-rgt-identity82.7%
sub-neg82.7%
distribute-neg-frac82.7%
metadata-eval82.7%
Simplified82.7%
*-un-lft-identity82.7%
difference-of-squares89.5%
times-frac99.7%
add-sqr-sqrt46.4%
sqrt-unprod69.0%
frac-times69.0%
metadata-eval69.0%
metadata-eval69.0%
frac-times69.0%
sqrt-unprod33.5%
add-sqr-sqrt63.4%
div-inv63.4%
metadata-eval63.4%
Applied egg-rr63.4%
Taylor expanded in a around 0 99.8%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in b around 0 80.2%
associate-*r/80.2%
*-commutative80.2%
associate-*r/80.1%
frac-times80.2%
frac-times80.1%
*-un-lft-identity80.1%
Applied egg-rr80.1%
if -8.199999999999999e-127 < a Initial program 74.4%
*-commutative74.4%
associate-*r*74.4%
associate-*r/74.4%
associate-*r*74.4%
*-rgt-identity74.4%
sub-neg74.4%
distribute-neg-frac74.4%
metadata-eval74.4%
Simplified74.4%
*-un-lft-identity74.4%
difference-of-squares85.1%
times-frac99.6%
add-sqr-sqrt56.3%
sqrt-unprod74.2%
frac-times74.2%
metadata-eval74.2%
metadata-eval74.2%
frac-times74.2%
sqrt-unprod30.5%
add-sqr-sqrt73.9%
div-inv73.9%
metadata-eval73.9%
Applied egg-rr73.9%
Taylor expanded in a around 0 99.7%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in b around inf 73.9%
associate-*r/73.9%
*-commutative73.9%
associate-*r/73.9%
frac-times74.1%
frac-times73.0%
*-un-lft-identity73.0%
Applied egg-rr73.0%
Final simplification75.5%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (* (/ 1.0 (+ b a)) (* 0.5 (/ PI (* b a)))))
assert(a < b);
double code(double a, double b) {
return (1.0 / (b + a)) * (0.5 * (((double) M_PI) / (b * a)));
}
assert a < b;
public static double code(double a, double b) {
return (1.0 / (b + a)) * (0.5 * (Math.PI / (b * a)));
}
[a, b] = sort([a, b]) def code(a, b): return (1.0 / (b + a)) * (0.5 * (math.pi / (b * a)))
a, b = sort([a, b]) function code(a, b) return Float64(Float64(1.0 / Float64(b + a)) * Float64(0.5 * Float64(pi / Float64(b * a)))) end
a, b = num2cell(sort([a, b])){:}
function tmp = code(a, b)
tmp = (1.0 / (b + a)) * (0.5 * (pi / (b * a)));
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := N[(N[(1.0 / N[(b + a), $MachinePrecision]), $MachinePrecision] * N[(0.5 * N[(Pi / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{1}{b + a} \cdot \left(0.5 \cdot \frac{\pi}{b \cdot a}\right)
\end{array}
Initial program 77.2%
*-commutative77.2%
associate-*r*77.2%
associate-*r/77.2%
associate-*r*77.2%
*-rgt-identity77.2%
sub-neg77.2%
distribute-neg-frac77.2%
metadata-eval77.2%
Simplified77.2%
*-un-lft-identity77.2%
difference-of-squares86.6%
times-frac99.6%
add-sqr-sqrt52.9%
sqrt-unprod72.4%
frac-times72.4%
metadata-eval72.4%
metadata-eval72.4%
frac-times72.4%
sqrt-unprod31.6%
add-sqr-sqrt70.3%
div-inv70.3%
metadata-eval70.3%
Applied egg-rr70.3%
Taylor expanded in a around 0 99.7%
Final simplification99.7%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (/ (/ (* PI (/ 0.5 b)) a) (+ b a)))
assert(a < b);
double code(double a, double b) {
return ((((double) M_PI) * (0.5 / b)) / a) / (b + a);
}
assert a < b;
public static double code(double a, double b) {
return ((Math.PI * (0.5 / b)) / a) / (b + a);
}
[a, b] = sort([a, b]) def code(a, b): return ((math.pi * (0.5 / b)) / a) / (b + a)
a, b = sort([a, b]) function code(a, b) return Float64(Float64(Float64(pi * Float64(0.5 / b)) / a) / Float64(b + a)) end
a, b = num2cell(sort([a, b])){:}
function tmp = code(a, b)
tmp = ((pi * (0.5 / b)) / a) / (b + a);
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := N[(N[(N[(Pi * N[(0.5 / b), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] / N[(b + a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{\frac{\pi \cdot \frac{0.5}{b}}{a}}{b + a}
\end{array}
Initial program 77.2%
*-commutative77.2%
associate-*r*77.2%
associate-*r/77.2%
associate-*r*77.2%
*-rgt-identity77.2%
sub-neg77.2%
distribute-neg-frac77.2%
metadata-eval77.2%
Simplified77.2%
*-un-lft-identity77.2%
difference-of-squares86.6%
times-frac99.6%
add-sqr-sqrt52.9%
sqrt-unprod72.4%
frac-times72.4%
metadata-eval72.4%
metadata-eval72.4%
frac-times72.4%
sqrt-unprod31.6%
add-sqr-sqrt70.3%
div-inv70.3%
metadata-eval70.3%
Applied egg-rr70.3%
Taylor expanded in a around 0 99.7%
associate-*l/99.8%
*-un-lft-identity99.8%
associate-*r/99.8%
*-commutative99.8%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.7%
Applied egg-rr99.7%
Final simplification99.7%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (/ (* (/ 0.5 b) (/ PI a)) (+ b a)))
assert(a < b);
double code(double a, double b) {
return ((0.5 / b) * (((double) M_PI) / a)) / (b + a);
}
assert a < b;
public static double code(double a, double b) {
return ((0.5 / b) * (Math.PI / a)) / (b + a);
}
[a, b] = sort([a, b]) def code(a, b): return ((0.5 / b) * (math.pi / a)) / (b + a)
a, b = sort([a, b]) function code(a, b) return Float64(Float64(Float64(0.5 / b) * Float64(pi / a)) / Float64(b + a)) end
a, b = num2cell(sort([a, b])){:}
function tmp = code(a, b)
tmp = ((0.5 / b) * (pi / a)) / (b + a);
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := N[(N[(N[(0.5 / b), $MachinePrecision] * N[(Pi / a), $MachinePrecision]), $MachinePrecision] / N[(b + a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{\frac{0.5}{b} \cdot \frac{\pi}{a}}{b + a}
\end{array}
Initial program 77.2%
*-commutative77.2%
associate-*r*77.2%
associate-*r/77.2%
associate-*r*77.2%
*-rgt-identity77.2%
sub-neg77.2%
distribute-neg-frac77.2%
metadata-eval77.2%
Simplified77.2%
*-un-lft-identity77.2%
difference-of-squares86.6%
times-frac99.6%
add-sqr-sqrt52.9%
sqrt-unprod72.4%
frac-times72.4%
metadata-eval72.4%
metadata-eval72.4%
frac-times72.4%
sqrt-unprod31.6%
add-sqr-sqrt70.3%
div-inv70.3%
metadata-eval70.3%
Applied egg-rr70.3%
Taylor expanded in a around 0 99.7%
associate-*l/99.8%
*-un-lft-identity99.8%
associate-*r/99.8%
*-commutative99.8%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
Final simplification99.7%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (/ (* 0.5 PI) (* (* b a) (+ b a))))
assert(a < b);
double code(double a, double b) {
return (0.5 * ((double) M_PI)) / ((b * a) * (b + a));
}
assert a < b;
public static double code(double a, double b) {
return (0.5 * Math.PI) / ((b * a) * (b + a));
}
[a, b] = sort([a, b]) def code(a, b): return (0.5 * math.pi) / ((b * a) * (b + a))
a, b = sort([a, b]) function code(a, b) return Float64(Float64(0.5 * pi) / Float64(Float64(b * a) * Float64(b + a))) end
a, b = num2cell(sort([a, b])){:}
function tmp = code(a, b)
tmp = (0.5 * pi) / ((b * a) * (b + a));
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := N[(N[(0.5 * Pi), $MachinePrecision] / N[(N[(b * a), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{0.5 \cdot \pi}{\left(b \cdot a\right) \cdot \left(b + a\right)}
\end{array}
Initial program 77.2%
*-commutative77.2%
associate-*r*77.2%
associate-*r/77.2%
associate-*r*77.2%
*-rgt-identity77.2%
sub-neg77.2%
distribute-neg-frac77.2%
metadata-eval77.2%
Simplified77.2%
*-un-lft-identity77.2%
difference-of-squares86.6%
times-frac99.6%
add-sqr-sqrt52.9%
sqrt-unprod72.4%
frac-times72.4%
metadata-eval72.4%
metadata-eval72.4%
frac-times72.4%
sqrt-unprod31.6%
add-sqr-sqrt70.3%
div-inv70.3%
metadata-eval70.3%
Applied egg-rr70.3%
Taylor expanded in a around 0 99.7%
associate-*r/99.7%
*-commutative99.7%
frac-times98.2%
*-un-lft-identity98.2%
+-commutative98.2%
Applied egg-rr98.2%
Final simplification98.2%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (/ (* 0.5 PI) (* a (* b a))))
assert(a < b);
double code(double a, double b) {
return (0.5 * ((double) M_PI)) / (a * (b * a));
}
assert a < b;
public static double code(double a, double b) {
return (0.5 * Math.PI) / (a * (b * a));
}
[a, b] = sort([a, b]) def code(a, b): return (0.5 * math.pi) / (a * (b * a))
a, b = sort([a, b]) function code(a, b) return Float64(Float64(0.5 * pi) / Float64(a * Float64(b * a))) end
a, b = num2cell(sort([a, b])){:}
function tmp = code(a, b)
tmp = (0.5 * pi) / (a * (b * a));
end
NOTE: a and b should be sorted in increasing order before calling this function. code[a_, b_] := N[(N[(0.5 * Pi), $MachinePrecision] / N[(a * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{0.5 \cdot \pi}{a \cdot \left(b \cdot a\right)}
\end{array}
Initial program 77.2%
*-commutative77.2%
associate-*r*77.2%
associate-*r/77.2%
associate-*r*77.2%
*-rgt-identity77.2%
sub-neg77.2%
distribute-neg-frac77.2%
metadata-eval77.2%
Simplified77.2%
*-un-lft-identity77.2%
difference-of-squares86.6%
times-frac99.6%
add-sqr-sqrt52.9%
sqrt-unprod72.4%
frac-times72.4%
metadata-eval72.4%
metadata-eval72.4%
frac-times72.4%
sqrt-unprod31.6%
add-sqr-sqrt70.3%
div-inv70.3%
metadata-eval70.3%
Applied egg-rr70.3%
Taylor expanded in a around 0 99.7%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in b around 0 63.0%
associate-*r/63.0%
*-commutative63.0%
associate-*r/62.9%
frac-times63.0%
frac-times62.6%
*-un-lft-identity62.6%
Applied egg-rr62.6%
Final simplification62.6%
herbie shell --seed 2024106
(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))))