\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\begin{array}{l}
\mathbf{if}\;\left(x + y\right) - \frac{y \cdot \left(z - t\right)}{a - t} \leq -7.115427134883366 \cdot 10^{-232} \lor \neg \left(\left(x + y\right) - \frac{y \cdot \left(z - t\right)}{a - t} \leq 3.506851936346399 \cdot 10^{-253}\right):\\
\;\;\;\;x + \left(y - \frac{z - t}{\frac{a - t}{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + \frac{y \cdot z}{t}\right) - \frac{y \cdot a}{t}\\
\end{array}(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
(FPCore (x y z t a)
:precision binary64
(if (or (<= (- (+ x y) (/ (* y (- z t)) (- a t))) -7.115427134883366e-232)
(not
(<= (- (+ x y) (/ (* y (- z t)) (- a t))) 3.506851936346399e-253)))
(+ x (- y (/ (- z t) (/ (- a t) y))))
(- (+ x (/ (* y z) t)) (/ (* y a) t))))double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((((x + y) - ((y * (z - t)) / (a - t))) <= -7.115427134883366e-232) || !(((x + y) - ((y * (z - t)) / (a - t))) <= 3.506851936346399e-253)) {
tmp = x + (y - ((z - t) / ((a - t) / y)));
} else {
tmp = (x + ((y * z) / t)) - ((y * a) / t);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 16.8 |
|---|---|
| Target | 8.8 |
| Herbie | 5.9 |
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -7.11542713488336607e-232 or 3.506851936346399e-253 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 13.0
rmApplied add-cube-cbrt_binary6413.2
Applied times-frac_binary647.8
Applied cancel-sign-sub-inv_binary647.8
Simplified7.8
rmApplied associate-+l+_binary647.3
Simplified6.0
if -7.11542713488336607e-232 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 3.506851936346399e-253Initial program 55.5
Taylor expanded around inf 4.1
Simplified4.1
Final simplification5.9
herbie shell --seed 2021173
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-07) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y))))
(- (+ x y) (/ (* (- z t) y) (- a t))))