(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (/ (- 1.0 z) t))) (t_2 (- (/ y z) (/ t (- 1.0 z)))))
(if (<= t_2 (- INFINITY))
(- (/ y (/ z x)) t_1)
(if (<= t_2 8.332972841835484e+202) (* t_2 x) (- (* 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 = x / ((1.0 - z) / t);
double t_2 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = (y / (z / x)) - t_1;
} else if (t_2 <= 8.332972841835484e+202) {
tmp = t_2 * x;
} else {
tmp = (y * (x / z)) - t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
public static double code(double x, double y, double z, double t) {
double t_1 = x / ((1.0 - z) / t);
double t_2 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = (y / (z / x)) - t_1;
} else if (t_2 <= 8.332972841835484e+202) {
tmp = t_2 * x;
} else {
tmp = (y * (x / z)) - t_1;
}
return tmp;
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
def code(x, y, z, t): t_1 = x / ((1.0 - z) / t) t_2 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_2 <= -math.inf: tmp = (y / (z / x)) - t_1 elif t_2 <= 8.332972841835484e+202: tmp = t_2 * x else: tmp = (y * (x / z)) - t_1 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(x / Float64(Float64(1.0 - z) / t)) t_2 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(y / Float64(z / x)) - t_1); elseif (t_2 <= 8.332972841835484e+202) tmp = Float64(t_2 * x); else tmp = Float64(Float64(y * Float64(x / z)) - t_1); end return tmp end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
function tmp_2 = code(x, y, z, t) t_1 = x / ((1.0 - z) / t); t_2 = (y / z) - (t / (1.0 - z)); tmp = 0.0; if (t_2 <= -Inf) tmp = (y / (z / x)) - t_1; elseif (t_2 <= 8.332972841835484e+202) tmp = t_2 * x; else tmp = (y * (x / z)) - t_1; end tmp_2 = 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[(x / N[(N[(1.0 - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 8.332972841835484e+202], N[(t$95$2 * x), $MachinePrecision], N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
t_1 := \frac{x}{\frac{1 - z}{t}}\\
t_2 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;\frac{y}{\frac{z}{x}} - t_1\\
\mathbf{elif}\;t_2 \leq 8.332972841835484 \cdot 10^{+202}:\\
\;\;\;\;t_2 \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z} - t_1\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.5 |
|---|---|
| Target | 4.3 |
| Herbie | 1.2 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -inf.0Initial program 64.0
Taylor expanded in y around 0 0.3
Applied egg-rr0.3
Applied egg-rr0.3
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 8.3329728418354843e202Initial program 1.3
if 8.3329728418354843e202 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 20.5
Taylor expanded in y around 0 1.5
Applied egg-rr1.7
Applied egg-rr1.2
Final simplification1.2
herbie shell --seed 2022153
(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)))))