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.635757019929209 \cdot 10^{+191}:\\
\;\;\;\;\frac{y \cdot x}{z} - \frac{t}{1 - z} \cdot x\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \leq 7.337745091788642 \cdot 10^{+306}:\\
\;\;\;\;\frac{y}{z} \cdot x - \frac{t}{1 - z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z} - \frac{t}{1 - z} \cdot x\\
\end{array}(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
(FPCore (x y z t)
:precision binary64
(if (<= (- (/ y z) (/ t (- 1.0 z))) -7.635757019929209e+191)
(- (/ (* y x) z) (* (/ t (- 1.0 z)) x))
(if (<= (- (/ y z) (/ t (- 1.0 z))) 7.337745091788642e+306)
(- (* (/ y z) x) (* (/ t (- 1.0 z)) x))
(- (* (* y x) (/ 1.0 z)) (* (/ t (- 1.0 z)) x)))))double code(double x, double y, double z, double t) {
return ((double) (x * ((double) ((y / z) - (t / ((double) (1.0 - z)))))));
}
double code(double x, double y, double z, double t) {
double VAR;
if ((((double) ((y / z) - (t / ((double) (1.0 - z))))) <= -7.635757019929209e+191)) {
VAR = ((double) ((((double) (y * x)) / z) - ((double) ((t / ((double) (1.0 - z))) * x))));
} else {
double VAR_1;
if ((((double) ((y / z) - (t / ((double) (1.0 - z))))) <= 7.337745091788642e+306)) {
VAR_1 = ((double) (((double) ((y / z) * x)) - ((double) ((t / ((double) (1.0 - z))) * x))));
} else {
VAR_1 = ((double) (((double) (((double) (y * x)) * (1.0 / z))) - ((double) ((t / ((double) (1.0 - z))) * x))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.9 |
|---|---|
| Target | 4.4 |
| Herbie | 1.6 |
if (- (/ y z) (/ t (- 1.0 z))) < -7.63575701992920881e191Initial program 19.6
rmApplied sub-neg19.6
Applied distribute-lft-in19.6
Simplified19.6
rmApplied distribute-frac-neg19.6
Applied distribute-rgt-neg-out19.6
Applied unsub-neg19.6
rmApplied associate-*r/0.9
if -7.63575701992920881e191 < (- (/ y z) (/ t (- 1.0 z))) < 7.33774509178864222e306Initial program 1.7
rmApplied sub-neg1.7
Applied distribute-lft-in1.7
Simplified1.7
rmApplied distribute-frac-neg1.7
Applied distribute-rgt-neg-out1.7
Applied unsub-neg1.7
if 7.33774509178864222e306 < (- (/ y z) (/ t (- 1.0 z))) Initial program 62.7
rmApplied sub-neg62.7
Applied distribute-lft-in62.7
Simplified62.7
rmApplied distribute-frac-neg62.7
Applied distribute-rgt-neg-out62.7
Applied unsub-neg62.7
rmApplied div-inv62.7
Applied associate-*r*0.6
Final simplification1.6
herbie shell --seed 2020198
(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)))))