x + \frac{y \cdot \left(z - x\right)}{t}\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \leq -2.050259458564103 \cdot 10^{+106} \lor \neg \left(x + \frac{y \cdot \left(z - x\right)}{t} \leq 9.009182702278423 \cdot 10^{-57}\right):\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{1}{\frac{t}{z - x}}\\
\end{array}(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
:precision binary64
(if (or (<= (+ x (/ (* y (- z x)) t)) -2.050259458564103e+106)
(not (<= (+ x (/ (* y (- z x)) t)) 9.009182702278423e-57)))
(+ x (* (- z x) (/ y t)))
(+ x (* y (/ 1.0 (/ t (- z x)))))))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))) <= -2.050259458564103e+106) || !(((double) (x + (((double) (y * ((double) (z - x)))) / t))) <= 9.009182702278423e-57))) {
tmp = ((double) (x + ((double) (((double) (z - x)) * (y / t)))));
} else {
tmp = ((double) (x + ((double) (y * (1.0 / (t / ((double) (z - x))))))));
}
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 | 2.2 |
if (+ x (/ (* y (- z x)) t)) < -2.0502594585641032e106 or 9.0091827022784228e-57 < (+ x (/ (* y (- z x)) t)) Initial program Error: 9.7 bits
rmApplied *-un-lft-identityError: 9.7 bits
Applied times-fracError: 8.8 bits
SimplifiedError: 8.8 bits
rmApplied div-subError: 8.8 bits
rmApplied div-invError: 8.8 bits
Applied div-invError: 8.8 bits
Applied distribute-rgt-out--Error: 8.8 bits
Applied associate-*r*Error: 2.2 bits
SimplifiedError: 2.2 bits
if -2.0502594585641032e106 < (+ x (/ (* y (- z x)) t)) < 9.0091827022784228e-57Initial program Error: 1.6 bits
rmApplied *-un-lft-identityError: 1.6 bits
Applied times-fracError: 2.0 bits
SimplifiedError: 2.0 bits
rmApplied clear-numError: 2.2 bits
Final simplificationError: 2.2 bits
herbie shell --seed 2020205
(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)))