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 -2.4909642387543203 \cdot 10^{-274} \lor \neg \left(x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 0\right):\\
\;\;\;\;x + \left(\left(y - z\right) \cdot \frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\\
\mathbf{else}:\\
\;\;\;\;\left(t + \left(\frac{x \cdot y}{z} + \frac{t \cdot a}{z}\right)\right) - \left(\frac{x \cdot a}{z} + \frac{y \cdot t}{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 (or (<= (+ x (/ (* (- y z) (- t x)) (- a z))) -2.4909642387543203e-274)
(not (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 0.0)))
(+
x
(*
(*
(- y z)
(/ (* (cbrt (- t x)) (cbrt (- t x))) (* (cbrt (- a z)) (cbrt (- a z)))))
(/ (cbrt (- t x)) (cbrt (- a z)))))
(- (+ t (+ (/ (* x y) z) (/ (* t a) z))) (+ (/ (* x a) 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))) <= -2.4909642387543203e-274) || !((x + (((y - z) * (t - x)) / (a - z))) <= 0.0)) {
tmp = x + (((y - z) * ((cbrt(t - x) * cbrt(t - x)) / (cbrt(a - z) * cbrt(a - z)))) * (cbrt(t - x) / cbrt(a - z)));
} else {
tmp = (t + (((x * y) / z) + ((t * a) / z))) - (((x * a) / 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.9 |
|---|---|
| Target | 12.0 |
| Herbie | 7.3 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -2.4909642387543203e-274 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 21.7
rmApplied *-un-lft-identity_binary6421.7
Applied times-frac_binary6410.3
Simplified10.3
rmApplied add-cube-cbrt_binary6410.9
Applied add-cube-cbrt_binary6411.0
Applied times-frac_binary6411.0
Applied associate-*r*_binary647.7
if -2.4909642387543203e-274 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 58.5
Taylor expanded around inf 2.7
Simplified2.7
Final simplification7.3
herbie shell --seed 2021118
(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))))