\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
t_1 := \left(x + y\right) - \frac{y \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - a\right)\\
\mathbf{elif}\;t_1 \leq -1.249178333079565 \cdot 10^{-218}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\left(x + \frac{y \cdot z}{t}\right) - \frac{y \cdot a}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(y + \mathsf{fma}\left(\frac{y}{a - t}, t, x\right)\right) - \frac{y}{\frac{a - t}{z}}\\
\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
(let* ((t_1 (- (+ x y) (/ (* y (- z t)) (- a t)))))
(if (<= t_1 (- INFINITY))
(+ x (* (/ y t) (- z a)))
(if (<= t_1 -1.249178333079565e-218)
t_1
(if (<= t_1 0.0)
(- (+ x (/ (* y z) t)) (/ (* y a) t))
(- (+ y (fma (/ y (- a t)) t x)) (/ y (/ (- a t) z))))))))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 t_1 = (x + y) - ((y * (z - t)) / (a - t));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x + ((y / t) * (z - a));
} else if (t_1 <= -1.249178333079565e-218) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (x + ((y * z) / t)) - ((y * a) / t);
} else {
tmp = (y + fma((y / (a - t)), t, x)) - (y / ((a - t) / z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 14.5 |
|---|---|
| Target | 7.7 |
| Herbie | 6.1 |
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0Initial program 39.1
Simplified17.1
Taylor expanded in t around inf 31.3
Simplified18.4
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -1.24917833307956512e-218Initial program 1.5
if -1.24917833307956512e-218 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 56.2
Simplified55.9
Applied clear-num_binary6455.9
Taylor expanded in t around inf 3.8
Simplified3.8
if 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 11.1
Simplified6.8
Applied add-cube-cbrt_binary647.0
Applied *-un-lft-identity_binary647.0
Applied times-frac_binary647.0
Taylor expanded in y around 0 11.4
Simplified10.0
Applied associate-/l*_binary646.8
Final simplification6.1
herbie shell --seed 2022068
(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-7) (- (+ 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))))