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:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq -2.1810124009229863 \cdot 10^{-200}:\\
\;\;\;\;x + \left(\left(y - z\right) \cdot \left(t - x\right)\right) \cdot \frac{1}{a - z}\\
\mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 0:\\
\;\;\;\;\left(t + \frac{x \cdot y}{z}\right) - \frac{y \cdot t}{z}\\
\mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 3.6456281701934235 \cdot 10^{+264}:\\
\;\;\;\;x + \left(\left(y - z\right) \cdot \left(t - x\right)\right) \cdot \frac{1}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - z}{\left(a - z\right) \cdot \frac{1}{t - x}}\\
\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 (<= (+ x (/ (* (- y z) (- t x)) (- a z))) (- INFINITY))
(+ x (* (- y z) (/ (- t x) (- a z))))
(if (<= (+ x (/ (* (- y z) (- t x)) (- a z))) -2.1810124009229863e-200)
(+ x (* (* (- y z) (- t x)) (/ 1.0 (- a z))))
(if (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 0.0)
(- (+ t (/ (* x y) z)) (/ (* y t) z))
(if (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 3.6456281701934235e+264)
(+ x (* (* (- y z) (- t x)) (/ 1.0 (- a z))))
(+ x (/ (- y z) (* (- a z) (/ 1.0 (- t 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 tmp;
if ((x + (((y - z) * (t - x)) / (a - z))) <= -((double) INFINITY)) {
tmp = x + ((y - z) * ((t - x) / (a - z)));
} else if ((x + (((y - z) * (t - x)) / (a - z))) <= -2.1810124009229863e-200) {
tmp = x + (((y - z) * (t - x)) * (1.0 / (a - z)));
} else if ((x + (((y - z) * (t - x)) / (a - z))) <= 0.0) {
tmp = (t + ((x * y) / z)) - ((y * t) / z);
} else if ((x + (((y - z) * (t - x)) / (a - z))) <= 3.6456281701934235e+264) {
tmp = x + (((y - z) * (t - x)) * (1.0 / (a - z)));
} else {
tmp = x + ((y - z) / ((a - z) * (1.0 / (t - x))));
}
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.5 |
|---|---|
| Target | 11.8 |
| Herbie | 8.3 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0Initial program 64.0
rmApplied *-un-lft-identity_binary6464.0
Applied times-frac_binary6415.3
Simplified15.3
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -2.1810124009229863e-200 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 3.64562817019342346e264Initial program 1.9
rmApplied div-inv_binary642.0
if -2.1810124009229863e-200 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 50.8
rmApplied associate-/l*_binary6453.1
Taylor expanded around inf 24.1
Simplified24.1
if 3.64562817019342346e264 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 57.1
rmApplied associate-/l*_binary6416.0
rmApplied div-inv_binary6416.1
Final simplification8.3
herbie shell --seed 2020220
(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))))