x + \frac{y \cdot \left(z - x\right)}{t}\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \leq -1.8115265265078395 \cdot 10^{+291}:\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{elif}\;x + \frac{y \cdot \left(z - x\right)}{t} \leq 4.111794403446377 \cdot 10^{+305}:\\
\;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\end{array}(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
:precision binary64
(if (<= (+ x (/ (* y (- z x)) t)) -1.8115265265078395e+291)
(+ x (* (- z x) (/ y t)))
(if (<= (+ x (/ (* y (- z x)) t)) 4.111794403446377e+305)
(+ x (/ (* y (- z x)) t))
(+ x (* y (/ (- z x) t))))))double code(double x, double y, double z, double t) {
return ((double) (x + (((double) (y * ((double) (z - x)))) / t)));
}
double code(double x, double y, double z, double t) {
double tmp;
if ((((double) (x + (((double) (y * ((double) (z - x)))) / t))) <= -1.8115265265078395e+291)) {
tmp = ((double) (x + ((double) (((double) (z - x)) * (y / t)))));
} else {
double tmp_1;
if ((((double) (x + (((double) (y * ((double) (z - x)))) / t))) <= 4.111794403446377e+305)) {
tmp_1 = ((double) (x + (((double) (y * ((double) (z - x)))) / t)));
} else {
tmp_1 = ((double) (x + ((double) (y * (((double) (z - x)) / t)))));
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.7 |
|---|---|
| Target | 2.0 |
| Herbie | 1.0 |
if (+ x (/ (* y (- z x)) t)) < -1.8115265265078395e291Initial program Error: 47.1 bits
SimplifiedError: 5.6 bits
rmApplied clear-numError: 5.7 bits
rmApplied associate-/r/Error: 5.7 bits
Applied associate-*r*Error: 2.0 bits
SimplifiedError: 1.9 bits
if -1.8115265265078395e291 < (+ x (/ (* y (- z x)) t)) < 4.11179440344637724e305Initial program Error: 1.0 bits
if 4.11179440344637724e305 < (+ x (/ (* y (- z x)) t)) Initial program Error: 60.4 bits
SimplifiedError: 1.3 bits
Final simplificationError: 1.0 bits
herbie shell --seed 2020203
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:herbie-target
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))