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.1842801532370239 \cdot 10^{+274}:\\
\;\;\;\;\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}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\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
(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.1842801532370239e+274)
(-
(+ (/ (* x z) (- a z)) (+ x (/ (* y t) (- a z))))
(+ (/ (* x y) (- a z)) (/ (* z t) (- a z))))
(fma (- y z) (/ (- t x) (- 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 if (t_1 <= 1.1842801532370239e+274) {
tmp = (((x * z) / (a - z)) + (x + ((y * t) / (a - z)))) - (((x * y) / (a - z)) + ((z * t) / (a - z)));
} else {
tmp = fma((y - z), ((t - x) / (a - z)), x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 25.0 |
|---|---|
| Target | 11.7 |
| Herbie | 9.0 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0Initial program 64.0
Simplified16.7
Taylor expanded in t around inf 26.0
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.18428015323702387e274Initial program 9.1
Simplified13.8
Taylor expanded in y around 0 3.7
if 1.18428015323702387e274 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 58.2
Simplified16.2
Applied *-un-lft-identity_binary6416.2
Applied associate-/r*_binary6416.2
Final simplification9.0
herbie shell --seed 2022081
(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))))