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 -1.2635250176906057 \cdot 10^{-246}:\\
\;\;\;\;x + \frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{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 5.045411824196673 \cdot 10^{+299}:\\
\;\;\;\;x + \left(\left(y - z\right) \cdot \left(t - x\right)\right) \cdot \frac{1}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot \left(\left(t - x\right) \cdot \frac{1}{a - 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))) -1.2635250176906057e-246)
(+
x
(*
(/ (- y z) (* (cbrt (- a z)) (cbrt (- a z))))
(/ (- t x) (cbrt (- 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))) 5.045411824196673e+299)
(+ x (* (* (- y z) (- t x)) (/ 1.0 (- a z))))
(+ x (* (- y z) (* (- t x) (/ 1.0 (- a 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))) <= -1.2635250176906057e-246) {
tmp = x + (((y - z) / (cbrt(a - z) * cbrt(a - z))) * ((t - x) / cbrt(a - z)));
} else if ((x + (((y - z) * (t - x)) / (a - z))) <= 0.0) {
tmp = t + (y * ((x / z) - (t / z)));
} else if ((x + (((y - z) * (t - x)) / (a - z))) <= 5.045411824196673e+299) {
tmp = x + (((y - z) * (t - x)) * (1.0 / (a - z)));
} else {
tmp = x + ((y - z) * ((t - x) * (1.0 / (a - 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.9 |
| Herbie | 9.2 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -1.263525017690606e-246Initial program 22.3
rmApplied add-cube-cbrt_binary6422.8
Applied times-frac_binary648.7
if -1.263525017690606e-246 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 57.1
Taylor expanded around inf 21.3
Simplified24.0
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 5.0454118241966733e299Initial program 2.0
rmApplied div-inv_binary642.1
if 5.0454118241966733e299 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 62.3
rmApplied *-un-lft-identity_binary6462.3
Applied times-frac_binary6417.1
Simplified17.1
rmApplied div-inv_binary6417.2
Final simplification9.2
herbie shell --seed 2020224
(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))))