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:\\
\;\;\;\;t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)\\
\mathbf{elif}\;t_1 \leq -1.287452769475077 \cdot 10^{-279}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\left(\frac{x \cdot y}{z} + \left(t + \frac{t \cdot a}{z}\right)\right) - \left(\frac{y \cdot t}{z} + \frac{x \cdot a}{z}\right)\\
\mathbf{elif}\;t_1 \leq 1.803155012693992 \cdot 10^{+257}:\\
\;\;\;\;\left(\frac{x \cdot z}{a - z} + \left(x + \frac{y \cdot t}{a - z}\right)\right) - \left(\frac{x \cdot y}{a - z} + \frac{z \cdot t}{a - z}\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := \frac{a - z}{t - x}\\
\frac{y}{t_2} - \left(\frac{z}{t_2} - x\right)
\end{array}\\
\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))
(* t (- (/ y (- a z)) (/ z (- a z))))
(if (<= t_1 -1.287452769475077e-279)
t_1
(if (<= t_1 0.0)
(-
(+ (/ (* x y) z) (+ t (/ (* t a) z)))
(+ (/ (* y t) z) (/ (* x a) z)))
(if (<= t_1 1.803155012693992e+257)
(-
(+ (/ (* x z) (- a z)) (+ x (/ (* y t) (- a z))))
(+ (/ (* x y) (- a z)) (/ (* z t) (- a z))))
(let* ((t_2 (/ (- a z) (- t x))))
(- (/ y t_2) (- (/ z t_2) 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 = t * ((y / (a - z)) - (z / (a - z)));
} else if (t_1 <= -1.287452769475077e-279) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (((x * y) / z) + (t + ((t * a) / z))) - (((y * t) / z) + ((x * a) / z));
} else if (t_1 <= 1.803155012693992e+257) {
tmp = (((x * z) / (a - z)) + (x + ((y * t) / (a - z)))) - (((x * y) / (a - z)) + ((z * t) / (a - z)));
} else {
double t_2 = (a - z) / (t - x);
tmp = (y / t_2) - ((z / t_2) - 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.0 |
|---|---|
| Target | 11.6 |
| Herbie | 7.3 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0Initial program 64.0
Simplified18.0
Taylor expanded in t around inf 26.6
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -1.28745276947507699e-279Initial program 1.9
if -1.28745276947507699e-279 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 59.6
Simplified59.1
Taylor expanded in z around inf 2.2
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.80315501269399187e257Initial program 2.1
Simplified6.6
Taylor expanded in y around 0 1.6
if 1.80315501269399187e257 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 54.6
Simplified18.2
Applied clear-num_binary6418.2
Applied fma-udef_binary6418.3
Simplified18.0
Applied div-sub_binary6418.0
Applied associate-+l-_binary6414.0
Final simplification7.3
herbie shell --seed 2021313
(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))))