x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
t_1 := \sqrt[3]{z - t}\\
t_2 := \sqrt[3]{a - t}\\
t_3 := \frac{t_1}{t_2}\\
t_4 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
t_5 := \left(y - x\right) \cdot \frac{t_1 \cdot t_1}{t_2 \cdot t_2}\\
\mathbf{if}\;t_4 \leq -7.683945489347265 \cdot 10^{-283}:\\
\;\;\;\;\mathsf{fma}\left(t_5, t_3, x\right)\\
\mathbf{elif}\;t_4 \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{else}:\\
\;\;\;\;x + t_5 \cdot t_3\\
\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 (cbrt (- z t)))
(t_2 (cbrt (- a t)))
(t_3 (/ t_1 t_2))
(t_4 (+ x (/ (* (- y x) (- z t)) (- a t))))
(t_5 (* (- y x) (/ (* t_1 t_1) (* t_2 t_2)))))
(if (<= t_4 -7.683945489347265e-283)
(fma t_5 t_3 x)
(if (<= t_4 0.0)
(-
(+ y (+ (/ (* x z) t) (/ (* y a) t)))
(+ (/ (* x a) t) (/ (* y z) t)))
(+ x (* t_5 t_3))))))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 = cbrt(z - t);
double t_2 = cbrt(a - t);
double t_3 = t_1 / t_2;
double t_4 = x + (((y - x) * (z - t)) / (a - t));
double t_5 = (y - x) * ((t_1 * t_1) / (t_2 * t_2));
double tmp;
if (t_4 <= -7.683945489347265e-283) {
tmp = fma(t_5, t_3, x);
} else if (t_4 <= 0.0) {
tmp = (y + (((x * z) / t) + ((y * a) / t))) - (((x * a) / t) + ((y * z) / t));
} else {
tmp = x + (t_5 * t_3);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 24.5 |
|---|---|
| Target | 9.7 |
| Herbie | 6.7 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -7.6839454893472649e-283Initial program 20.7
Simplified7.2
Applied fma-udef_binary647.2
Applied add-cube-cbrt_binary647.9
Applied add-cube-cbrt_binary647.8
Applied times-frac_binary647.7
Applied associate-*r*_binary647.1
Applied fma-def_binary647.1
if -7.6839454893472649e-283 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 59.8
Simplified59.6
Taylor expanded in t around inf 1.8
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 21.6
Simplified7.3
Applied fma-udef_binary647.3
Applied add-cube-cbrt_binary648.1
Applied add-cube-cbrt_binary647.9
Applied times-frac_binary647.9
Applied associate-*r*_binary647.1
Final simplification6.7
herbie shell --seed 2021307
(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))))