x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
t_2 := \left(\frac{x \cdot z}{a - z} + \left(x + \frac{y \cdot t}{a - z}\right)\right) - \left(\frac{x \cdot y}{a - z} + \frac{z \cdot t}{a - z}\right)\\
\mathbf{if}\;t_1 \leq -7.051497097212685 \cdot 10^{+302}:\\
\;\;\;\;x + \left(t - x\right) \cdot \frac{y - z}{a - z}\\
\mathbf{elif}\;t_1 \leq -3.6335377602007803 \cdot 10^{-286}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \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{elif}\;t_1 \leq 6.845884325269472 \cdot 10^{+292}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
\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 (+ x (/ (* (- y z) (- t x)) (- a z))))
(t_2
(-
(+ (/ (* x z) (- a z)) (+ x (/ (* y t) (- a z))))
(+ (/ (* x y) (- a z)) (/ (* z t) (- a z))))))
(if (<= t_1 -7.051497097212685e+302)
(+ x (* (- t x) (/ (- y z) (- a z))))
(if (<= t_1 -3.6335377602007803e-286)
t_2
(if (<= t_1 0.0)
(-
(+ (/ (* x y) z) (+ t (/ (* t a) z)))
(+ (/ (* y t) z) (/ (* x a) z)))
(if (<= t_1 6.845884325269472e+292)
t_2
(fma (- y z) (/ (- t x) (- a z)) 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 = x + (((y - z) * (t - x)) / (a - z));
double t_2 = (((x * z) / (a - z)) + (x + ((y * t) / (a - z)))) - (((x * y) / (a - z)) + ((z * t) / (a - z)));
double tmp;
if (t_1 <= -7.051497097212685e+302) {
tmp = x + ((t - x) * ((y - z) / (a - z)));
} else if (t_1 <= -3.6335377602007803e-286) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = (((x * y) / z) + (t + ((t * a) / z))) - (((y * t) / z) + ((x * a) / z));
} else if (t_1 <= 6.845884325269472e+292) {
tmp = t_2;
} else {
tmp = fma((y - z), ((t - x) / (a - z)), 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.5 |
|---|---|
| Target | 11.6 |
| Herbie | 6.1 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -7.0514970972126845e302Initial program 63.0
Simplified15.9
Applied fma-udef_binary6415.9
Taylor expanded in t around 0 16.0
Applied div-inv_binary6416.0
Applied div-inv_binary6416.0
Applied distribute-rgt-out--_binary6416.0
Applied associate-*r*_binary6415.8
Simplified15.8
if -7.0514970972126845e302 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -3.63353776020078032e-286 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 6.8458843252694722e292Initial program 2.0
Simplified7.3
Taylor expanded in y around 0 1.7
if -3.63353776020078032e-286 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 60.3
Simplified60.2
Taylor expanded in z around inf 1.4
if 6.8458843252694722e292 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 61.4
Simplified18.6
Applied div-inv_binary6418.6
Applied pow1_binary6418.6
Applied pow1_binary6418.6
Applied pow-prod-down_binary6418.6
Simplified18.6
Final simplification6.1
herbie shell --seed 2022125
(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))))