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{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(y \cdot x, \frac{1}{z}, t_1\right)\\
\mathbf{elif}\;t_2 \leq -1.4854737382240352 \cdot 10^{-143} \lor \neg \left(t_2 \leq 3.277712234425198 \cdot 10^{-207}\right):\\
\;\;\;\;t_2 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, \frac{y \cdot x}{z}, t_1\right)\\
\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 (- (/ y z) (/ t (- 1.0 z)))))
(if (<= t_2 (- INFINITY))
(fma (* y x) (/ 1.0 z) t_1)
(if (or (<= t_2 -1.4854737382240352e-143)
(not (<= t_2 3.277712234425198e-207)))
(* t_2 x)
(fma 1.0 (/ (* y x) z) 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 = -((t * x) / (1.0 - z));
double t_2 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma((y * x), (1.0 / z), t_1);
} else if ((t_2 <= -1.4854737382240352e-143) || !(t_2 <= 3.277712234425198e-207)) {
tmp = t_2 * x;
} else {
tmp = fma(1.0, ((y * x) / z), t_1);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 4.5 |
|---|---|
| Target | 4.4 |
| Herbie | 2.1 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -inf.0Initial program 64.0
Taylor expanded in y around 0 0.2
Applied div-inv_binary640.4
Applied fma-neg_binary640.4
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -1.48547373822403518e-143 or 3.2777122344251982e-207 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 2.2
if -1.48547373822403518e-143 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 3.2777122344251982e-207Initial program 5.7
Taylor expanded in y around 0 1.6
Applied *-un-lft-identity_binary641.6
Applied fma-neg_binary641.6
Final simplification2.1
herbie shell --seed 2021313
(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)))))