x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t_1 \leq -3.793508615134499 \cdot 10^{-266}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a - t}, x\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\left(y + \left(\frac{x \cdot z}{t} + \frac{y \cdot a}{t}\right)\right) - \left(\frac{x \cdot a}{t} + \frac{y \cdot z}{t}\right)\\
\mathbf{elif}\;t_1 \leq 8.31680306445043 \cdot 10^{+296}:\\
\;\;\;\;\left(\left(x \cdot t\right) \cdot \frac{1}{a - t} + \left(x + \frac{y \cdot z}{a - t}\right)\right) - \left(\frac{x \cdot z}{a - t} + \frac{y \cdot t}{a - t}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{1}{\frac{a - t}{z - t}}, x\right)\\
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_1 -3.793508615134499e-266)
(fma (- y x) (/ (- z t) (- a t)) x)
(if (<= t_1 0.0)
(-
(+ y (+ (/ (* x z) t) (/ (* y a) t)))
(+ (/ (* x a) t) (/ (* y z) t)))
(if (<= t_1 8.31680306445043e+296)
(-
(+ (* (* x t) (/ 1.0 (- a t))) (+ x (/ (* y z) (- a t))))
(+ (/ (* x z) (- a t)) (/ (* y t) (- a t))))
(fma (- y x) (/ 1.0 (/ (- a t) (- z t))) x))))))double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_1 <= -3.793508615134499e-266) {
tmp = fma((y - x), ((z - t) / (a - t)), x);
} else if (t_1 <= 0.0) {
tmp = (y + (((x * z) / t) + ((y * a) / t))) - (((x * a) / t) + ((y * z) / t));
} else if (t_1 <= 8.31680306445043e+296) {
tmp = (((x * t) * (1.0 / (a - t))) + (x + ((y * z) / (a - t)))) - (((x * z) / (a - t)) + ((y * t) / (a - t)));
} else {
tmp = fma((y - x), (1.0 / ((a - t) / (z - t))), x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 25.0 |
|---|---|
| Target | 9.4 |
| Herbie | 6.8 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -3.79350861513449922e-266Initial program 21.8
Simplified7.6
if -3.79350861513449922e-266 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 58.1
Simplified57.9
Taylor expanded in t around inf 3.0
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 8.3168030644504298e296Initial program 2.2
Simplified3.0
Taylor expanded in y around 0 1.7
Applied div-inv_binary641.7
if 8.3168030644504298e296 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 62.2
Simplified17.2
Applied clear-num_binary6417.3
Final simplification6.8
herbie shell --seed 2021280
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
:herbie-target
(if (< a -1.6153062845442575e-142) (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t)))) (if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t))))))
(+ x (/ (* (- y x) (- z t)) (- a t))))