x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\begin{array}{l}
\mathbf{if}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq -\infty \lor \neg \left(x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 1.8204180766521856 \cdot 10^{+304}\right):\\
\;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{y \cdot t}{a - z} + \left(x + \frac{x \cdot z}{a - z}\right)\right) - \left(\frac{x \cdot y}{a - z} + \frac{z \cdot t}{a - z}\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
(if (or (<= (+ x (/ (* (- y z) (- t x)) (- a z))) (- INFINITY))
(not
(<= (+ x (/ (* (- y z) (- t x)) (- a z))) 1.8204180766521856e+304)))
(+ x (/ (- y z) (/ (- a z) (- t x))))
(-
(+ (/ (* y t) (- a z)) (+ x (/ (* x z) (- a z))))
(+ (/ (* x y) (- a z)) (/ (* z t) (- a z))))))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 tmp;
if (((x + (((y - z) * (t - x)) / (a - z))) <= -((double) INFINITY)) || !((x + (((y - z) * (t - x)) / (a - z))) <= 1.8204180766521856e+304)) {
tmp = x + ((y - z) / ((a - z) / (t - x)));
} else {
tmp = (((y * t) / (a - z)) + (x + ((x * z) / (a - z)))) - (((x * y) / (a - z)) + ((z * t) / (a - z)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 24.4 |
|---|---|
| Target | 11.7 |
| Herbie | 7.6 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0 or 1.8204180766521856e304 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 63.6
rmApplied associate-/l*_binary64_1536817.5
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.8204180766521856e304Initial program 8.6
Taylor expanded around 0 3.6
Final simplification7.6
herbie shell --seed 2021043
(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))))