x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
t_1 := \frac{t \cdot x}{1 - z}\\
t_2 := \frac{t}{1 - z}\\
t_3 := \frac{y}{z} - t_2\\
\mathbf{if}\;t_3 \leq -8.275559905218104 \cdot 10^{+307}:\\
\;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z} - t_1\\
\mathbf{elif}\;t_3 \leq -2.0154290514920976 \cdot 10^{-135}:\\
\;\;\;\;\frac{y}{z} \cdot x - t_2 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_4 := \frac{y \cdot x}{z}\\
\mathbf{if}\;t_3 \leq 5.691460963819012 \cdot 10^{-166}:\\
\;\;\;\;t_4 - t_1\\
\mathbf{elif}\;t_3 \leq 3.473759016862935 \cdot 10^{+259}:\\
\;\;\;\;t_3 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t_4 - \left(t \cdot x\right) \cdot \frac{1}{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 (/ (* t x) (- 1.0 z)))
(t_2 (/ t (- 1.0 z)))
(t_3 (- (/ y z) t_2)))
(if (<= t_3 -8.275559905218104e+307)
(- (* (* y x) (/ 1.0 z)) t_1)
(if (<= t_3 -2.0154290514920976e-135)
(- (* (/ y z) x) (* t_2 x))
(let* ((t_4 (/ (* y x) z)))
(if (<= t_3 5.691460963819012e-166)
(- t_4 t_1)
(if (<= t_3 3.473759016862935e+259)
(* t_3 x)
(- t_4 (* (* t x) (/ 1.0 (- 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 = (t * x) / (1.0 - z);
double t_2 = t / (1.0 - z);
double t_3 = (y / z) - t_2;
double tmp;
if (t_3 <= -8.275559905218104e+307) {
tmp = ((y * x) * (1.0 / z)) - t_1;
} else if (t_3 <= -2.0154290514920976e-135) {
tmp = ((y / z) * x) - (t_2 * x);
} else {
double t_4 = (y * x) / z;
double tmp_1;
if (t_3 <= 5.691460963819012e-166) {
tmp_1 = t_4 - t_1;
} else if (t_3 <= 3.473759016862935e+259) {
tmp_1 = t_3 * x;
} else {
tmp_1 = t_4 - ((t * x) * (1.0 / (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.5 |
|---|---|
| Target | 4.0 |
| Herbie | 0.6 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -8.27555990521810415e307Initial program 63.3
Taylor expanded in y around 0 0.2
Applied div-inv_binary640.4
if -8.27555990521810415e307 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -2.0154290514920976e-135Initial program 0.2
Applied *-un-lft-identity_binary640.2
Applied *-un-lft-identity_binary640.2
Applied times-frac_binary640.2
Applied cancel-sign-sub-inv_binary640.2
Applied distribute-lft-in_binary640.2
if -2.0154290514920976e-135 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 5.6914609638190115e-166Initial program 6.1
Taylor expanded in y around 0 2.0
Applied *-un-lft-identity_binary642.0
if 5.6914609638190115e-166 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 3.47375901686293489e259Initial program 0.2
Applied pow1_binary640.2
if 3.47375901686293489e259 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 33.5
Taylor expanded in y around 0 0.4
Applied div-inv_binary640.4
Final simplification0.6
herbie shell --seed 2022077
(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)))))