(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* y x) z)) (t_2 (- (/ y z) (/ t (- 1.0 z)))) (t_3 (* x t_2)))
(if (<= t_2 (- INFINITY))
(- t_1 (* t x))
(if (<= t_2 -2.5784549546398096e-254)
t_3
(if (<= t_2 1.943961421763064e-188)
(/ (fma y x (* t x)) z)
(if (<= t_2 2.1021122769901558e+138)
t_3
(- t_1 (/ (* 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 = (y * x) / z;
double t_2 = (y / z) - (t / (1.0 - z));
double t_3 = x * t_2;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1 - (t * x);
} else if (t_2 <= -2.5784549546398096e-254) {
tmp = t_3;
} else if (t_2 <= 1.943961421763064e-188) {
tmp = fma(y, x, (t * x)) / z;
} else if (t_2 <= 2.1021122769901558e+138) {
tmp = t_3;
} else {
tmp = t_1 - ((t * x) / (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(Float64(y * x) / z) t_2 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) t_3 = Float64(x * t_2) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(t_1 - Float64(t * x)); elseif (t_2 <= -2.5784549546398096e-254) tmp = t_3; elseif (t_2 <= 1.943961421763064e-188) tmp = Float64(fma(y, x, Float64(t * x)) / z); elseif (t_2 <= 2.1021122769901558e+138) tmp = t_3; else tmp = Float64(t_1 - Float64(Float64(t * x) / 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[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * t$95$2), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(t$95$1 - N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2.5784549546398096e-254], t$95$3, If[LessEqual[t$95$2, 1.943961421763064e-188], N[(N[(y * x + N[(t * x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$2, 2.1021122769901558e+138], t$95$3, N[(t$95$1 - N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
t_1 := \frac{y \cdot x}{z}\\
t_2 := \frac{y}{z} - \frac{t}{1 - z}\\
t_3 := x \cdot t_2\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;t_1 - t \cdot x\\
\mathbf{elif}\;t_2 \leq -2.5784549546398096 \cdot 10^{-254}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t_2 \leq 1.943961421763064 \cdot 10^{-188}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, t \cdot x\right)}{z}\\
\mathbf{elif}\;t_2 \leq 2.1021122769901558 \cdot 10^{+138}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_1 - \frac{t \cdot x}{1 - z}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 4.6 |
|---|---|
| Target | 4.3 |
| Herbie | 0.5 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -inf.0Initial program 64.0
Taylor expanded in z around 0 0.3
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -2.5784549546398096e-254 or 1.9439614217630641e-188 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 2.10211227699015581e138Initial program 0.2
if -2.5784549546398096e-254 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 1.9439614217630641e-188Initial program 9.7
Taylor expanded in z around inf 0.9
Simplified0.9
if 2.10211227699015581e138 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 12.3
Taylor expanded in y around 0 2.0
Final simplification0.5
herbie shell --seed 2022152
(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)))))