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, \frac{t - x}{a - z}, x\right)\\
\mathbf{elif}\;t_1 \leq 4.9396523078697755 \cdot 10^{+287}:\\
\;\;\;\;\left(\frac{x \cdot z}{a - z} + \left(x + \frac{y \cdot t}{a - z}\right)\right) - \left(\frac{1}{\frac{a - z}{x \cdot y}} + \frac{z \cdot t}{a - z}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{1}{\frac{a - z}{t - x}}, 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)))))
(if (<= t_1 (- INFINITY))
(fma (- y z) (/ (- t x) (- a z)) x)
(if (<= t_1 4.9396523078697755e+287)
(-
(+ (/ (* x z) (- a z)) (+ x (/ (* y t) (- a z))))
(+ (/ 1.0 (/ (- a z) (* x y))) (/ (* z t) (- a z))))
(fma (- y z) (/ 1.0 (/ (- a z) (- t x))) 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) / (a - z)), x);
} else if (t_1 <= 4.9396523078697755e+287) {
tmp = (((x * z) / (a - z)) + (x + ((y * t) / (a - z)))) - ((1.0 / ((a - z) / (x * y))) + ((z * t) / (a - z)));
} else {
tmp = fma((y - z), (1.0 / ((a - z) / (t - x))), 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 | 11.8 |
| Herbie | 7.7 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0Initial program 64.0
Simplified18.5
Applied add-cube-cbrt_binary6419.2
Applied pow1/3_binary6459.6
Applied pow1/3_binary6459.6
Applied pow1/3_binary6459.7
Applied pow-sqr_binary6459.7
Applied pow-prod-up_binary6418.5
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 4.9396523078697755e287Initial program 9.0
Simplified13.8
Taylor expanded in y around 0 3.5
Applied clear-num_binary643.5
Simplified3.5
if 4.9396523078697755e287 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 59.2
Simplified16.8
Applied clear-num_binary6416.9
Final simplification7.7
herbie shell --seed 2022068
(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))))