(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 -2e-204)
(* t_2 x)
(if (<= t_2 1e-287)
(/ (+ (* y x) (* t x)) z)
(if (<= t_2 1e+306)
(fma x (/ y z) (* t_1 (- x)))
(/ (* x (- (* y (- 1.0 z)) (* z t))) (* z (- 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 tmp;
if (t_2 <= -2e-204) {
tmp = t_2 * x;
} else if (t_2 <= 1e-287) {
tmp = ((y * x) + (t * x)) / z;
} else if (t_2 <= 1e+306) {
tmp = fma(x, (y / z), (t_1 * -x));
} else {
tmp = (x * ((y * (1.0 - z)) - (z * t))) / (z * (1.0 - z));
}
return tmp;
}
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function code(x, y, z, t) t_1 = Float64(t / Float64(1.0 - z)) t_2 = Float64(Float64(y / z) - t_1) tmp = 0.0 if (t_2 <= -2e-204) tmp = Float64(t_2 * x); elseif (t_2 <= 1e-287) tmp = Float64(Float64(Float64(y * x) + Float64(t * x)) / z); elseif (t_2 <= 1e+306) tmp = fma(x, Float64(y / z), Float64(t_1 * Float64(-x))); else tmp = Float64(Float64(x * Float64(Float64(y * Float64(1.0 - z)) - Float64(z * t))) / Float64(z * Float64(1.0 - z))); end return tmp end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / z), $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-204], N[(t$95$2 * x), $MachinePrecision], If[LessEqual[t$95$2, 1e-287], N[(N[(N[(y * x), $MachinePrecision] + N[(t * x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$2, 1e+306], N[(x * N[(y / z), $MachinePrecision] + N[(t$95$1 * (-x)), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
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 -2 \cdot 10^{-204}:\\
\;\;\;\;t_2 \cdot x\\
\mathbf{elif}\;t_2 \leq 10^{-287}:\\
\;\;\;\;\frac{y \cdot x + t \cdot x}{z}\\
\mathbf{elif}\;t_2 \leq 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{z}, t_1 \cdot \left(-x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 4.5 |
|---|---|
| Target | 4.3 |
| Herbie | 1.9 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -2e-204Initial program 3.9
Applied egg-rr4.0
Taylor expanded in x around 0 3.9
if -2e-204 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 1.00000000000000002e-287Initial program 11.2
Taylor expanded in z around inf 1.3
if 1.00000000000000002e-287 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 1.00000000000000002e306Initial program 0.2
Applied egg-rr0.2
if 1.00000000000000002e306 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 62.5
Applied egg-rr0.3
Final simplification1.9
herbie shell --seed 2022162
(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)))))