x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\begin{array}{l}
\mathbf{if}\;t \le -1.81558813368982386 \cdot 10^{-99} \lor \neg \left(t \le -5.192055214536196 \cdot 10^{-135}\right):\\
\;\;\;\;\left(\frac{y}{z} - \frac{1}{\frac{1 - z}{t}}\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z} + \left(1 \cdot \frac{t \cdot x}{{z}^{2}} + \frac{t \cdot x}{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 temp;
if (((t <= -1.8155881336898239e-99) || !(t <= -5.192055214536196e-135))) {
temp = (((y / z) - (1.0 / ((1.0 - z) / t))) * x);
} else {
temp = (((x * y) / z) + ((1.0 * ((t * x) / pow(z, 2.0))) + ((t * x) / z)));
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.8 |
|---|---|
| Target | 4.4 |
| Herbie | 5.3 |
if t < -1.8155881336898239e-99 or -5.192055214536196e-135 < t Initial program 4.7
rmApplied *-commutative4.7
rmApplied clear-num4.8
if -1.8155881336898239e-99 < t < -5.192055214536196e-135Initial program 7.2
rmApplied *-commutative7.2
rmApplied clear-num7.3
rmApplied div-inv7.3
Applied associate-/r*7.2
Applied frac-sub19.2
Applied associate-*l/20.4
Simplified20.4
Taylor expanded around inf 22.1
Final simplification5.3
herbie shell --seed 2020066 +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)))))