x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\begin{array}{l}
\mathbf{if}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) = -\infty:\\
\;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}\\
\mathbf{elif}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \le -1.88748376235 \cdot 10^{-313}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
\mathbf{elif}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \le 0.0:\\
\;\;\;\;\frac{x \cdot y}{z} + \left(1 \cdot \frac{t \cdot x}{{z}^{2}} + \frac{t \cdot x}{z}\right)\\
\mathbf{elif}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \le 8.4522645039473741 \cdot 10^{305}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}\\
\end{array}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 VAR;
if (((x * ((y / z) - (t / (1.0 - z)))) <= -inf.0)) {
VAR = ((x * ((y * (1.0 - z)) - (z * t))) / (z * (1.0 - z)));
} else {
double VAR_1;
if (((x * ((y / z) - (t / (1.0 - z)))) <= -1.887483762347e-313)) {
VAR_1 = (x * ((y / z) - (t * (1.0 / (1.0 - z)))));
} else {
double VAR_2;
if (((x * ((y / z) - (t / (1.0 - z)))) <= 0.0)) {
VAR_2 = (((x * y) / z) + ((1.0 * ((t * x) / pow(z, 2.0))) + ((t * x) / z)));
} else {
double VAR_3;
if (((x * ((y / z) - (t / (1.0 - z)))) <= 8.452264503947374e+305)) {
VAR_3 = (x * ((y / z) - (t * (1.0 / (1.0 - z)))));
} else {
VAR_3 = ((x * ((y * (1.0 - z)) - (z * t))) / (z * (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.4 |
|---|---|
| Target | 4.1 |
| Herbie | 0.4 |
if (* x (- (/ y z) (/ t (- 1.0 z)))) < -inf.0 or 8.452264503947374e+305 < (* x (- (/ y z) (/ t (- 1.0 z)))) Initial program 62.1
rmApplied frac-sub62.8
Applied associate-*r/0.9
if -inf.0 < (* x (- (/ y z) (/ t (- 1.0 z)))) < -1.887483762347e-313 or 0.0 < (* x (- (/ y z) (/ t (- 1.0 z)))) < 8.452264503947374e+305Initial program 0.3
rmApplied div-inv0.4
if -1.887483762347e-313 < (* x (- (/ y z) (/ t (- 1.0 z)))) < 0.0Initial program 8.4
rmApplied div-inv8.4
Taylor expanded around inf 0.6
Final simplification0.4
herbie shell --seed 2020092
(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)))))