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 -4.7882633144150225 \cdot 10^{-279} \lor \neg \left(x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 0\right) \land x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 1.1897674420967624 \cdot 10^{+306}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot \left(\frac{x}{z} - \frac{t}{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 (<= (+ x (/ (* (- y z) (- t x)) (- a z))) (- INFINITY))
(+ x (* (- y z) (/ (- t x) (- a z))))
(if (or (<= (+ x (/ (* (- y z) (- t x)) (- a z))) -4.7882633144150225e-279)
(and (not (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 0.0))
(<=
(+ x (/ (* (- y z) (- t x)) (- a z)))
1.1897674420967624e+306)))
(+ x (/ (* (- y z) (- t x)) (- a z)))
(+ t (* y (- (/ x z) (/ t 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)) {
tmp = x + ((y - z) * ((t - x) / (a - z)));
} else if (((x + (((y - z) * (t - x)) / (a - z))) <= -4.7882633144150225e-279) || (!((x + (((y - z) * (t - x)) / (a - z))) <= 0.0) && ((x + (((y - z) * (t - x)) / (a - z))) <= 1.1897674420967624e+306))) {
tmp = x + (((y - z) * (t - x)) / (a - z));
} else {
tmp = t + (y * ((x / z) - (t / 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.7 |
|---|---|
| Target | 11.4 |
| Herbie | 9.4 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0Initial program 64.0
rmApplied *-un-lft-identity_binary64_1678764.0
Applied times-frac_binary64_1679318.3
Simplified18.3
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -4.7882633144150225e-279 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.1897674420967624e306Initial program 1.9
if -4.7882633144150225e-279 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0 or 1.1897674420967624e306 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 61.9
Taylor expanded around inf 32.2
Simplified24.2
Final simplification9.4
herbie shell --seed 2020355
(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))))