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 -8.022473410819845 \cdot 10^{-287} \lor \neg \left(x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 0\right):\\
\;\;\;\;x + \left(\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \left(\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}\right)\right) \cdot \frac{\sqrt[3]{t - x}}{\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))) -8.022473410819845e-287)
(not (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 0.0)))
(+
x
(*
(*
(/ (- y z) (* (cbrt (- a z)) (cbrt (- a z))))
(* (cbrt (- t x)) (cbrt (- t x))))
(/ (cbrt (- t x)) (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))) <= -8.022473410819845e-287) || !((x + (((y - z) * (t - x)) / (a - z))) <= 0.0)) {
tmp = x + ((((y - z) / (cbrt(a - z) * cbrt(a - z))) * (cbrt(t - x) * cbrt(t - x))) * (cbrt(t - x) / 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.3 |
|---|---|
| Target | 12.5 |
| Herbie | 8.8 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -8.0224734108198446e-287 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 20.9
rmApplied add-cube-cbrt_binary64_1697021.4
Applied times-frac_binary64_169418.4
rmApplied *-un-lft-identity_binary64_169358.4
Applied add-cube-cbrt_binary64_169708.6
Applied times-frac_binary64_169418.6
Applied associate-*r*_binary64_168757.8
Simplified7.8
if -8.0224734108198446e-287 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 60.5
rmApplied add-cube-cbrt_binary64_1697060.4
Applied times-frac_binary64_1694160.4
rmApplied add-cube-cbrt_binary64_1697060.4
Applied *-un-lft-identity_binary64_1693560.4
Applied times-frac_binary64_1694160.4
Applied associate-*r*_binary64_1687560.4
Simplified60.4
Taylor expanded around inf 19.2
Simplified19.2
Final simplification8.8
herbie shell --seed 2020280
(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))))