\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 -1.153456526587012 \cdot 10^{-34}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\
\mathbf{elif}\;t_0 \leq 8.221940391576001 \cdot 10^{+83}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{y}\right)\\
\mathbf{elif}\;t_0 \leq 8.047330820983547 \cdot 10^{+306}:\\
\;\;\;\;x - \frac{x \cdot z}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\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 -1.153456526587012e-34)
(* (- y z) (/ x y))
(if (<= t_0 8.221940391576001e+83)
(* x (- 1.0 (/ z y)))
(if (<= t_0 8.047330820983547e+306)
(- x (/ (* x z) y))
(/ x (/ y (- y z))))))))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 <= -1.153456526587012e-34) {
tmp = (y - z) * (x / y);
} else if (t_0 <= 8.221940391576001e+83) {
tmp = x * (1.0 - (z / y));
} else if (t_0 <= 8.047330820983547e+306) {
tmp = x - ((x * z) / y);
} else {
tmp = x / (y / (y - z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.4 |
|---|---|
| Target | 3.0 |
| Herbie | 2.0 |
if (/.f64 (*.f64 x (-.f64 y z)) y) < -1.15345652658701191e-34Initial program 15.2
Applied associate-/l*_binary645.2
Applied associate-/r/_binary645.8
if -1.15345652658701191e-34 < (/.f64 (*.f64 x (-.f64 y z)) y) < 8.2219403915760008e83Initial program 6.1
Applied associate-/l*_binary640.3
Applied log1p-expm1-u_binary640.3
Applied div-inv_binary640.4
Simplified0.4
if 8.2219403915760008e83 < (/.f64 (*.f64 x (-.f64 y z)) y) < 8.0473308209835466e306Initial program 0.2
Taylor expanded in y around 0 0.2
if 8.0473308209835466e306 < (/.f64 (*.f64 x (-.f64 y z)) y) Initial program 63.5
Applied associate-/l*_binary640.4
Final simplification2.0
herbie shell --seed 2022104
(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))