\frac{x \cdot 100}{x + y}
\begin{array}{l}
t_0 := \frac{100}{x + y}\\
t_1 := x \cdot t_0\\
\mathbf{if}\;y \leq 2.9324058059803696 \cdot 10^{-145}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.1419780404580396 \cdot 10^{+122}:\\
\;\;\;\;100\\
\mathbf{elif}\;y \leq 4.404093813874534 \cdot 10^{+150}:\\
\;\;\;\;x \cdot \left|t_0\right|\\
\mathbf{elif}\;y \leq 6.770638945663061 \cdot 10^{+203}:\\
\;\;\;\;100\\
\mathbf{elif}\;y \leq 1.4672009052933056 \cdot 10^{+225}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 4.0463059399122565 \cdot 10^{+295}:\\
\;\;\;\;100\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 100\right) \cdot \frac{1}{x + y}\\
\end{array}
(FPCore (x y) :precision binary64 (/ (* x 100.0) (+ x y)))
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ 100.0 (+ x y))) (t_1 (* x t_0)))
(if (<= y 2.9324058059803696e-145)
t_1
(if (<= y 1.1419780404580396e+122)
100.0
(if (<= y 4.404093813874534e+150)
(* x (fabs t_0))
(if (<= y 6.770638945663061e+203)
100.0
(if (<= y 1.4672009052933056e+225)
t_1
(if (<= y 4.0463059399122565e+295)
100.0
(* (* x 100.0) (/ 1.0 (+ x y)))))))))))double code(double x, double y) {
return (x * 100.0) / (x + y);
}
double code(double x, double y) {
double t_0 = 100.0 / (x + y);
double t_1 = x * t_0;
double tmp;
if (y <= 2.9324058059803696e-145) {
tmp = t_1;
} else if (y <= 1.1419780404580396e+122) {
tmp = 100.0;
} else if (y <= 4.404093813874534e+150) {
tmp = x * fabs(t_0);
} else if (y <= 6.770638945663061e+203) {
tmp = 100.0;
} else if (y <= 1.4672009052933056e+225) {
tmp = t_1;
} else if (y <= 4.0463059399122565e+295) {
tmp = 100.0;
} else {
tmp = (x * 100.0) * (1.0 / (x + y));
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 0.4 |
|---|---|
| Target | 0.2 |
| Herbie | 11.8 |
if y < 2.9324058059803696e-145 or 6.77063894566306107e203 < y < 1.4672009052933056e225Initial program 0.4
Applied egg-rr0.2
if 2.9324058059803696e-145 < y < 1.1419780404580396e122 or 4.4040938138745338e150 < y < 6.77063894566306107e203 or 1.4672009052933056e225 < y < 4.0463059399122565e295Initial program 0.3
Taylor expanded in x around inf 37.9
if 1.1419780404580396e122 < y < 4.4040938138745338e150Initial program 0.2
Applied egg-rr0.2
Applied egg-rr9.5
if 4.0463059399122565e295 < y Initial program 0.2
Applied egg-rr0.2
Final simplification11.8
herbie shell --seed 2022127
(FPCore (x y)
:name "Development.Shake.Progress:message from shake-0.15.5"
:precision binary64
:herbie-target
(* (/ x 1.0) (/ 100.0 (+ x y)))
(/ (* x 100.0) (+ x y)))