
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); 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]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); 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]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 0.38) (fabs (* (/ -1.0 y_m) (fma x z (- -4.0 x)))) (fabs (fma x (/ z y_m) (/ (- -4.0 x) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 0.38) {
tmp = fabs(((-1.0 / y_m) * fma(x, z, (-4.0 - x))));
} else {
tmp = fabs(fma(x, (z / y_m), ((-4.0 - x) / y_m)));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 0.38) tmp = abs(Float64(Float64(-1.0 / y_m) * fma(x, z, Float64(-4.0 - x)))); else tmp = abs(fma(x, Float64(z / y_m), Float64(Float64(-4.0 - x) / y_m))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 0.38], N[Abs[N[(N[(-1.0 / y$95$m), $MachinePrecision] * N[(x * z + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision] + N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 0.38:\\
\;\;\;\;\left|\frac{-1}{y\_m} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(x, \frac{z}{y\_m}, \frac{-4 - x}{y\_m}\right)\right|\\
\end{array}
\end{array}
if y < 0.38Initial program 91.5%
Simplified97.2%
if 0.38 < y Initial program 97.2%
fabs-sub97.2%
associate-*l/89.5%
associate-*r/99.9%
fmm-def99.9%
distribute-neg-frac99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (/ (+ x 4.0) y_m)) (t_1 (fabs (- t_0 (* z (/ x y_m))))))
(if (or (<= t_1 1e-30) (not (<= t_1 5e+297)))
(fabs (* (/ -1.0 y_m) (fma x z (- -4.0 x))))
(fabs (- t_0 (/ z (/ y_m x)))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = (x + 4.0) / y_m;
double t_1 = fabs((t_0 - (z * (x / y_m))));
double tmp;
if ((t_1 <= 1e-30) || !(t_1 <= 5e+297)) {
tmp = fabs(((-1.0 / y_m) * fma(x, z, (-4.0 - x))));
} else {
tmp = fabs((t_0 - (z / (y_m / x))));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(Float64(x + 4.0) / y_m) t_1 = abs(Float64(t_0 - Float64(z * Float64(x / y_m)))) tmp = 0.0 if ((t_1 <= 1e-30) || !(t_1 <= 5e+297)) tmp = abs(Float64(Float64(-1.0 / y_m) * fma(x, z, Float64(-4.0 - x)))); else tmp = abs(Float64(t_0 - Float64(z / Float64(y_m / x)))); end return tmp end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(t$95$0 - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[t$95$1, 1e-30], N[Not[LessEqual[t$95$1, 5e+297]], $MachinePrecision]], N[Abs[N[(N[(-1.0 / y$95$m), $MachinePrecision] * N[(x * z + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(t$95$0 - N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y\_m}\\
t_1 := \left|t\_0 - z \cdot \frac{x}{y\_m}\right|\\
\mathbf{if}\;t\_1 \leq 10^{-30} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+297}\right):\\
\;\;\;\;\left|\frac{-1}{y\_m} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t\_0 - \frac{z}{\frac{y\_m}{x}}\right|\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 1e-30 or 4.9999999999999998e297 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) Initial program 87.9%
Simplified99.8%
if 1e-30 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 4.9999999999999998e297Initial program 99.8%
*-commutative99.8%
clear-num99.7%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.8%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (/ (+ x 4.0) y_m)))
(if (<= (fabs (- t_0 (* z (/ x y_m)))) INFINITY)
(fabs (- t_0 (/ z (/ y_m x))))
(/ (- (* x z) (+ x 4.0)) y_m))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = (x + 4.0) / y_m;
double tmp;
if (fabs((t_0 - (z * (x / y_m)))) <= ((double) INFINITY)) {
tmp = fabs((t_0 - (z / (y_m / x))));
} else {
tmp = ((x * z) - (x + 4.0)) / y_m;
}
return tmp;
}
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = (x + 4.0) / y_m;
double tmp;
if (Math.abs((t_0 - (z * (x / y_m)))) <= Double.POSITIVE_INFINITY) {
tmp = Math.abs((t_0 - (z / (y_m / x))));
} else {
tmp = ((x * z) - (x + 4.0)) / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = (x + 4.0) / y_m tmp = 0 if math.fabs((t_0 - (z * (x / y_m)))) <= math.inf: tmp = math.fabs((t_0 - (z / (y_m / x)))) else: tmp = ((x * z) - (x + 4.0)) / y_m return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(Float64(x + 4.0) / y_m) tmp = 0.0 if (abs(Float64(t_0 - Float64(z * Float64(x / y_m)))) <= Inf) tmp = abs(Float64(t_0 - Float64(z / Float64(y_m / x)))); else tmp = Float64(Float64(Float64(x * z) - Float64(x + 4.0)) / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = (x + 4.0) / y_m; tmp = 0.0; if (abs((t_0 - (z * (x / y_m)))) <= Inf) tmp = abs((t_0 - (z / (y_m / x)))); else tmp = ((x * z) - (x + 4.0)) / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]}, If[LessEqual[N[Abs[N[(t$95$0 - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], Infinity], N[Abs[N[(t$95$0 - N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(x * z), $MachinePrecision] - N[(x + 4.0), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y\_m}\\
\mathbf{if}\;\left|t\_0 - z \cdot \frac{x}{y\_m}\right| \leq \infty:\\
\;\;\;\;\left|t\_0 - \frac{z}{\frac{y\_m}{x}}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot z - \left(x + 4\right)}{y\_m}\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < +inf.0Initial program 97.5%
*-commutative97.5%
clear-num97.5%
un-div-inv97.5%
Applied egg-rr97.5%
if +inf.0 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) Initial program 0.0%
fabs-sub0.0%
associate-*l/9.1%
associate-*r/9.1%
fmm-def63.6%
distribute-neg-frac63.6%
+-commutative63.6%
distribute-neg-in63.6%
unsub-neg63.6%
metadata-eval63.6%
Simplified63.6%
add-sqr-sqrt18.2%
fabs-sqr18.2%
add-sqr-sqrt18.2%
fma-undefine9.1%
associate-*r/9.1%
associate-*l/0.0%
div-inv0.0%
sub-neg0.0%
metadata-eval0.0%
distribute-neg-in0.0%
+-commutative0.0%
cancel-sign-sub-inv0.0%
div-inv0.0%
associate-*l/9.1%
sub-div54.5%
Applied egg-rr54.5%
Final simplification95.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (- (/ (+ x 4.0) y_m) (* z (/ x y_m))))) (if (<= t_0 INFINITY) (fabs t_0) (/ (- (* x z) (+ x 4.0)) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = ((x + 4.0) / y_m) - (z * (x / y_m));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = fabs(t_0);
} else {
tmp = ((x * z) - (x + 4.0)) / y_m;
}
return tmp;
}
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = ((x + 4.0) / y_m) - (z * (x / y_m));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = Math.abs(t_0);
} else {
tmp = ((x * z) - (x + 4.0)) / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = ((x + 4.0) / y_m) - (z * (x / y_m)) tmp = 0 if t_0 <= math.inf: tmp = math.fabs(t_0) else: tmp = ((x * z) - (x + 4.0)) / y_m return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(Float64(Float64(x + 4.0) / y_m) - Float64(z * Float64(x / y_m))) tmp = 0.0 if (t_0 <= Inf) tmp = abs(t_0); else tmp = Float64(Float64(Float64(x * z) - Float64(x + 4.0)) / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = ((x + 4.0) / y_m) - (z * (x / y_m)); tmp = 0.0; if (t_0 <= Inf) tmp = abs(t_0); else tmp = ((x * z) - (x + 4.0)) / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[Abs[t$95$0], $MachinePrecision], N[(N[(N[(x * z), $MachinePrecision] - N[(x + 4.0), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y\_m} - z \cdot \frac{x}{y\_m}\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;\left|t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot z - \left(x + 4\right)}{y\_m}\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) < +inf.0Initial program 97.5%
if +inf.0 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) Initial program 0.0%
fabs-sub0.0%
associate-*l/9.1%
associate-*r/9.1%
fmm-def63.6%
distribute-neg-frac63.6%
+-commutative63.6%
distribute-neg-in63.6%
unsub-neg63.6%
metadata-eval63.6%
Simplified63.6%
add-sqr-sqrt18.2%
fabs-sqr18.2%
add-sqr-sqrt18.2%
fma-undefine9.1%
associate-*r/9.1%
associate-*l/0.0%
div-inv0.0%
sub-neg0.0%
metadata-eval0.0%
distribute-neg-in0.0%
+-commutative0.0%
cancel-sign-sub-inv0.0%
div-inv0.0%
associate-*l/9.1%
sub-div54.5%
Applied egg-rr54.5%
Final simplification95.7%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (/ z (/ y_m x))) (t_1 (/ (+ x 4.0) y_m)))
(if (<= x -2.4e+280)
(- (/ z (/ y_m (- x))) t_1)
(if (<= x -9.2e-26) (- t_0 t_1) (- t_1 t_0)))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = z / (y_m / x);
double t_1 = (x + 4.0) / y_m;
double tmp;
if (x <= -2.4e+280) {
tmp = (z / (y_m / -x)) - t_1;
} else if (x <= -9.2e-26) {
tmp = t_0 - t_1;
} else {
tmp = t_1 - t_0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z / (y_m / x)
t_1 = (x + 4.0d0) / y_m
if (x <= (-2.4d+280)) then
tmp = (z / (y_m / -x)) - t_1
else if (x <= (-9.2d-26)) then
tmp = t_0 - t_1
else
tmp = t_1 - t_0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = z / (y_m / x);
double t_1 = (x + 4.0) / y_m;
double tmp;
if (x <= -2.4e+280) {
tmp = (z / (y_m / -x)) - t_1;
} else if (x <= -9.2e-26) {
tmp = t_0 - t_1;
} else {
tmp = t_1 - t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = z / (y_m / x) t_1 = (x + 4.0) / y_m tmp = 0 if x <= -2.4e+280: tmp = (z / (y_m / -x)) - t_1 elif x <= -9.2e-26: tmp = t_0 - t_1 else: tmp = t_1 - t_0 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(z / Float64(y_m / x)) t_1 = Float64(Float64(x + 4.0) / y_m) tmp = 0.0 if (x <= -2.4e+280) tmp = Float64(Float64(z / Float64(y_m / Float64(-x))) - t_1); elseif (x <= -9.2e-26) tmp = Float64(t_0 - t_1); else tmp = Float64(t_1 - t_0); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = z / (y_m / x); t_1 = (x + 4.0) / y_m; tmp = 0.0; if (x <= -2.4e+280) tmp = (z / (y_m / -x)) - t_1; elseif (x <= -9.2e-26) tmp = t_0 - t_1; else tmp = t_1 - t_0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]}, If[LessEqual[x, -2.4e+280], N[(N[(z / N[(y$95$m / (-x)), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[x, -9.2e-26], N[(t$95$0 - t$95$1), $MachinePrecision], N[(t$95$1 - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{z}{\frac{y\_m}{x}}\\
t_1 := \frac{x + 4}{y\_m}\\
\mathbf{if}\;x \leq -2.4 \cdot 10^{+280}:\\
\;\;\;\;\frac{z}{\frac{y\_m}{-x}} - t\_1\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{-26}:\\
\;\;\;\;t\_0 - t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 - t\_0\\
\end{array}
\end{array}
if x < -2.39999999999999984e280Initial program 50.0%
fabs-sub50.0%
associate-*l/60.0%
associate-*r/60.0%
fmm-def90.0%
distribute-neg-frac90.0%
+-commutative90.0%
distribute-neg-in90.0%
unsub-neg90.0%
metadata-eval90.0%
Simplified90.0%
add-sqr-sqrt50.0%
fabs-sqr50.0%
add-sqr-sqrt50.2%
fma-undefine40.2%
associate-*r/40.2%
associate-*l/30.2%
div-inv30.2%
sub-neg30.2%
metadata-eval30.2%
distribute-neg-in30.2%
+-commutative30.2%
cancel-sign-sub-inv30.2%
associate-*l/40.2%
associate-*r/40.2%
div-inv40.2%
Applied egg-rr40.2%
*-commutative40.2%
associate-/r/30.2%
frac-2neg30.2%
add-sqr-sqrt10.2%
sqrt-unprod30.2%
sqr-neg30.2%
sqrt-unprod30.0%
add-sqr-sqrt40.2%
Applied egg-rr40.2%
if -2.39999999999999984e280 < x < -9.20000000000000035e-26Initial program 98.1%
fabs-sub98.1%
associate-*l/86.9%
associate-*r/96.6%
fmm-def98.4%
distribute-neg-frac98.4%
+-commutative98.4%
distribute-neg-in98.4%
unsub-neg98.4%
metadata-eval98.4%
Simplified98.4%
add-sqr-sqrt50.0%
fabs-sqr50.0%
add-sqr-sqrt50.7%
fma-undefine50.7%
associate-*r/45.7%
associate-*l/52.1%
div-inv52.0%
sub-neg52.0%
metadata-eval52.0%
distribute-neg-in52.0%
+-commutative52.0%
cancel-sign-sub-inv52.0%
associate-*l/45.6%
associate-*r/50.6%
div-inv50.7%
Applied egg-rr50.7%
*-commutative50.7%
associate-/r/52.2%
Applied egg-rr52.2%
if -9.20000000000000035e-26 < x Initial program 94.1%
fabs-sub94.1%
associate-*l/93.8%
associate-*r/90.8%
fmm-def91.9%
distribute-neg-frac91.9%
+-commutative91.9%
distribute-neg-in91.9%
unsub-neg91.9%
metadata-eval91.9%
Simplified91.9%
add-sqr-sqrt42.5%
fabs-sqr42.5%
add-sqr-sqrt43.7%
fma-undefine43.7%
associate-*r/47.8%
associate-*l/47.4%
div-inv47.4%
sub-neg47.4%
metadata-eval47.4%
distribute-neg-in47.4%
+-commutative47.4%
cancel-sign-sub-inv47.4%
div-inv47.4%
associate-*l/47.8%
sub-div49.4%
Applied egg-rr49.4%
div-sub47.8%
associate-*r/43.7%
add-sqr-sqrt42.5%
fabs-sqr42.5%
add-sqr-sqrt90.8%
fabs-sub90.8%
*-commutative90.8%
associate-/r/94.2%
add-sqr-sqrt47.4%
fabs-sqr47.4%
add-sqr-sqrt48.6%
div-inv48.6%
clear-num48.6%
Applied egg-rr48.6%
clear-num48.6%
div-inv48.6%
Applied egg-rr48.6%
Final simplification49.1%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (/ (+ x 4.0) y_m))) (if (<= x -1.45e-25) (- (* x (/ z y_m)) t_0) (- t_0 (/ z (/ y_m x))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = (x + 4.0) / y_m;
double tmp;
if (x <= -1.45e-25) {
tmp = (x * (z / y_m)) - t_0;
} else {
tmp = t_0 - (z / (y_m / x));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x + 4.0d0) / y_m
if (x <= (-1.45d-25)) then
tmp = (x * (z / y_m)) - t_0
else
tmp = t_0 - (z / (y_m / x))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = (x + 4.0) / y_m;
double tmp;
if (x <= -1.45e-25) {
tmp = (x * (z / y_m)) - t_0;
} else {
tmp = t_0 - (z / (y_m / x));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = (x + 4.0) / y_m tmp = 0 if x <= -1.45e-25: tmp = (x * (z / y_m)) - t_0 else: tmp = t_0 - (z / (y_m / x)) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(Float64(x + 4.0) / y_m) tmp = 0.0 if (x <= -1.45e-25) tmp = Float64(Float64(x * Float64(z / y_m)) - t_0); else tmp = Float64(t_0 - Float64(z / Float64(y_m / x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = (x + 4.0) / y_m; tmp = 0.0; if (x <= -1.45e-25) tmp = (x * (z / y_m)) - t_0; else tmp = t_0 - (z / (y_m / x)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]}, If[LessEqual[x, -1.45e-25], N[(N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(t$95$0 - N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y\_m}\\
\mathbf{if}\;x \leq -1.45 \cdot 10^{-25}:\\
\;\;\;\;x \cdot \frac{z}{y\_m} - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 - \frac{z}{\frac{y\_m}{x}}\\
\end{array}
\end{array}
if x < -1.45e-25Initial program 91.1%
fabs-sub91.1%
associate-*l/82.9%
associate-*r/91.3%
fmm-def97.1%
distribute-neg-frac97.1%
+-commutative97.1%
distribute-neg-in97.1%
unsub-neg97.1%
metadata-eval97.1%
Simplified97.1%
add-sqr-sqrt50.0%
fabs-sqr50.0%
add-sqr-sqrt50.6%
fma-undefine49.1%
associate-*r/44.9%
associate-*l/48.9%
div-inv48.8%
sub-neg48.8%
metadata-eval48.8%
distribute-neg-in48.8%
+-commutative48.8%
cancel-sign-sub-inv48.8%
associate-*l/44.8%
associate-*r/49.0%
div-inv49.1%
Applied egg-rr49.1%
if -1.45e-25 < x Initial program 94.1%
fabs-sub94.1%
associate-*l/93.8%
associate-*r/90.8%
fmm-def91.9%
distribute-neg-frac91.9%
+-commutative91.9%
distribute-neg-in91.9%
unsub-neg91.9%
metadata-eval91.9%
Simplified91.9%
add-sqr-sqrt42.5%
fabs-sqr42.5%
add-sqr-sqrt43.7%
fma-undefine43.7%
associate-*r/47.8%
associate-*l/47.4%
div-inv47.4%
sub-neg47.4%
metadata-eval47.4%
distribute-neg-in47.4%
+-commutative47.4%
cancel-sign-sub-inv47.4%
div-inv47.4%
associate-*l/47.8%
sub-div49.4%
Applied egg-rr49.4%
div-sub47.8%
associate-*r/43.7%
add-sqr-sqrt42.5%
fabs-sqr42.5%
add-sqr-sqrt90.8%
fabs-sub90.8%
*-commutative90.8%
associate-/r/94.2%
add-sqr-sqrt47.4%
fabs-sqr47.4%
add-sqr-sqrt48.6%
div-inv48.6%
clear-num48.6%
Applied egg-rr48.6%
clear-num48.6%
div-inv48.6%
Applied egg-rr48.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (/ (+ x 4.0) y_m))) (if (<= x -1.55e-25) (- (* x (/ z y_m)) t_0) (- t_0 (* z (/ x y_m))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = (x + 4.0) / y_m;
double tmp;
if (x <= -1.55e-25) {
tmp = (x * (z / y_m)) - t_0;
} else {
tmp = t_0 - (z * (x / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x + 4.0d0) / y_m
if (x <= (-1.55d-25)) then
tmp = (x * (z / y_m)) - t_0
else
tmp = t_0 - (z * (x / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = (x + 4.0) / y_m;
double tmp;
if (x <= -1.55e-25) {
tmp = (x * (z / y_m)) - t_0;
} else {
tmp = t_0 - (z * (x / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = (x + 4.0) / y_m tmp = 0 if x <= -1.55e-25: tmp = (x * (z / y_m)) - t_0 else: tmp = t_0 - (z * (x / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(Float64(x + 4.0) / y_m) tmp = 0.0 if (x <= -1.55e-25) tmp = Float64(Float64(x * Float64(z / y_m)) - t_0); else tmp = Float64(t_0 - Float64(z * Float64(x / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = (x + 4.0) / y_m; tmp = 0.0; if (x <= -1.55e-25) tmp = (x * (z / y_m)) - t_0; else tmp = t_0 - (z * (x / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]}, If[LessEqual[x, -1.55e-25], N[(N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(t$95$0 - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y\_m}\\
\mathbf{if}\;x \leq -1.55 \cdot 10^{-25}:\\
\;\;\;\;x \cdot \frac{z}{y\_m} - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 - z \cdot \frac{x}{y\_m}\\
\end{array}
\end{array}
if x < -1.54999999999999997e-25Initial program 91.1%
fabs-sub91.1%
associate-*l/82.9%
associate-*r/91.3%
fmm-def97.1%
distribute-neg-frac97.1%
+-commutative97.1%
distribute-neg-in97.1%
unsub-neg97.1%
metadata-eval97.1%
Simplified97.1%
add-sqr-sqrt50.0%
fabs-sqr50.0%
add-sqr-sqrt50.6%
fma-undefine49.1%
associate-*r/44.9%
associate-*l/48.9%
div-inv48.8%
sub-neg48.8%
metadata-eval48.8%
distribute-neg-in48.8%
+-commutative48.8%
cancel-sign-sub-inv48.8%
associate-*l/44.8%
associate-*r/49.0%
div-inv49.1%
Applied egg-rr49.1%
if -1.54999999999999997e-25 < x Initial program 94.1%
fabs-sub94.1%
associate-*l/93.8%
associate-*r/90.8%
fmm-def91.9%
distribute-neg-frac91.9%
+-commutative91.9%
distribute-neg-in91.9%
unsub-neg91.9%
metadata-eval91.9%
Simplified91.9%
add-sqr-sqrt42.5%
fabs-sqr42.5%
add-sqr-sqrt43.7%
fma-undefine43.7%
associate-*r/47.8%
associate-*l/47.4%
div-inv47.4%
sub-neg47.4%
metadata-eval47.4%
distribute-neg-in47.4%
+-commutative47.4%
cancel-sign-sub-inv47.4%
div-inv47.4%
associate-*l/47.8%
sub-div49.4%
Applied egg-rr49.4%
div-sub47.8%
associate-*r/43.7%
add-sqr-sqrt42.5%
fabs-sqr42.5%
add-sqr-sqrt90.8%
fabs-sub90.8%
*-commutative90.8%
associate-/r/94.2%
add-sqr-sqrt47.4%
fabs-sqr47.4%
add-sqr-sqrt48.6%
div-inv48.6%
clear-num48.6%
Applied egg-rr48.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -9.2e-26) (- (* x (/ z y_m)) (/ (+ x 4.0) y_m)) (/ (- (+ x 4.0) (* x z)) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -9.2e-26) {
tmp = (x * (z / y_m)) - ((x + 4.0) / y_m);
} else {
tmp = ((x + 4.0) - (x * z)) / y_m;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-9.2d-26)) then
tmp = (x * (z / y_m)) - ((x + 4.0d0) / y_m)
else
tmp = ((x + 4.0d0) - (x * z)) / y_m
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (x <= -9.2e-26) {
tmp = (x * (z / y_m)) - ((x + 4.0) / y_m);
} else {
tmp = ((x + 4.0) - (x * z)) / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -9.2e-26: tmp = (x * (z / y_m)) - ((x + 4.0) / y_m) else: tmp = ((x + 4.0) - (x * z)) / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -9.2e-26) tmp = Float64(Float64(x * Float64(z / y_m)) - Float64(Float64(x + 4.0) / y_m)); else tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -9.2e-26) tmp = (x * (z / y_m)) - ((x + 4.0) / y_m); else tmp = ((x + 4.0) - (x * z)) / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -9.2e-26], N[(N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.2 \cdot 10^{-26}:\\
\;\;\;\;x \cdot \frac{z}{y\_m} - \frac{x + 4}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\
\end{array}
\end{array}
if x < -9.20000000000000035e-26Initial program 91.1%
fabs-sub91.1%
associate-*l/82.9%
associate-*r/91.3%
fmm-def97.1%
distribute-neg-frac97.1%
+-commutative97.1%
distribute-neg-in97.1%
unsub-neg97.1%
metadata-eval97.1%
Simplified97.1%
add-sqr-sqrt50.0%
fabs-sqr50.0%
add-sqr-sqrt50.6%
fma-undefine49.1%
associate-*r/44.9%
associate-*l/48.9%
div-inv48.8%
sub-neg48.8%
metadata-eval48.8%
distribute-neg-in48.8%
+-commutative48.8%
cancel-sign-sub-inv48.8%
associate-*l/44.8%
associate-*r/49.0%
div-inv49.1%
Applied egg-rr49.1%
if -9.20000000000000035e-26 < x Initial program 94.1%
fabs-sub94.1%
associate-*l/93.8%
associate-*r/90.8%
fmm-def91.9%
distribute-neg-frac91.9%
+-commutative91.9%
distribute-neg-in91.9%
unsub-neg91.9%
metadata-eval91.9%
Simplified91.9%
fma-undefine90.8%
associate-*r/93.8%
associate-*l/94.1%
div-inv94.1%
sub-neg94.1%
metadata-eval94.1%
distribute-neg-in94.1%
+-commutative94.1%
cancel-sign-sub-inv94.1%
div-inv94.1%
fabs-sub94.1%
add-sqr-sqrt47.4%
fabs-sqr47.4%
add-sqr-sqrt48.6%
associate-*l/47.8%
sub-div48.9%
Applied egg-rr48.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -1.55e-25) (/ (- (* x z) (+ x 4.0)) y_m) (/ (- (+ x 4.0) (* x z)) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -1.55e-25) {
tmp = ((x * z) - (x + 4.0)) / y_m;
} else {
tmp = ((x + 4.0) - (x * z)) / y_m;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.55d-25)) then
tmp = ((x * z) - (x + 4.0d0)) / y_m
else
tmp = ((x + 4.0d0) - (x * z)) / y_m
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (x <= -1.55e-25) {
tmp = ((x * z) - (x + 4.0)) / y_m;
} else {
tmp = ((x + 4.0) - (x * z)) / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -1.55e-25: tmp = ((x * z) - (x + 4.0)) / y_m else: tmp = ((x + 4.0) - (x * z)) / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -1.55e-25) tmp = Float64(Float64(Float64(x * z) - Float64(x + 4.0)) / y_m); else tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -1.55e-25) tmp = ((x * z) - (x + 4.0)) / y_m; else tmp = ((x + 4.0) - (x * z)) / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -1.55e-25], N[(N[(N[(x * z), $MachinePrecision] - N[(x + 4.0), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-25}:\\
\;\;\;\;\frac{x \cdot z - \left(x + 4\right)}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\
\end{array}
\end{array}
if x < -1.54999999999999997e-25Initial program 91.1%
fabs-sub91.1%
associate-*l/82.9%
associate-*r/91.3%
fmm-def97.1%
distribute-neg-frac97.1%
+-commutative97.1%
distribute-neg-in97.1%
unsub-neg97.1%
metadata-eval97.1%
Simplified97.1%
add-sqr-sqrt50.0%
fabs-sqr50.0%
add-sqr-sqrt50.6%
fma-undefine49.1%
associate-*r/44.9%
associate-*l/48.9%
div-inv48.8%
sub-neg48.8%
metadata-eval48.8%
distribute-neg-in48.8%
+-commutative48.8%
cancel-sign-sub-inv48.8%
div-inv48.9%
associate-*l/44.9%
sub-div47.8%
Applied egg-rr47.8%
if -1.54999999999999997e-25 < x Initial program 94.1%
fabs-sub94.1%
associate-*l/93.8%
associate-*r/90.8%
fmm-def91.9%
distribute-neg-frac91.9%
+-commutative91.9%
distribute-neg-in91.9%
unsub-neg91.9%
metadata-eval91.9%
Simplified91.9%
fma-undefine90.8%
associate-*r/93.8%
associate-*l/94.1%
div-inv94.1%
sub-neg94.1%
metadata-eval94.1%
distribute-neg-in94.1%
+-commutative94.1%
cancel-sign-sub-inv94.1%
div-inv94.1%
fabs-sub94.1%
add-sqr-sqrt47.4%
fabs-sqr47.4%
add-sqr-sqrt48.6%
associate-*l/47.8%
sub-div48.9%
Applied egg-rr48.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (/ (- (* x z) (+ x 4.0)) y_m))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return ((x * z) - (x + 4.0)) / y_m;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = ((x * z) - (x + 4.0d0)) / y_m
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return ((x * z) - (x + 4.0)) / y_m;
}
y_m = math.fabs(y) def code(x, y_m, z): return ((x * z) - (x + 4.0)) / y_m
y_m = abs(y) function code(x, y_m, z) return Float64(Float64(Float64(x * z) - Float64(x + 4.0)) / y_m) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = ((x * z) - (x + 4.0)) / y_m; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[(N[(N[(x * z), $MachinePrecision] - N[(x + 4.0), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\frac{x \cdot z - \left(x + 4\right)}{y\_m}
\end{array}
Initial program 93.3%
fabs-sub93.3%
associate-*l/90.9%
associate-*r/90.9%
fmm-def93.3%
distribute-neg-frac93.3%
+-commutative93.3%
distribute-neg-in93.3%
unsub-neg93.3%
metadata-eval93.3%
Simplified93.3%
add-sqr-sqrt44.5%
fabs-sqr44.5%
add-sqr-sqrt45.6%
fma-undefine45.2%
associate-*r/47.0%
associate-*l/47.8%
div-inv47.8%
sub-neg47.8%
metadata-eval47.8%
distribute-neg-in47.8%
+-commutative47.8%
cancel-sign-sub-inv47.8%
div-inv47.8%
associate-*l/47.0%
sub-div49.0%
Applied egg-rr49.0%
herbie shell --seed 2024179
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))