x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\begin{array}{l}
\mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \leq -3.628654004135568 \cdot 10^{-240}:\\
\;\;\;\;\sqrt[3]{\frac{y}{z}} \cdot \left(x \cdot \left(\sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{\frac{y}{z}}\right)\right) + x \cdot \frac{t}{z - 1}\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \leq 2.797145385757385 \cdot 10^{-201}:\\
\;\;\;\;\frac{x}{z} \cdot \left(t + \left(y + \frac{t}{z}\right)\right)\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \leq 1.347321449727839 \cdot 10^{+117}:\\
\;\;\;\;\sqrt[3]{\frac{y}{z}} \cdot \left(x \cdot \left(\sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{\frac{y}{z}}\right)\right) + x \cdot \frac{t}{z - 1}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z - 1} + \frac{y \cdot x}{z}\\
\end{array}(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
(FPCore (x y z t)
:precision binary64
(if (<= (- (/ y z) (/ t (- 1.0 z))) -3.628654004135568e-240)
(+
(* (cbrt (/ y z)) (* x (* (cbrt (/ y z)) (cbrt (/ y z)))))
(* x (/ t (- z 1.0))))
(if (<= (- (/ y z) (/ t (- 1.0 z))) 2.797145385757385e-201)
(* (/ x z) (+ t (+ y (/ t z))))
(if (<= (- (/ y z) (/ t (- 1.0 z))) 1.347321449727839e+117)
(+
(* (cbrt (/ y z)) (* x (* (cbrt (/ y z)) (cbrt (/ y z)))))
(* x (/ t (- z 1.0))))
(+ (* x (/ t (- z 1.0))) (/ (* y x) z))))))double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
double code(double x, double y, double z, double t) {
double tmp;
if (((y / z) - (t / (1.0 - z))) <= -3.628654004135568e-240) {
tmp = (cbrt(y / z) * (x * (cbrt(y / z) * cbrt(y / z)))) + (x * (t / (z - 1.0)));
} else if (((y / z) - (t / (1.0 - z))) <= 2.797145385757385e-201) {
tmp = (x / z) * (t + (y + (t / z)));
} else if (((y / z) - (t / (1.0 - z))) <= 1.347321449727839e+117) {
tmp = (cbrt(y / z) * (x * (cbrt(y / z) * cbrt(y / z)))) + (x * (t / (z - 1.0)));
} else {
tmp = (x * (t / (z - 1.0))) + ((y * x) / z);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.8 |
|---|---|
| Target | 4.2 |
| Herbie | 2.8 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -3.6286540041355679e-240 or 2.79714538575738503e-201 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 1.34732144972783902e117Initial program 2.6
rmApplied sub-neg_binary642.6
Applied distribute-rgt-in_binary642.6
Simplified2.6
Simplified2.6
rmApplied add-cube-cbrt_binary643.2
Applied associate-*r*_binary643.2
if -3.6286540041355679e-240 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 2.79714538575738503e-201Initial program 10.7
Taylor expanded around inf 1.4
Simplified1.0
if 1.34732144972783902e117 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 11.0
rmApplied sub-neg_binary6411.0
Applied distribute-rgt-in_binary6411.0
Simplified11.0
Simplified11.0
rmApplied associate-*r/_binary642.4
Final simplification2.8
herbie shell --seed 2020232
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:herbie-target
(if (< (* x (- (/ y z) (/ t (- 1.0 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))) (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z)))) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z)))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))