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}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(y - z, \left(t - x\right) \cdot \frac{1}{a - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
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.345919926625244 \cdot 10^{-259}:\\
\;\;\;\;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 3.603813206607207 \cdot 10^{+289}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, {\left(\frac{a - z}{t - x}\right)}^{-1}, 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 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_1 (- INFINITY))
(fma (- y z) (* (- t x) (/ 1.0 (- a z))) x)
(let* ((t_2
(-
(+ (/ (* x z) (- a z)) (+ x (/ (* y t) (- a z))))
(+ (/ (* x y) (- a z)) (/ (* z t) (- a z))))))
(if (<= t_1 -7.345919926625244e-259)
t_2
(if (<= t_1 0.0)
(-
(+ (/ (* x y) z) (+ t (/ (* t a) z)))
(+ (/ (* y t) z) (/ (* x a) z)))
(if (<= t_1 3.603813206607207e+289)
t_2
(fma (- y z) (pow (/ (- a z) (- t x)) -1.0) 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 tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma((y - z), ((t - x) * (1.0 / (a - z))), x);
} else {
double t_2 = (((x * z) / (a - z)) + (x + ((y * t) / (a - z)))) - (((x * y) / (a - z)) + ((z * t) / (a - z)));
double tmp_1;
if (t_1 <= -7.345919926625244e-259) {
tmp_1 = t_2;
} else if (t_1 <= 0.0) {
tmp_1 = (((x * y) / z) + (t + ((t * a) / z))) - (((y * t) / z) + ((x * a) / z));
} else if (t_1 <= 3.603813206607207e+289) {
tmp_1 = t_2;
} else {
tmp_1 = fma((y - z), pow(((a - z) / (t - x)), -1.0), x);
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 24.4 |
|---|---|
| Target | 11.6 |
| Herbie | 6.8 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0Initial program 64.0
Simplified16.6
Applied clear-num_binary6416.7
Applied inv-pow_binary6416.7
Applied unpow-1_binary6416.7
Applied associate-/r/_binary6416.7
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -7.3459199266252436e-259 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 3.6038132066072071e289Initial program 2.3
Simplified7.5
Taylor expanded in y around 0 1.9
if -7.3459199266252436e-259 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 56.5
Simplified57.0
Taylor expanded in z around inf 4.6
if 3.6038132066072071e289 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 60.4
Simplified18.9
Applied clear-num_binary6418.9
Applied inv-pow_binary6418.9
Final simplification6.8
herbie shell --seed 2021215
(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))))