x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -4.620299765818223 \cdot 10^{+242}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{t} - \frac{x}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z}{t}, x\right)\\
\mathbf{if}\;\frac{z}{t} \leq -1.2829284567762299 \cdot 10^{-64}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 5.322646425016115 \cdot 10^{-141}:\\
\;\;\;\;x + z \cdot \frac{\frac{1}{t}}{\frac{1}{y - x}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}\\
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
(FPCore (x y z t)
:precision binary64
(if (<= (/ z t) -4.620299765818223e+242)
(fma z (- (/ y t) (/ x t)) x)
(let* ((t_1 (fma (- y x) (/ z t) x)))
(if (<= (/ z t) -1.2829284567762299e-64)
t_1
(if (<= (/ z t) 5.322646425016115e-141)
(+ x (* z (/ (/ 1.0 t) (/ 1.0 (- y x)))))
t_1)))))double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -4.620299765818223e+242) {
tmp = fma(z, ((y / t) - (x / t)), x);
} else {
double t_1 = fma((y - x), (z / t), x);
double tmp_1;
if ((z / t) <= -1.2829284567762299e-64) {
tmp_1 = t_1;
} else if ((z / t) <= 5.322646425016115e-141) {
tmp_1 = x + (z * ((1.0 / t) / (1.0 / (y - x))));
} else {
tmp_1 = t_1;
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 1.9 |
|---|---|
| Target | 2.2 |
| Herbie | 1.7 |
if (/.f64 z t) < -4.6202997658182231e242Initial program 27.8
Simplified27.8
Applied fma-udef_binary6427.8
Simplified0.7
Taylor expanded in y around 0 0.7
Applied fma-def_binary640.7
if -4.6202997658182231e242 < (/.f64 z t) < -1.2829284567762299e-64 or 5.3226464250161154e-141 < (/.f64 z t) Initial program 1.4
Simplified1.4
if -1.2829284567762299e-64 < (/.f64 z t) < 5.3226464250161154e-141Initial program 1.4
Simplified1.4
Applied fma-udef_binary641.4
Simplified2.1
Applied clear-num_binary642.1
Applied div-inv_binary642.1
Applied associate-/r*_binary642.1
Final simplification1.7
herbie shell --seed 2022077
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
:precision binary64
:herbie-target
(if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) 0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))
(+ x (* (- y x) (/ z t))))