x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\begin{array}{l}
\mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \leq -\infty:\\
\;\;\;\;\frac{x \cdot \left(y - z \cdot \left(y + t\right)\right)}{z \cdot \left(1 - z\right)}\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \leq -1.793197774245199 \cdot 10^{-184}:\\
\;\;\;\;\frac{x}{\frac{z}{y}} - \frac{t}{1 - z} \cdot x\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \leq 3.575645117889444 \cdot 10^{-238}:\\
\;\;\;\;\frac{x}{z} \cdot \left(t + \left(y + \frac{t}{z}\right)\right)\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \leq 2.6004804340552325 \cdot 10^{+205}:\\
\;\;\;\;\frac{y}{z} \cdot x - \frac{t}{1 - z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{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))) (- INFINITY))
(/ (* x (- y (* z (+ y t)))) (* z (- 1.0 z)))
(if (<= (- (/ y z) (/ t (- 1.0 z))) -1.793197774245199e-184)
(- (/ x (/ z y)) (* (/ t (- 1.0 z)) x))
(if (<= (- (/ y z) (/ t (- 1.0 z))) 3.575645117889444e-238)
(* (/ x z) (+ t (+ y (/ t z))))
(if (<= (- (/ y z) (/ t (- 1.0 z))) 2.6004804340552325e+205)
(- (* (/ y z) x) (* (/ t (- 1.0 z)) x))
(- (* y (/ x z)) (* (/ t (- 1.0 z)) x)))))))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))) <= -((double) INFINITY)) {
tmp = (x * (y - (z * (y + t)))) / (z * (1.0 - z));
} else if (((y / z) - (t / (1.0 - z))) <= -1.793197774245199e-184) {
tmp = (x / (z / y)) - ((t / (1.0 - z)) * x);
} else if (((y / z) - (t / (1.0 - z))) <= 3.575645117889444e-238) {
tmp = (x / z) * (t + (y + (t / z)));
} else if (((y / z) - (t / (1.0 - z))) <= 2.6004804340552325e+205) {
tmp = ((y / z) * x) - ((t / (1.0 - z)) * x);
} else {
tmp = (y * (x / z)) - ((t / (1.0 - z)) * x);
}
return tmp;
}




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.5 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -inf.0Initial program 64.0
rmApplied frac-sub_binary64_985964.0
Applied associate-*r/_binary64_97940.3
Simplified0.3
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -1.7931977742451991e-184Initial program 0.2
rmApplied sub-neg_binary64_98430.2
Applied distribute-rgt-in_binary64_98020.2
Simplified0.2
Simplified0.2
rmApplied associate-*r/_binary64_97946.1
rmApplied associate-/l*_binary64_97970.2
rmApplied distribute-rgt-neg-out_binary64_98120.2
Applied unsub-neg_binary64_98440.2
if -1.7931977742451991e-184 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 3.57564511788944403e-238Initial program 9.4
Taylor expanded around inf 1.9
Simplified2.0
if 3.57564511788944403e-238 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 2.60048043405523248e205Initial program 0.2
rmApplied sub-neg_binary64_98430.2
Applied distribute-rgt-in_binary64_98020.2
Simplified0.2
Simplified0.2
rmApplied distribute-rgt-neg-out_binary64_98120.2
Applied unsub-neg_binary64_98440.2
if 2.60048043405523248e205 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 18.0
rmApplied sub-neg_binary64_984318.0
Applied distribute-rgt-in_binary64_980218.0
Simplified18.0
Simplified18.0
rmApplied associate-*r/_binary64_97941.2
rmApplied associate-/l*_binary64_979716.6
rmApplied associate-/r/_binary64_97981.2
Final simplification0.5
herbie shell --seed 2020292
(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)))))