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 -7.060522025531588 \cdot 10^{+91}:\\
\;\;\;\;\mathsf{fma}\left(y - x, z \cdot \frac{1}{a - t} - \frac{t}{a - t}, x\right)\\
\mathbf{elif}\;t_1 \leq 8.503413815527983 \cdot 10^{+303}:\\
\;\;\;\;\left(\frac{x \cdot t}{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{z}{a - t} - \frac{1}{\frac{a}{t} + -1}, 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 -7.060522025531588e+91)
(fma (- y x) (- (* z (/ 1.0 (- a t))) (/ t (- a t))) x)
(if (<= t_1 8.503413815527983e+303)
(-
(+ (/ (* x t) (- a t)) (+ x (/ (* y z) (- a t))))
(+ (/ (* x z) (- a t)) (/ (* y t) (- a t))))
(fma (- y x) (- (/ z (- a t)) (/ 1.0 (+ (/ a t) -1.0))) 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 <= -7.060522025531588e+91) {
tmp = fma((y - x), ((z * (1.0 / (a - t))) - (t / (a - t))), x);
} else if (t_1 <= 8.503413815527983e+303) {
tmp = (((x * t) / (a - t)) + (x + ((y * z) / (a - t)))) - (((x * z) / (a - t)) + ((y * t) / (a - t)));
} else {
tmp = fma((y - x), ((z / (a - t)) - (1.0 / ((a / t) + -1.0))), x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 24.7 |
|---|---|
| Target | 9.5 |
| Herbie | 7.9 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -7.0605220255315882e91Initial program 34.4
Simplified10.4
Applied add-cube-cbrt_binary6410.8
Taylor expanded in z around 0 10.4
Applied div-inv_binary6410.4
if -7.0605220255315882e91 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 8.5034138155279834e303Initial program 10.4
Simplified10.9
Taylor expanded in y around 0 4.3
if 8.5034138155279834e303 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 63.6
Simplified17.5
Applied add-cube-cbrt_binary6417.9
Taylor expanded in z around 0 17.5
Applied clear-num_binary6417.5
Simplified17.5
Final simplification7.9
herbie shell --seed 2022125
(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))))