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 \cdot x}{z}\\
t_4 := \frac{y}{z} - t_2\\
\mathbf{if}\;t_4 \leq -\infty:\\
\;\;\;\;\begin{array}{l}
t_5 := \sqrt[3]{t_1}\\
t_3 - t_5 \cdot \left(t_5 \cdot t_5\right)
\end{array}\\
\mathbf{elif}\;t_4 \leq -1.300852640978506 \cdot 10^{-156}:\\
\;\;\;\;t_4 \cdot x\\
\mathbf{elif}\;t_4 \leq 0:\\
\;\;\;\;\frac{y}{\frac{z}{x}} - t_1\\
\mathbf{elif}\;t_4 \leq 4.470830814915151 \cdot 10^{+146}:\\
\;\;\;\;\begin{array}{l}
t_6 := -t_2\\
x \cdot \mathsf{fma}\left(y, \frac{1}{z}, t_6\right) + x \cdot \mathsf{fma}\left(t_6, 1, t_2\right)
\end{array}\\
\mathbf{else}:\\
\;\;\;\;t_3 - t \cdot \frac{x}{1 - z}\\
\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 x) z))
(t_4 (- (/ y z) t_2)))
(if (<= t_4 (- INFINITY))
(let* ((t_5 (cbrt t_1))) (- t_3 (* t_5 (* t_5 t_5))))
(if (<= t_4 -1.300852640978506e-156)
(* t_4 x)
(if (<= t_4 0.0)
(- (/ y (/ z x)) t_1)
(if (<= t_4 4.470830814915151e+146)
(let* ((t_6 (- t_2)))
(+ (* x (fma y (/ 1.0 z) t_6)) (* x (fma t_6 1.0 t_2))))
(- 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 * x) / (1.0 - z);
double t_2 = t / (1.0 - z);
double t_3 = (y * x) / z;
double t_4 = (y / z) - t_2;
double tmp;
if (t_4 <= -((double) INFINITY)) {
double t_5_1 = cbrt(t_1);
tmp = t_3 - (t_5_1 * (t_5_1 * t_5_1));
} else if (t_4 <= -1.300852640978506e-156) {
tmp = t_4 * x;
} else if (t_4 <= 0.0) {
tmp = (y / (z / x)) - t_1;
} else if (t_4 <= 4.470830814915151e+146) {
double t_6 = -t_2;
tmp = (x * fma(y, (1.0 / z), t_6)) + (x * fma(t_6, 1.0, t_2));
} else {
tmp = t_3 - (t * (x / (1.0 - z)));
}
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
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 *-un-lft-identity_binary640.2
Applied times-frac_binary640.2
Applied *-un-lft-identity_binary640.2
Applied *-un-lft-identity_binary640.2
Applied times-frac_binary640.2
Applied distribute-lft-out--_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 *-un-lft-identity_binary640.4
Applied times-frac_binary640.4
Applied div-inv_binary640.4
Applied prod-diff_binary640.4
Applied distribute-rgt-in_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)))))