x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\begin{array}{l}
\mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \le -9.39688798881046142 \cdot 10^{287}:\\
\;\;\;\;\frac{x \cdot y}{z} + \frac{-x}{\sqrt{1 - z}} \cdot \frac{t}{\sqrt{1 - z}}\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -1.24814217605651677 \cdot 10^{-278}:\\
\;\;\;\;\frac{x}{\frac{z}{y}} + x \cdot \left(-\frac{t}{1 - z}\right)\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 0.0:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z}, \mathsf{fma}\left(1, \frac{t \cdot x}{{z}^{2}}, \frac{t \cdot x}{z}\right)\right)\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 3.46500928468374139 \cdot 10^{219}:\\
\;\;\;\;\frac{x}{\frac{z}{y}} + x \cdot \left(-\frac{t}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z} + \frac{-x}{\sqrt{1 - z}} \cdot \frac{t}{\sqrt{1 - z}}\\
\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)))))) <= -9.396887988810461e+287)) {
VAR = ((double) (((double) (((double) (x * y)) / z)) + ((double) (((double) (((double) -(x)) / ((double) sqrt(((double) (1.0 - z)))))) * ((double) (t / ((double) sqrt(((double) (1.0 - z))))))))));
} else {
double VAR_1;
if ((((double) (((double) (y / z)) - ((double) (t / ((double) (1.0 - z)))))) <= -1.2481421760565168e-278)) {
VAR_1 = ((double) (((double) (x / ((double) (z / y)))) + ((double) (x * ((double) -(((double) (t / ((double) (1.0 - z))))))))));
} else {
double VAR_2;
if ((((double) (((double) (y / z)) - ((double) (t / ((double) (1.0 - z)))))) <= 0.0)) {
VAR_2 = ((double) fma(y, ((double) (x / z)), ((double) fma(1.0, ((double) (((double) (t * x)) / ((double) pow(z, 2.0)))), ((double) (((double) (t * x)) / z))))));
} else {
double VAR_3;
if ((((double) (((double) (y / z)) - ((double) (t / ((double) (1.0 - z)))))) <= 3.4650092846837414e+219)) {
VAR_3 = ((double) (((double) (x / ((double) (z / y)))) + ((double) (x * ((double) -(((double) (t / ((double) (1.0 - z))))))))));
} else {
VAR_3 = ((double) (((double) (((double) (x * y)) / z)) + ((double) (((double) (((double) -(x)) / ((double) sqrt(((double) (1.0 - z)))))) * ((double) (t / ((double) sqrt(((double) (1.0 - z))))))))));
}
VAR_2 = VAR_3;
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.7 |
|---|---|
| Target | 4.3 |
| Herbie | 0.5 |
if (- (/ y z) (/ t (- 1.0 z))) < -9.396887988810461e+287 or 3.4650092846837414e+219 < (- (/ y z) (/ t (- 1.0 z))) Initial program 30.7
rmApplied div-inv30.8
Applied fma-neg30.8
rmApplied fma-udef30.8
Applied distribute-lft-in30.8
Simplified0.4
rmApplied add-sqr-sqrt2.5
Applied *-un-lft-identity2.5
Applied times-frac2.5
Applied distribute-lft-neg-in2.5
Applied associate-*r*2.6
Simplified2.6
if -9.396887988810461e+287 < (- (/ y z) (/ t (- 1.0 z))) < -1.2481421760565168e-278 or 0.0 < (- (/ y z) (/ t (- 1.0 z))) < 3.4650092846837414e+219Initial program 0.2
rmApplied div-inv0.3
Applied fma-neg0.3
rmApplied fma-udef0.3
Applied distribute-lft-in0.3
Simplified5.8
rmApplied associate-/l*0.3
if -1.2481421760565168e-278 < (- (/ y z) (/ t (- 1.0 z))) < 0.0Initial program 17.9
rmApplied div-inv17.9
Applied fma-neg17.9
Taylor expanded around inf 0.1
Simplified0.1
Final simplification0.5
herbie shell --seed 2020120 +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)))))