(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t) x)))
(if (<= (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0)) INFINITY)
(/ (+ x (- (/ y (/ t_1 z)) (/ x t_1))) (+ x 1.0))
(-
(+ (/ x (+ x 1.0)) (/ y (* t (+ x 1.0))))
(/ x (* (* z t) (+ x 1.0)))))))double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double tmp;
if (((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= ((double) INFINITY)) {
tmp = (x + ((y / (t_1 / z)) - (x / t_1))) / (x + 1.0);
} else {
tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / ((z * t) * (x + 1.0)));
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
public static double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double tmp;
if (((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= Double.POSITIVE_INFINITY) {
tmp = (x + ((y / (t_1 / z)) - (x / t_1))) / (x + 1.0);
} else {
tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / ((z * t) * (x + 1.0)));
}
return tmp;
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
def code(x, y, z, t): t_1 = (z * t) - x tmp = 0 if ((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= math.inf: tmp = (x + ((y / (t_1 / z)) - (x / t_1))) / (x + 1.0) else: tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / ((z * t) * (x + 1.0))) return tmp
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) tmp = 0.0 if (Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0)) <= Inf) tmp = Float64(Float64(x + Float64(Float64(y / Float64(t_1 / z)) - Float64(x / t_1))) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(x / Float64(x + 1.0)) + Float64(y / Float64(t * Float64(x + 1.0)))) - Float64(x / Float64(Float64(z * t) * Float64(x + 1.0)))); end return tmp end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; tmp = 0.0; if (((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= Inf) tmp = (x + ((y / (t_1 / z)) - (x / t_1))) / (x + 1.0); else tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / ((z * t) * (x + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, If[LessEqual[N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(x + N[(N[(y / N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision] - N[(x / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(z * t), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\begin{array}{l}
t_1 := z \cdot t - x\\
\mathbf{if}\;\frac{x + \frac{y \cdot z - x}{t_1}}{x + 1} \leq \infty:\\
\;\;\;\;\frac{x + \left(\frac{y}{\frac{t_1}{z}} - \frac{x}{t_1}\right)}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\right) - \frac{x}{\left(z \cdot t\right) \cdot \left(x + 1\right)}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 7.4 |
|---|---|
| Target | 0.4 |
| Herbie | 0.9 |
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < +inf.0Initial program 4.7
Applied egg-rr0.9
if +inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 64.0
Taylor expanded in t around inf 0.0
Final simplification0.9
herbie shell --seed 2022155
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))