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{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := \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{if}\;t_1 \leq -7.228751941855603 \cdot 10^{-255}:\\
\;\;\;\;t_2\\
\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.2600881304745364 \cdot 10^{+198}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \left(t - x\right) \cdot \frac{1}{a - z}, 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))))
(let* ((t_2
(-
(+ (/ (* x z) (- a z)) (+ x (/ (* y t) (- a z))))
(+ (/ (* x y) (- a z)) (/ (* z t) (- a z))))))
(if (<= t_1 -7.228751941855603e-255)
t_2
(if (<= t_1 0.0)
(-
(+ (/ (* x y) z) (+ t (/ (* t a) z)))
(+ (/ (* y t) z) (/ (* x a) z)))
(if (<= t_1 1.2600881304745364e+198)
t_2
(fma (- y z) (* (- t x) (/ 1.0 (- a z))) 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 {
double t_2 = (((x * z) / (a - z)) + (x + ((y * t) / (a - z)))) - (((x * y) / (a - z)) + ((z * t) / (a - z)));
double tmp_1;
if (t_1 <= -7.228751941855603e-255) {
tmp_1 = t_2;
} else if (t_1 <= 0.0) {
tmp_1 = (((x * y) / z) + (t + ((t * a) / z))) - (((y * t) / z) + ((x * a) / z));
} else if (t_1 <= 1.2600881304745364e+198) {
tmp_1 = t_2;
} else {
tmp_1 = fma((y - z), ((t - x) * (1.0 / (a - z))), x);
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 24.7 |
|---|---|
| Target | 12.3 |
| Herbie | 7.9 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0Initial program 64.0
Simplified17.1
Taylor expanded in t around inf 23.3
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -7.22875194185560306e-255 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.2600881304745364e198Initial program 2.1
Simplified7.3
Taylor expanded in y around 0 1.6
if -7.22875194185560306e-255 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 57.3
Simplified57.5
Taylor expanded in z around inf 3.8
if 1.2600881304745364e198 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 45.8
Simplified16.7
Applied div-inv_binary6416.8
Final simplification7.9
herbie shell --seed 2022077
(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))))