\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} \leq -\infty:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\
\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \leq -9.510032144855243 \cdot 10^{-194} \lor \neg \left(\frac{x \cdot \left(y - z\right)}{y} \leq 4.963608052259534 \cdot 10^{-269}\right) \land \frac{x \cdot \left(y - z\right)}{y} \leq 9.268358875021113 \cdot 10^{+306}:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \frac{x}{y}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
(FPCore (x y z)
:precision binary64
(if (<= (/ (* x (- y z)) y) (- INFINITY))
(* (- y z) (/ x y))
(if (or (<= (/ (* x (- y z)) y) -9.510032144855243e-194)
(and (not (<= (/ (* x (- y z)) y) 4.963608052259534e-269))
(<= (/ (* x (- y z)) y) 9.268358875021113e+306)))
(/ (* x (- y z)) y)
(- x (* z (/ x y))))))double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
double code(double x, double y, double z) {
double tmp;
if (((x * (y - z)) / y) <= -((double) INFINITY)) {
tmp = (y - z) * (x / y);
} else if ((((x * (y - z)) / y) <= -9.510032144855243e-194) || (!(((x * (y - z)) / y) <= 4.963608052259534e-269) && (((x * (y - z)) / y) <= 9.268358875021113e+306))) {
tmp = (x * (y - z)) / y;
} else {
tmp = x - (z * (x / y));
}
return tmp;
}













Bits error versus x













Bits error versus y













Bits error versus z
Results
| Original | 12.2 |
|---|---|
| Target | 3.2 |
| Herbie | 0.5 |
| Alternative 1 | |
|---|---|
| Error | 1.8 |
| Cost | 59072 |
| Alternative 2 | |
|---|---|
| Error | 2.9 |
| Cost | 20546 |
| Alternative 3 | |
|---|---|
| Error | 1.7 |
| Cost | 1858 |
| Alternative 4 | |
|---|---|
| Error | 0.5 |
| Cost | 2577 |
| Alternative 5 | |
|---|---|
| Error | 4.5 |
| Cost | 3268 |
| Alternative 6 | |
|---|---|
| Error | 19.0 |
| Cost | 712 |
| Alternative 7 | |
|---|---|
| Error | 20.4 |
| Cost | 977 |
| Alternative 8 | |
|---|---|
| Error | 25.7 |
| Cost | 64 |
| Alternative 9 | |
|---|---|
| Error | 61.7 |
| Cost | 64 |

if (/.f64 (*.f64 x (-.f64 y z)) y) < -inf.0Initial program 64.0
rmApplied associate-/l*_binary64_218470.1
rmApplied associate-/r/_binary64_218480.1
Simplified0.1
if -inf.0 < (/.f64 (*.f64 x (-.f64 y z)) y) < -9.51003214485524326e-194 or 4.96360805225953432e-269 < (/.f64 (*.f64 x (-.f64 y z)) y) < 9.26835887502111328e306Initial program 0.3
Simplified0.3
if -9.51003214485524326e-194 < (/.f64 (*.f64 x (-.f64 y z)) y) < 4.96360805225953432e-269 or 9.26835887502111328e306 < (/.f64 (*.f64 x (-.f64 y z)) y) Initial program 38.7
rmApplied associate-/l*_binary64_218470.1
Taylor expanded around 0 15.9
Simplified1.4
Simplified1.4
Final simplification0.5
herbie shell --seed 2021044
(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))