x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
t_1 := \sqrt[3]{y - z}\\
t_2 := t_1 \cdot t_1\\
t_3 := \sqrt[3]{a - z}\\
t_4 := t_3 \cdot t_3\\
t_5 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t_5 \leq -8.939814919119468 \cdot 10^{-296}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t_2}{t_4}, \frac{t_1}{\frac{t_3}{t - x}}, x\right)\\
\mathbf{elif}\;t_5 \leq 0:\\
\;\;\;\;\left(\frac{x \cdot y}{z} + \left(t + \frac{t \cdot a}{z}\right)\right) - \left(\frac{y \cdot t}{z} + \frac{x \cdot a}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_6 := \sqrt[3]{t - x}\\
\mathsf{fma}\left(\frac{t_2}{\frac{t_4}{t_6 \cdot t_6}}, \frac{t_1}{\frac{t_3}{t_6}}, x\right)
\end{array}\\
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (cbrt (- y z)))
(t_2 (* t_1 t_1))
(t_3 (cbrt (- a z)))
(t_4 (* t_3 t_3))
(t_5 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_5 -8.939814919119468e-296)
(fma (/ t_2 t_4) (/ t_1 (/ t_3 (- t x))) x)
(if (<= t_5 0.0)
(-
(+ (/ (* x y) z) (+ t (/ (* t a) z)))
(+ (/ (* y t) z) (/ (* x a) z)))
(let* ((t_6 (cbrt (- t x))))
(fma (/ t_2 (/ t_4 (* t_6 t_6))) (/ t_1 (/ t_3 t_6)) x))))))double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
double code(double x, double y, double z, double t, double a) {
double t_1 = cbrt(y - z);
double t_2 = t_1 * t_1;
double t_3 = cbrt(a - z);
double t_4 = t_3 * t_3;
double t_5 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_5 <= -8.939814919119468e-296) {
tmp = fma((t_2 / t_4), (t_1 / (t_3 / (t - x))), x);
} else if (t_5 <= 0.0) {
tmp = (((x * y) / z) + (t + ((t * a) / z))) - (((y * t) / z) + ((x * a) / z));
} else {
double t_6 = cbrt(t - x);
tmp = fma((t_2 / (t_4 / (t_6 * t_6))), (t_1 / (t_3 / t_6)), 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.1 |
|---|---|
| Target | 11.8 |
| Herbie | 7.1 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -8.9398149191194679e-296Initial program 21.7
Simplified10.4
Applied clear-num_binary6410.6
Applied fma-udef_binary6410.6
Simplified10.3
Applied *-un-lft-identity_binary6410.3
Applied add-cube-cbrt_binary6410.9
Applied times-frac_binary6410.9
Applied add-cube-cbrt_binary6410.9
Applied times-frac_binary647.6
Applied fma-def_binary647.6
if -8.9398149191194679e-296 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 60.4
Simplified60.2
Taylor expanded in z around inf 1.2
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 22.0
Simplified10.4
Applied clear-num_binary6410.7
Applied fma-udef_binary6410.7
Simplified10.4
Applied add-cube-cbrt_binary6411.1
Applied add-cube-cbrt_binary6411.2
Applied times-frac_binary6411.2
Applied add-cube-cbrt_binary6411.3
Applied times-frac_binary647.7
Applied fma-def_binary647.7
Final simplification7.1
herbie shell --seed 2022063
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
:precision binary64
:herbie-target
(if (< z -1.2536131056095036e+188) (- t (* (/ y z) (- t x))) (if (< z 4.446702369113811e+64) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x)))))
(+ x (/ (* (- y z) (- t x)) (- a z))))