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\\
t_3 := \frac{y \cdot x}{z}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;\begin{array}{l}
t_4 := \sqrt[3]{1 - z}\\
t_3 - \frac{t}{t_4 \cdot t_4} \cdot \frac{x}{t_4}
\end{array}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_5 := -t_1\\
\mathbf{if}\;t_2 \leq -1.300852640978506 \cdot 10^{-156}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(1, \frac{y}{z}, t_5\right)\\
\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;\frac{y}{\frac{z}{x}} - \frac{t \cdot x}{1 - z}\\
\mathbf{elif}\;t_2 \leq 4.470830814915151 \cdot 10^{+146}:\\
\;\;\;\;x \cdot \left(\mathsf{fma}\left(y, \frac{1}{z}, t_5\right) + \mathsf{fma}\left(t_5, 1, t_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_3 - t \cdot \frac{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 (/ t (- 1.0 z))) (t_2 (- (/ y z) t_1)) (t_3 (/ (* y x) z)))
(if (<= t_2 (- INFINITY))
(let* ((t_4 (cbrt (- 1.0 z)))) (- t_3 (* (/ t (* t_4 t_4)) (/ x t_4))))
(let* ((t_5 (- t_1)))
(if (<= t_2 -1.300852640978506e-156)
(* x (fma 1.0 (/ y z) t_5))
(if (<= t_2 0.0)
(- (/ y (/ z x)) (/ (* t x) (- 1.0 z)))
(if (<= t_2 4.470830814915151e+146)
(* x (+ (fma y (/ 1.0 z) t_5) (fma t_5 1.0 t_1)))
(- t_3 (* 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 = t / (1.0 - z);
double t_2 = (y / z) - t_1;
double t_3 = (y * x) / z;
double tmp;
if (t_2 <= -((double) INFINITY)) {
double t_4_1 = cbrt(1.0 - z);
tmp = t_3 - ((t / (t_4_1 * t_4_1)) * (x / t_4_1));
} else {
double t_5 = -t_1;
double tmp_2;
if (t_2 <= -1.300852640978506e-156) {
tmp_2 = x * fma(1.0, (y / z), t_5);
} else if (t_2 <= 0.0) {
tmp_2 = (y / (z / x)) - ((t * x) / (1.0 - z));
} else if (t_2 <= 4.470830814915151e+146) {
tmp_2 = x * (fma(y, (1.0 / z), t_5) + fma(t_5, 1.0, t_1));
} else {
tmp_2 = t_3 - (t * (x / (1.0 - z)));
}
tmp = tmp_2;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 4.7 |
|---|---|
| Target | 4.4 |
| Herbie | 0.7 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -inf.0Initial program 64.0
Taylor expanded in y around 0 0.3
Applied add-cube-cbrt_binary640.3
Applied times-frac_binary640.3
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -1.3008526409785059e-156Initial program 0.2
Applied *-un-lft-identity_binary640.2
Applied fma-neg_binary640.2
if -1.3008526409785059e-156 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 0.0Initial program 9.0
Taylor expanded in y around 0 1.7
Applied associate-/l*_binary641.3
if 0.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 4.47083081491515058e146Initial program 0.4
Applied *-un-lft-identity_binary640.4
Applied div-inv_binary640.4
Applied prod-diff_binary640.4
if 4.47083081491515058e146 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 13.0
Taylor expanded in y around 0 2.3
Applied *-un-lft-identity_binary642.3
Applied times-frac_binary642.4
Simplified2.4
Final simplification0.7
herbie shell --seed 2022068
(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)))))