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 (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -2.0502594585641032e106 or 9.0091827022784228e-57 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 9.7
rmApplied *-un-lft-identity_binary649.7
Applied times-frac_binary648.8
Simplified8.8
rmApplied div-sub_binary648.8
rmApplied div-inv_binary648.8
Applied div-inv_binary648.8
Applied distribute-rgt-out--_binary648.8
Applied associate-*r*_binary642.2
Simplified2.2
if -2.0502594585641032e106 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 9.0091827022784228e-57Initial program 1.6
rmApplied *-un-lft-identity_binary641.6
Applied times-frac_binary642.0
Simplified2.0
rmApplied clear-num_binary642.2
Final simplification2.2
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)))