x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\begin{array}{l}
\mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \leq -7.433347435663114 \cdot 10^{-123} \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \leq 4.804427630480993 \cdot 10^{-274}\right):\\
\;\;\;\;\left(x \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\right) \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{z}} - \frac{t}{1 - z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z} - \frac{t \cdot x}{1 - 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 (or (<= (- (/ y z) (/ t (- 1.0 z))) -7.433347435663114e-123)
(not (<= (- (/ y z) (/ t (- 1.0 z))) 4.804427630480993e-274)))
(-
(*
(* x (/ (* (cbrt y) (cbrt y)) (* (cbrt z) (cbrt z))))
(/ (cbrt y) (cbrt z)))
(* (/ t (- 1.0 z)) x))
(- (* (* y x) (/ 1.0 z)) (/ (* t x) (- 1.0 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))) <= -7.433347435663114e-123) || !(((y / z) - (t / (1.0 - z))) <= 4.804427630480993e-274)) {
tmp = ((x * ((cbrt(y) * cbrt(y)) / (cbrt(z) * cbrt(z)))) * (cbrt(y) / cbrt(z))) - ((t / (1.0 - z)) * x);
} else {
tmp = ((y * x) * (1.0 / z)) - ((t * x) / (1.0 - z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.4 |
|---|---|
| Target | 4.2 |
| Herbie | 1.6 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -7.4333474356631138e-123 or 4.8044276304809932e-274 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 4.0
rmApplied sub-neg_binary64_147344.0
Applied distribute-rgt-in_binary64_146914.0
Simplified4.0
Simplified4.0
rmApplied add-cube-cbrt_binary64_147764.5
Applied add-cube-cbrt_binary64_147764.6
Applied times-frac_binary64_147474.7
Applied associate-*r*_binary64_146811.4
if -7.4333474356631138e-123 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 4.8044276304809932e-274Initial program 7.2
rmApplied sub-neg_binary64_147347.2
Applied distribute-rgt-in_binary64_146917.2
Simplified7.2
Simplified7.2
rmApplied div-inv_binary64_147387.2
Applied associate-*r*_binary64_146815.1
rmApplied distribute-neg-frac_binary64_147055.1
Applied associate-*r/_binary64_146832.6
Final simplification1.6
herbie shell --seed 2020344
(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)))))