x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\begin{array}{l}
\mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \le -3.6719810849065342 \cdot 10^{-160} \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 0.0\right):\\
\;\;\;\;x \cdot \left(\mathsf{fma}\left(y, \frac{1}{z}, -\frac{t}{1 - z}\right) + \mathsf{fma}\left(-\frac{t}{1 - z}, 1, t \cdot \frac{1}{1 - z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z}, \mathsf{fma}\left(1, \frac{t \cdot x}{{z}^{2}}, \frac{t \cdot x}{z}\right)\right)\\
\end{array}double code(double x, double y, double z, double t) {
return ((double) (x * ((double) (((double) (y / z)) - ((double) (t / ((double) (1.0 - z))))))));
}
double code(double x, double y, double z, double t) {
double VAR;
if (((((double) (((double) (y / z)) - ((double) (t / ((double) (1.0 - z)))))) <= -3.671981084906534e-160) || !(((double) (((double) (y / z)) - ((double) (t / ((double) (1.0 - z)))))) <= 0.0))) {
VAR = ((double) (x * ((double) (((double) fma(y, ((double) (1.0 / z)), ((double) -(((double) (t / ((double) (1.0 - z)))))))) + ((double) fma(((double) -(((double) (t / ((double) (1.0 - z)))))), 1.0, ((double) (t * ((double) (1.0 / ((double) (1.0 - z))))))))))));
} else {
VAR = ((double) fma(y, ((double) (x / z)), ((double) fma(1.0, ((double) (((double) (t * x)) / ((double) pow(z, 2.0)))), ((double) (((double) (t * x)) / z))))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.5 |
|---|---|
| Target | 4.1 |
| Herbie | 3.7 |
if (- (/ y z) (/ t (- 1.0 z))) < -3.671981084906534e-160 or 0.0 < (- (/ y z) (/ t (- 1.0 z))) Initial program 3.8
rmApplied add-cube-cbrt4.3
Applied div-inv4.3
Applied prod-diff4.3
Simplified3.9
Simplified3.9
rmApplied div-inv3.9
if -3.671981084906534e-160 < (- (/ y z) (/ t (- 1.0 z))) < 0.0Initial program 9.9
rmApplied add-cube-cbrt10.1
Applied div-inv10.1
Applied prod-diff10.1
Simplified10.0
Simplified10.0
Taylor expanded around inf 2.1
Simplified2.0
Final simplification3.7
herbie shell --seed 2020114 +o rules:numerics
(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 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z)))))))
(* x (- (/ y z) (/ t (- 1 z)))))