(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x 4.0) y))
(t_1 (- t_0 (* (/ x y) z)))
(t_2 (fabs (fma (/ x y) (- z) t_0))))
(if (<= t_1 -2e+160)
t_2
(if (<= t_1 1e-240) (fabs (+ (/ x y) (/ (fma (- z) x 4.0) y))) t_2))))double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
double code(double x, double y, double z) {
double t_0 = (x + 4.0) / y;
double t_1 = t_0 - ((x / y) * z);
double t_2 = fabs(fma((x / y), -z, t_0));
double tmp;
if (t_1 <= -2e+160) {
tmp = t_2;
} else if (t_1 <= 1e-240) {
tmp = fabs(((x / y) + (fma(-z, x, 4.0) / y)));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function code(x, y, z) t_0 = Float64(Float64(x + 4.0) / y) t_1 = Float64(t_0 - Float64(Float64(x / y) * z)) t_2 = abs(fma(Float64(x / y), Float64(-z), t_0)) tmp = 0.0 if (t_1 <= -2e+160) tmp = t_2; elseif (t_1 <= 1e-240) tmp = abs(Float64(Float64(x / y) + Float64(fma(Float64(-z), x, 4.0) / y))); else tmp = t_2; end return tmp end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[(x / y), $MachinePrecision] * (-z) + t$95$0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -2e+160], t$95$2, If[LessEqual[t$95$1, 1e-240], N[Abs[N[(N[(x / y), $MachinePrecision] + N[(N[((-z) * x + 4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\begin{array}{l}
t_0 := \frac{x + 4}{y}\\
t_1 := t_0 - \frac{x}{y} \cdot z\\
t_2 := \left|\mathsf{fma}\left(\frac{x}{y}, -z, t_0\right)\right|\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+160}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 10^{-240}:\\
\;\;\;\;\left|\frac{x}{y} + \frac{\mathsf{fma}\left(-z, x, 4\right)}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}



Bits error versus x



Bits error versus y



Bits error versus z
if (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z)) < -2.00000000000000001e160 or 9.9999999999999997e-241 < (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z)) Initial program 0.7
Applied egg-rr0.7
if -2.00000000000000001e160 < (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z)) < 9.9999999999999997e-241Initial program 3.2
Taylor expanded in x around 0 1.5
Applied egg-rr1.5
Applied egg-rr1.5
Final simplification1.0
herbie shell --seed 2022165
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))