\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\begin{array}{l}
\mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \le -7.5452266175570577 \cdot 10^{-233}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \frac{1}{a - t}, t - z, x + y\right)\\
\mathbf{elif}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \le 0.0:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t - z}{a - t} + \left(x + y\right)\\
\end{array}double code(double x, double y, double z, double t, double a) {
return ((double) (((double) (x + y)) - ((double) (((double) (((double) (z - t)) * y)) / ((double) (a - t))))));
}
double code(double x, double y, double z, double t, double a) {
double VAR;
if ((((double) (((double) (x + y)) - ((double) (((double) (((double) (z - t)) * y)) / ((double) (a - t)))))) <= -7.545226617557058e-233)) {
VAR = ((double) fma(((double) (y * ((double) (1.0 / ((double) (a - t)))))), ((double) (t - z)), ((double) (x + y))));
} else {
double VAR_1;
if ((((double) (((double) (x + y)) - ((double) (((double) (((double) (z - t)) * y)) / ((double) (a - t)))))) <= 0.0)) {
VAR_1 = x;
} else {
VAR_1 = ((double) (((double) (y * ((double) (((double) (t - z)) / ((double) (a - t)))))) + ((double) (x + y))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 16.4 |
|---|---|
| Target | 8.1 |
| Herbie | 9.9 |
if (- (+ x y) (/ (* (- z t) y) (- a t))) < -7.545226617557058e-233Initial program 12.7
Simplified7.9
rmApplied div-inv7.9
if -7.545226617557058e-233 < (- (+ x y) (/ (* (- z t) y) (- a t))) < 0.0Initial program 58.3
Simplified58.5
Taylor expanded around 0 35.9
if 0.0 < (- (+ x y) (/ (* (- z t) y) (- a t))) Initial program 12.4
Simplified7.7
rmApplied fma-udef7.8
rmApplied div-inv7.8
Applied associate-*l*7.3
Simplified7.3
Final simplification9.9
herbie shell --seed 2020123 +o rules:numerics
(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 (- 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 (- a t))) y))))
(- (+ x y) (/ (* (- z t) y) (- a t))))