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 -5.734382662412291 \cdot 10^{-301}:\\
\;\;\;\;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 0:\\
\;\;\;\;t + y \cdot \left(\frac{x}{z} - \frac{t}{z}\right)\\
\mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 6.627278791044968 \cdot 10^{+290}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\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))) -5.734382662412291e-301)
(+ x (* (- y z) (/ (- t x) (- a z))))
(if (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 0.0)
(+ t (* y (- (/ x z) (/ t z))))
(if (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 6.627278791044968e+290)
(+ x (/ (* (- y z) (- t x)) (- a z)))
(+ x (* (- y z) (/ (- t x) (- a z))))))))double code(double x, double y, double z, double t, double a) {
return ((double) (x + (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z)))));
}
double code(double x, double y, double z, double t, double a) {
double VAR;
if ((((double) (x + (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z))))) <= -5.734382662412291e-301)) {
VAR = ((double) (x + ((double) (((double) (y - z)) * (((double) (t - x)) / ((double) (a - z)))))));
} else {
double VAR_1;
if ((((double) (x + (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z))))) <= 0.0)) {
VAR_1 = ((double) (t + ((double) (y * ((double) ((x / z) - (t / z)))))));
} else {
double VAR_2;
if ((((double) (x + (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z))))) <= 6.627278791044968e+290)) {
VAR_2 = ((double) (x + (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z)))));
} else {
VAR_2 = ((double) (x + ((double) (((double) (y - z)) * (((double) (t - x)) / ((double) (a - z)))))));
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 25.3 |
|---|---|
| Target | 11.8 |
| Herbie | 9.7 |
if (+ x (/ (* (- y z) (- t x)) (- a z))) < -5.73438266241229124e-301 or 6.62727879104496755e290 < (+ x (/ (* (- y z) (- t x)) (- a z))) Initial program 32.0
Simplified12.0
if -5.73438266241229124e-301 < (+ x (/ (* (- y z) (- t x)) (- a z))) < 0.0Initial program 61.0
Simplified61.2
Taylor expanded around inf 17.9
Simplified21.0
if 0.0 < (+ x (/ (* (- y z) (- t x)) (- a z))) < 6.62727879104496755e290Initial program 2.2
Final simplification9.7
herbie shell --seed 2020198
(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))))