x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
t_1 := y \cdot \frac{x}{z} - \frac{t \cdot x}{1 - z}\\
t_2 := \frac{y}{z} - \frac{t}{1 - z}\\
t_3 := t_2 \cdot x\\
\mathbf{if}\;t_2 \leq -3.484467357253671 \cdot 10^{-197}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t_2 \leq 2.6205032469197644 \cdot 10^{-272}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 \leq 8.431641861418719 \cdot 10^{+179}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\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 (/ x z)) (/ (* t x) (- 1.0 z))))
(t_2 (- (/ y z) (/ t (- 1.0 z))))
(t_3 (* t_2 x)))
(if (<= t_2 -3.484467357253671e-197)
t_3
(if (<= t_2 2.6205032469197644e-272)
t_1
(if (<= t_2 8.431641861418719e+179) t_3 t_1)))))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 * (x / z)) - ((t * x) / (1.0 - z));
double t_2 = (y / z) - (t / (1.0 - z));
double t_3 = t_2 * x;
double tmp;
if (t_2 <= -3.484467357253671e-197) {
tmp = t_3;
} else if (t_2 <= 2.6205032469197644e-272) {
tmp = t_1;
} else if (t_2 <= 8.431641861418719e+179) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.6 |
|---|---|
| Target | 3.9 |
| Herbie | 2.1 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -3.48446735725367071e-197 or 2.62050324691976437e-272 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 8.4316418614187192e179Initial program 2.2
if -3.48446735725367071e-197 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 2.62050324691976437e-272 or 8.4316418614187192e179 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 13.9
Taylor expanded in y around 0 1.2
Applied *-un-lft-identity_binary641.2
Applied times-frac_binary641.9
Simplified1.9
Final simplification2.1
herbie shell --seed 2022125
(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)))))