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 -4.10442963889481 \cdot 10^{-200} \lor \neg \left(x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 0\right):\\
\;\;\;\;x + \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \left(\frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \left(\left(y - z\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{y}{z} \cdot \left(x - t\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 (or (<= (+ x (/ (* (- y z) (- t x)) (- a z))) -4.10442963889481e-200)
(not (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 0.0)))
(+
x
(*
(/ (cbrt (- t x)) (cbrt (- a z)))
(*
(/ (cbrt (- t x)) (cbrt (- a z)))
(* (- y z) (/ (cbrt (- t x)) (cbrt (- a z)))))))
(+ t (* (/ y z) (- x t)))))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))) <= -4.10442963889481e-200) || !((x + (((y - z) * (t - x)) / (a - z))) <= 0.0)) {
tmp = x + ((cbrt(t - x) / cbrt(a - z)) * ((cbrt(t - x) / cbrt(a - z)) * ((y - z) * (cbrt(t - x) / cbrt(a - z)))));
} else {
tmp = t + ((y / z) * (x - t));
}
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.6 |
|---|---|
| Target | 11.8 |
| Herbie | 9.3 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -4.1044296388948098e-200 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 21.7
rmApplied *-un-lft-identity_binary64_1322021.7
Applied times-frac_binary64_1322610.6
Simplified10.6
rmApplied add-cube-cbrt_binary64_1325211.2
Applied add-cube-cbrt_binary64_1325211.4
Applied times-frac_binary64_1322611.4
Applied associate-*r*_binary64_131628.0
rmApplied times-frac_binary64_132268.0
Applied associate-*r*_binary64_131627.7
if -4.1044296388948098e-200 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 50.2
rmApplied *-un-lft-identity_binary64_1322050.2
Applied times-frac_binary64_1322652.4
Simplified52.4
rmApplied add-cube-cbrt_binary64_1325252.2
Applied add-cube-cbrt_binary64_1325252.3
Applied times-frac_binary64_1322652.3
Applied associate-*r*_binary64_1316250.4
rmApplied times-frac_binary64_1322650.4
Applied associate-*r*_binary64_1316249.5
Taylor expanded around inf 23.3
Simplified23.2
Final simplification9.3
herbie shell --seed 2020292
(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))))