x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
t_1 := \frac{t}{1 - z}\\
t_2 := \frac{y}{z} - t_1\\
\mathbf{if}\;t_2 \leq -3.0066117955886623 \cdot 10^{+167}:\\
\;\;\;\;\frac{y \cdot x}{z} - t_1 \cdot x\\
\mathbf{elif}\;t_2 \leq 1.0804566676969925 \cdot 10^{+220}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(\frac{y}{z}, 1, \frac{-t}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot t - \left(y \cdot x\right) \cdot \frac{1 - z}{x}}{z \cdot \frac{z + -1}{x}}\\
\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 (- 1.0 z))) (t_2 (- (/ y z) t_1)))
(if (<= t_2 -3.0066117955886623e+167)
(- (/ (* y x) z) (* t_1 x))
(if (<= t_2 1.0804566676969925e+220)
(* x (fma (/ y z) 1.0 (/ (- t) (- 1.0 z))))
(/ (- (* z t) (* (* y x) (/ (- 1.0 z) x))) (* z (/ (+ z -1.0) 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 t_1 = t / (1.0 - z);
double t_2 = (y / z) - t_1;
double tmp;
if (t_2 <= -3.0066117955886623e+167) {
tmp = ((y * x) / z) - (t_1 * x);
} else if (t_2 <= 1.0804566676969925e+220) {
tmp = x * fma((y / z), 1.0, (-t / (1.0 - z)));
} else {
tmp = ((z * t) - ((y * x) * ((1.0 - z) / x))) / (z * ((z + -1.0) / x));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 4.6 |
|---|---|
| Target | 4.0 |
| Herbie | 1.9 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -3.00661179558866231e167Initial program 13.8
Taylor expanded in y around 0 2.6
Applied egg-rr1.2
if -3.00661179558866231e167 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 1.08045666769699253e220Initial program 1.8
Applied egg-rr1.8
if 1.08045666769699253e220 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 22.3
Taylor expanded in y around 0 0.9
Applied egg-rr4.7
Final simplification1.9
herbie shell --seed 2022130
(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)))))