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 -3.546315921783581 \cdot 10^{-233} \lor \neg \left(x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 0\right):\\
\;\;\;\;x + \frac{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}}{\sqrt[3]{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}} \cdot \frac{t - x}{\sqrt[3]{\sqrt[3]{a - z}}}\\
\mathbf{else}:\\
\;\;\;\;\left(t + \frac{x \cdot y}{z}\right) - \frac{y \cdot t}{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 (or (<= (+ x (/ (* (- y z) (- t x)) (- a z))) -3.546315921783581e-233)
(not (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 0.0)))
(+
x
(*
(/
(/ (- y z) (* (cbrt (- a z)) (cbrt (- a z))))
(cbrt (* (cbrt (- a z)) (cbrt (- a z)))))
(/ (- t x) (cbrt (cbrt (- a z))))))
(- (+ t (/ (* x y) z)) (/ (* y t) 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))) <= -3.546315921783581e-233) || !((x + (((y - z) * (t - x)) / (a - z))) <= 0.0)) {
tmp = x + ((((y - z) / (cbrt(a - z) * cbrt(a - z))) / cbrt(cbrt(a - z) * cbrt(a - z))) * ((t - x) / cbrt(cbrt(a - z))));
} else {
tmp = (t + ((x * y) / z)) - ((y * t) / 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.5 |
|---|---|
| Target | 11.8 |
| Herbie | 9.4 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -3.5463159217835809e-233 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 21.4
rmApplied add-cube-cbrt_binary64_1886821.9
Applied times-frac_binary64_188398.3
rmApplied add-cube-cbrt_binary64_188688.3
Applied cbrt-prod_binary64_188648.4
Applied *-un-lft-identity_binary64_188338.4
Applied times-frac_binary64_188398.4
Applied associate-*r*_binary64_187738.2
Simplified8.2
if -3.5463159217835809e-233 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 54.2
rmApplied add-cube-cbrt_binary64_1886854.3
Applied times-frac_binary64_1883954.7
rmApplied add-cube-cbrt_binary64_1886854.7
Applied cbrt-prod_binary64_1886454.6
Applied *-un-lft-identity_binary64_1883354.6
Applied times-frac_binary64_1883954.7
Applied associate-*r*_binary64_1877353.9
Simplified53.8
Taylor expanded around inf 21.2
Simplified21.2
Final simplification9.4
herbie shell --seed 2020342
(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))))