x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\begin{array}{l}
\mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \leq -1.0690732745595959 \cdot 10^{+186}:\\
\;\;\;\;y \cdot \frac{x}{z} - t \cdot \frac{x}{1 - z}\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \leq -3.501687232319656 \cdot 10^{-195}:\\
\;\;\;\;\left(\frac{y}{z} - \frac{t}{1 - z}\right) \cdot x\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \leq 0:\\
\;\;\;\;\frac{y \cdot x + t \cdot x}{z}\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \leq 1.0504291516730519 \cdot 10^{+198}:\\
\;\;\;\;\frac{y}{z} \cdot x - \frac{t}{1 - z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z} - \frac{t \cdot x}{1 - z}\\
\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))) -1.0690732745595959e+186)
(- (* y (/ x z)) (* t (/ x (- 1.0 z))))
(if (<= (- (/ y z) (/ t (- 1.0 z))) -3.501687232319656e-195)
(* (- (/ y z) (/ t (- 1.0 z))) x)
(if (<= (- (/ y z) (/ t (- 1.0 z))) 0.0)
(/ (+ (* y x) (* t x)) z)
(if (<= (- (/ y z) (/ t (- 1.0 z))) 1.0504291516730519e+198)
(- (* (/ y z) x) (* (/ t (- 1.0 z)) x))
(- (/ (* y x) z) (/ (* t x) (- 1.0 z))))))))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 tmp;
if (((y / z) - (t / (1.0 - z))) <= -1.0690732745595959e+186) {
tmp = (y * (x / z)) - (t * (x / (1.0 - z)));
} else if (((y / z) - (t / (1.0 - z))) <= -3.501687232319656e-195) {
tmp = ((y / z) - (t / (1.0 - z))) * x;
} else if (((y / z) - (t / (1.0 - z))) <= 0.0) {
tmp = ((y * x) + (t * x)) / z;
} else if (((y / z) - (t / (1.0 - z))) <= 1.0504291516730519e+198) {
tmp = ((y / z) * x) - ((t / (1.0 - z)) * x);
} else {
tmp = ((y * x) / z) - ((t * x) / (1.0 - z));
}
return tmp;
}




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.6 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -1.06907327455959592e186Initial program 17.7
rmApplied div-inv_binary64_621317.7
Applied cancel-sign-sub-inv_binary64_618217.7
Applied distribute-rgt-in_binary64_616617.7
Simplified1.5
Taylor expanded around 0 1.9
Simplified1.8
if -1.06907327455959592e186 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -3.5016872323196563e-195Initial program 0.2
if -3.5016872323196563e-195 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 0.0Initial program 11.8
Taylor expanded around inf 1.4
if 0.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 1.0504291516730519e198Initial program 0.3
rmApplied sub-neg_binary64_62090.3
Applied distribute-rgt-in_binary64_61660.3
if 1.0504291516730519e198 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 20.0
Taylor expanded around 0 0.8
Final simplification0.6
herbie shell --seed 2021176
(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)))))