x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t_1 \leq -3.3553661816758805 \cdot 10^{+253}:\\
\;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := x \cdot \left(\frac{y}{z} + \frac{t}{z - 1}\right)\\
\mathbf{if}\;t_1 \leq -4.265609901108797 \cdot 10^{-218}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{y \cdot x + t \cdot x}{z}\\
\mathbf{elif}\;t_1 \leq 1.1121656242996984 \cdot 10^{+184}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z} - \frac{t \cdot x}{1 - z}\\
\end{array}\\
\end{array}
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ y z) (/ t (- 1.0 z)))))
(if (<= t_1 -3.3553661816758805e+253)
(/ (* x (- (* y (- 1.0 z)) (* z t))) (* z (- 1.0 z)))
(let* ((t_2 (* x (+ (/ y z) (/ t (- z 1.0))))))
(if (<= t_1 -4.265609901108797e-218)
t_2
(if (<= t_1 0.0)
(/ (+ (* y x) (* t x)) z)
(if (<= t_1 1.1121656242996984e+184)
t_2
(- (/ (* 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 t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= -3.3553661816758805e+253) {
tmp = (x * ((y * (1.0 - z)) - (z * t))) / (z * (1.0 - z));
} else {
double t_2 = x * ((y / z) + (t / (z - 1.0)));
double tmp_1;
if (t_1 <= -4.265609901108797e-218) {
tmp_1 = t_2;
} else if (t_1 <= 0.0) {
tmp_1 = ((y * x) + (t * x)) / z;
} else if (t_1 <= 1.1121656242996984e+184) {
tmp_1 = t_2;
} else {
tmp_1 = ((y * x) / z) - ((t * x) / (1.0 - z));
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.8 |
|---|---|
| Target | 4.4 |
| Herbie | 0.6 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -3.3553661816758805e253Initial program 32.4
Applied frac-sub_binary6434.5
Applied associate-*r/_binary642.8
if -3.3553661816758805e253 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -4.2656099011087971e-218 or 0.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 1.11216562429969839e184Initial program 0.3
Applied div-inv_binary640.3
Applied div-inv_binary640.4
Applied fma-neg_binary640.4
Simplified0.3
Taylor expanded in x around inf 0.3
if -4.2656099011087971e-218 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 0.0Initial program 13.6
Taylor expanded in z around inf 0.8
if 1.11216562429969839e184 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 16.5
Taylor expanded in y around 0 1.6
Final simplification0.6
herbie shell --seed 2022097
(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)))))