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.4950216683206405 \cdot 10^{-300}:\\
\;\;\;\;x + \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) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \sqrt[3]{\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{else}:\\
\;\;\;\;x + \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \left(\left(y - z\right) \cdot \left(\frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)\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.4950216683206405e-300)
(+
x
(*
(*
(/ (cbrt (- t x)) (cbrt (- a z)))
(* (- y z) (/ (cbrt (- t x)) (cbrt (- a z)))))
(/
(cbrt (- t x))
(* (cbrt (* (cbrt (- a z)) (cbrt (- a z)))) (cbrt (cbrt (- a z)))))))
(if (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 0.0)
(+ t (* y (- (/ x z) (/ t z))))
(+
x
(*
(/ (cbrt (- t x)) (cbrt (- a z)))
(*
(- y z)
(*
(/ (cbrt (- t x)) (cbrt (- a z)))
(/ (cbrt (- t x)) (cbrt (- a z))))))))))double code(double x, double y, double z, double t, double a) {
return ((double) (x + (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z)))));
}
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((((double) (x + (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z))))) <= -1.4950216683206405e-300)) {
tmp = ((double) (x + ((double) (((double) ((((double) cbrt(((double) (t - x)))) / ((double) cbrt(((double) (a - z))))) * ((double) (((double) (y - z)) * (((double) cbrt(((double) (t - x)))) / ((double) cbrt(((double) (a - z))))))))) * (((double) cbrt(((double) (t - x)))) / ((double) (((double) cbrt(((double) (((double) cbrt(((double) (a - z)))) * ((double) cbrt(((double) (a - z)))))))) * ((double) cbrt(((double) cbrt(((double) (a - z)))))))))))));
} else {
double tmp_1;
if ((((double) (x + (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z))))) <= 0.0)) {
tmp_1 = ((double) (t + ((double) (y * ((double) ((x / z) - (t / z)))))));
} else {
tmp_1 = ((double) (x + ((double) ((((double) cbrt(((double) (t - x)))) / ((double) cbrt(((double) (a - z))))) * ((double) (((double) (y - z)) * ((double) ((((double) cbrt(((double) (t - x)))) / ((double) cbrt(((double) (a - z))))) * (((double) cbrt(((double) (t - x)))) / ((double) cbrt(((double) (a - z)))))))))))));
}
tmp = tmp_1;
}
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.4 |
|---|---|
| Target | 11.9 |
| Herbie | 8.7 |
if (+ x (/ (* (- y z) (- t x)) (- a z))) < -1.4950216683206405e-300Initial program Error: 20.7 bits
SimplifiedError: 10.7 bits
rmApplied add-cube-cbrtError: 11.3 bits
Applied add-cube-cbrtError: 11.5 bits
Applied times-fracError: 11.5 bits
Applied associate-*r*Error: 7.8 bits
SimplifiedError: 7.8 bits
rmApplied add-cube-cbrtError: 7.8 bits
Applied cbrt-prodError: 7.8 bits
rmApplied associate-*r*Error: 7.4 bits
if -1.4950216683206405e-300 < (+ x (/ (* (- y z) (- t x)) (- a z))) < 0.0Initial program Error: 61.0 bits
SimplifiedError: 61.2 bits
Taylor expanded around inf Error: 18.2 bits
SimplifiedError: 20.4 bits
if 0.0 < (+ x (/ (* (- y z) (- t x)) (- a z))) Initial program Error: 21.1 bits
SimplifiedError: 10.8 bits
rmApplied add-cube-cbrtError: 11.5 bits
Applied add-cube-cbrtError: 11.6 bits
Applied times-fracError: 11.6 bits
Applied associate-*r*Error: 7.8 bits
SimplifiedError: 7.8 bits
Final simplificationError: 8.7 bits
herbie shell --seed 2020203
(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))))