\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
t_0 := \frac{x \cdot \left(y - z\right)}{y}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\mathbf{elif}\;t_0 \leq -19425980806.412174:\\
\;\;\;\;x - \frac{x \cdot z}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{y}\right)\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* x (- y z)) y)))
(if (<= t_0 (- INFINITY))
(/ x (/ y (- y z)))
(if (<= t_0 -19425980806.412174)
(- x (/ (* x z) y))
(* x (- 1.0 (/ z y)))))))double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
double code(double x, double y, double z) {
double t_0 = (x * (y - z)) / y;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = x / (y / (y - z));
} else if (t_0 <= -19425980806.412174) {
tmp = x - ((x * z) / y);
} else {
tmp = x * (1.0 - (z / y));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.6 |
|---|---|
| Target | 2.6 |
| Herbie | 1.6 |
if (/.f64 (*.f64 x (-.f64 y z)) y) < -inf.0Initial program 64.0
Applied associate-/l*_binary640.0
if -inf.0 < (/.f64 (*.f64 x (-.f64 y z)) y) < -19425980806.4121742Initial program 0.2
Applied associate-/l*_binary647.6
Applied associate-/r/_binary647.8
Applied sub-neg_binary647.8
Applied distribute-rgt-in_binary647.8
Simplified7.7
Simplified0.2
if -19425980806.4121742 < (/.f64 (*.f64 x (-.f64 y z)) y) Initial program 10.6
Applied *-un-lft-identity_binary6410.6
Applied times-frac_binary642.2
Simplified2.2
Taylor expanded in y around 0 2.2
Final simplification1.6
herbie shell --seed 2022160
(FPCore (x y z)
:name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
:precision binary64
:herbie-target
(if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))
(/ (* x (- y z)) y))