
(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 15 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 1.15e-108) (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 <= 1.15e-108) {
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 <= 1.15e-108) 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, 1.15e-108], 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 1.15 \cdot 10^{-108}:\\
\;\;\;\;\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 < 1.14999999999999998e-108Initial program 88.4%
Simplified99.3%
if 1.14999999999999998e-108 < y Initial program 94.4%
fabs-sub94.4%
associate-*l/94.9%
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 (- (* z (/ x y_m)) t_0))))
(if (<= t_1 4e+117)
(fabs (- t_0 (/ x (/ y_m z))))
(if (<= t_1 INFINITY) t_1 (fabs (* (/ -1.0 y_m) (* x z)))))))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(((z * (x / y_m)) - t_0));
double tmp;
if (t_1 <= 4e+117) {
tmp = fabs((t_0 - (x / (y_m / z))));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fabs(((-1.0 / y_m) * (x * z)));
}
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 t_1 = Math.abs(((z * (x / y_m)) - t_0));
double tmp;
if (t_1 <= 4e+117) {
tmp = Math.abs((t_0 - (x / (y_m / z))));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = Math.abs(((-1.0 / y_m) * (x * z)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = (x + 4.0) / y_m t_1 = math.fabs(((z * (x / y_m)) - t_0)) tmp = 0 if t_1 <= 4e+117: tmp = math.fabs((t_0 - (x / (y_m / z)))) elif t_1 <= math.inf: tmp = t_1 else: tmp = math.fabs(((-1.0 / y_m) * (x * z))) 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(Float64(z * Float64(x / y_m)) - t_0)) tmp = 0.0 if (t_1 <= 4e+117) tmp = abs(Float64(t_0 - Float64(x / Float64(y_m / z)))); elseif (t_1 <= Inf) tmp = t_1; else tmp = abs(Float64(Float64(-1.0 / y_m) * Float64(x * z))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = (x + 4.0) / y_m; t_1 = abs(((z * (x / y_m)) - t_0)); tmp = 0.0; if (t_1 <= 4e+117) tmp = abs((t_0 - (x / (y_m / z)))); elseif (t_1 <= Inf) tmp = t_1; else tmp = abs(((-1.0 / y_m) * (x * z))); 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]}, Block[{t$95$1 = N[Abs[N[(N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 4e+117], N[Abs[N[(t$95$0 - N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$1, N[Abs[N[(N[(-1.0 / y$95$m), $MachinePrecision] * N[(x * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y\_m}\\
t_1 := \left|z \cdot \frac{x}{y\_m} - t\_0\right|\\
\mathbf{if}\;t\_1 \leq 4 \cdot 10^{+117}:\\
\;\;\;\;\left|t\_0 - \frac{x}{\frac{y\_m}{z}}\right|\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-1}{y\_m} \cdot \left(x \cdot z\right)\right|\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 4.0000000000000002e117Initial program 93.4%
associate-*l/99.8%
associate-*r/99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
if 4.0000000000000002e117 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < +inf.0Initial program 99.9%
if +inf.0 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) Initial program 0.0%
Simplified100.0%
Taylor expanded in z around inf 82.1%
Final simplification98.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (fabs (- (* z (/ x y_m)) (/ (+ x 4.0) y_m))))) (if (<= t_0 INFINITY) t_0 (fabs (* (/ -1.0 y_m) (* x z))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs(((z * (x / y_m)) - ((x + 4.0) / y_m)));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0;
} else {
tmp = fabs(((-1.0 / y_m) * (x * z)));
}
return tmp;
}
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = Math.abs(((z * (x / y_m)) - ((x + 4.0) / y_m)));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0;
} else {
tmp = Math.abs(((-1.0 / y_m) * (x * z)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs(((z * (x / y_m)) - ((x + 4.0) / y_m))) tmp = 0 if t_0 <= math.inf: tmp = t_0 else: tmp = math.fabs(((-1.0 / y_m) * (x * z))) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(Float64(z * Float64(x / y_m)) - Float64(Float64(x + 4.0) / y_m))) tmp = 0.0 if (t_0 <= Inf) tmp = t_0; else tmp = abs(Float64(Float64(-1.0 / y_m) * Float64(x * z))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs(((z * (x / y_m)) - ((x + 4.0) / y_m))); tmp = 0.0; if (t_0 <= Inf) tmp = t_0; else tmp = abs(((-1.0 / y_m) * (x * z))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], t$95$0, N[Abs[N[(N[(-1.0 / y$95$m), $MachinePrecision] * N[(x * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|z \cdot \frac{x}{y\_m} - \frac{x + 4}{y\_m}\right|\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-1}{y\_m} \cdot \left(x \cdot z\right)\right|\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < +inf.0Initial program 96.3%
if +inf.0 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) Initial program 0.0%
Simplified100.0%
Taylor expanded in z around inf 82.1%
Final simplification95.4%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 4e-109) (fabs (* (/ -1.0 y_m) (fma x z (- -4.0 x)))) (fabs (- (/ (+ x 4.0) y_m) (/ x (/ y_m z))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 4e-109) {
tmp = fabs(((-1.0 / y_m) * fma(x, z, (-4.0 - x))));
} else {
tmp = fabs((((x + 4.0) / y_m) - (x / (y_m / z))));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 4e-109) tmp = abs(Float64(Float64(-1.0 / y_m) * fma(x, z, Float64(-4.0 - x)))); else tmp = abs(Float64(Float64(Float64(x + 4.0) / y_m) - Float64(x / Float64(y_m / z)))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 4e-109], N[Abs[N[(N[(-1.0 / y$95$m), $MachinePrecision] * N[(x * z + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 4 \cdot 10^{-109}:\\
\;\;\;\;\left|\frac{-1}{y\_m} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y\_m} - \frac{x}{\frac{y\_m}{z}}\right|\\
\end{array}
\end{array}
if y < 4e-109Initial program 88.4%
Simplified99.3%
if 4e-109 < y Initial program 94.4%
associate-*l/94.9%
associate-*r/99.9%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -7.2e-17) (not (<= x 8.5e+22))) (fabs (- (/ x y_m) (/ x (/ y_m z)))) (/ (- (+ x 4.0) (* x z)) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -7.2e-17) || !(x <= 8.5e+22)) {
tmp = fabs(((x / y_m) - (x / (y_m / z))));
} 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 <= (-7.2d-17)) .or. (.not. (x <= 8.5d+22))) then
tmp = abs(((x / y_m) - (x / (y_m / z))))
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 <= -7.2e-17) || !(x <= 8.5e+22)) {
tmp = Math.abs(((x / y_m) - (x / (y_m / z))));
} 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 <= -7.2e-17) or not (x <= 8.5e+22): tmp = math.fabs(((x / y_m) - (x / (y_m / z)))) 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 <= -7.2e-17) || !(x <= 8.5e+22)) tmp = abs(Float64(Float64(x / y_m) - Float64(x / Float64(y_m / z)))); 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 <= -7.2e-17) || ~((x <= 8.5e+22))) tmp = abs(((x / y_m) - (x / (y_m / z)))); 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[Or[LessEqual[x, -7.2e-17], N[Not[LessEqual[x, 8.5e+22]], $MachinePrecision]], N[Abs[N[(N[(x / y$95$m), $MachinePrecision] - N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $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 -7.2 \cdot 10^{-17} \lor \neg \left(x \leq 8.5 \cdot 10^{+22}\right):\\
\;\;\;\;\left|\frac{x}{y\_m} - \frac{x}{\frac{y\_m}{z}}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\
\end{array}
\end{array}
if x < -7.1999999999999999e-17 or 8.49999999999999979e22 < x Initial program 87.0%
associate-*l/85.5%
associate-*r/89.6%
clear-num89.6%
un-div-inv89.6%
Applied egg-rr89.6%
Taylor expanded in x around inf 88.8%
if -7.1999999999999999e-17 < x < 8.49999999999999979e22Initial program 93.0%
fabs-sub93.0%
associate-*l/99.2%
associate-*r/95.2%
fmm-def95.2%
distribute-neg-frac95.2%
+-commutative95.2%
distribute-neg-in95.2%
unsub-neg95.2%
metadata-eval95.2%
Simplified95.2%
fma-undefine95.2%
associate-*r/99.2%
associate-*l/93.0%
div-inv93.0%
sub-neg93.0%
metadata-eval93.0%
distribute-neg-in93.0%
+-commutative93.0%
cancel-sign-sub-inv93.0%
div-inv93.0%
fabs-sub93.0%
add-sqr-sqrt44.9%
fabs-sqr44.9%
add-sqr-sqrt46.2%
associate-*l/48.5%
sub-div48.5%
Applied egg-rr48.5%
Final simplification66.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -7400.0) (* (/ x y_m) (+ -1.0 z)) (if (<= x 4.0) (/ (- 4.0 (* x z)) y_m) (/ (* x (- 1.0 z)) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -7400.0) {
tmp = (x / y_m) * (-1.0 + z);
} else if (x <= 4.0) {
tmp = (4.0 - (x * z)) / y_m;
} else {
tmp = (x * (1.0 - 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 <= (-7400.0d0)) then
tmp = (x / y_m) * ((-1.0d0) + z)
else if (x <= 4.0d0) then
tmp = (4.0d0 - (x * z)) / y_m
else
tmp = (x * (1.0d0 - 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 <= -7400.0) {
tmp = (x / y_m) * (-1.0 + z);
} else if (x <= 4.0) {
tmp = (4.0 - (x * z)) / y_m;
} else {
tmp = (x * (1.0 - z)) / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -7400.0: tmp = (x / y_m) * (-1.0 + z) elif x <= 4.0: tmp = (4.0 - (x * z)) / y_m else: tmp = (x * (1.0 - z)) / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -7400.0) tmp = Float64(Float64(x / y_m) * Float64(-1.0 + z)); elseif (x <= 4.0) tmp = Float64(Float64(4.0 - Float64(x * z)) / y_m); else tmp = Float64(Float64(x * Float64(1.0 - z)) / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -7400.0) tmp = (x / y_m) * (-1.0 + z); elseif (x <= 4.0) tmp = (4.0 - (x * z)) / y_m; else tmp = (x * (1.0 - z)) / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -7400.0], N[(N[(x / y$95$m), $MachinePrecision] * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.0], N[(N[(4.0 - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7400:\\
\;\;\;\;\frac{x}{y\_m} \cdot \left(-1 + z\right)\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4 - x \cdot z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(1 - z\right)}{y\_m}\\
\end{array}
\end{array}
if x < -7400Initial program 86.2%
fabs-sub86.2%
associate-*l/81.5%
associate-*r/88.0%
fmm-def96.5%
distribute-neg-frac96.5%
+-commutative96.5%
distribute-neg-in96.5%
unsub-neg96.5%
metadata-eval96.5%
Simplified96.5%
add-sqr-sqrt52.3%
fabs-sqr52.3%
add-sqr-sqrt52.9%
fma-undefine46.0%
associate-*r/42.8%
associate-*l/44.3%
div-inv44.3%
sub-neg44.3%
metadata-eval44.3%
distribute-neg-in44.3%
+-commutative44.3%
cancel-sign-sub-inv44.3%
div-inv44.3%
associate-*l/42.8%
sub-div51.3%
Applied egg-rr51.3%
Taylor expanded in x around inf 51.3%
sub-neg51.3%
metadata-eval51.3%
distribute-lft-in51.3%
*-commutative51.3%
neg-mul-151.3%
sub-neg51.3%
div-sub42.8%
associate-*l/44.3%
fmm-def44.4%
neg-mul-144.4%
fma-define44.3%
*-commutative44.3%
distribute-lft-out54.5%
Simplified54.5%
if -7400 < x < 4Initial program 93.7%
fabs-sub93.7%
associate-*l/99.9%
associate-*r/96.0%
fmm-def96.0%
distribute-neg-frac96.0%
+-commutative96.0%
distribute-neg-in96.0%
unsub-neg96.0%
metadata-eval96.0%
Simplified96.0%
fma-undefine96.0%
associate-*r/99.9%
associate-*l/93.7%
div-inv93.7%
sub-neg93.7%
metadata-eval93.7%
distribute-neg-in93.7%
+-commutative93.7%
cancel-sign-sub-inv93.7%
div-inv93.7%
fabs-sub93.7%
add-sqr-sqrt44.5%
fabs-sqr44.5%
add-sqr-sqrt45.9%
associate-*l/48.1%
sub-div48.2%
Applied egg-rr48.2%
Taylor expanded in x around 0 48.0%
if 4 < x Initial program 85.9%
fabs-sub85.9%
associate-*l/87.7%
associate-*r/89.4%
fmm-def94.7%
distribute-neg-frac94.7%
+-commutative94.7%
distribute-neg-in94.7%
unsub-neg94.7%
metadata-eval94.7%
Simplified94.7%
fma-undefine89.4%
associate-*r/87.7%
associate-*l/85.9%
div-inv85.8%
sub-neg85.8%
metadata-eval85.8%
distribute-neg-in85.8%
+-commutative85.8%
cancel-sign-sub-inv85.8%
div-inv85.9%
fabs-sub85.9%
add-sqr-sqrt33.2%
fabs-sqr33.2%
add-sqr-sqrt33.8%
associate-*l/32.0%
sub-div35.5%
Applied egg-rr35.5%
Taylor expanded in x around inf 35.6%
Final simplification46.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -1.45e-17) (* x (/ (+ -1.0 z) y_m)) (if (<= x 2.9e+23) (/ (+ x 4.0) y_m) (* x (/ (- 1.0 z) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -1.45e-17) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 2.9e+23) {
tmp = (x + 4.0) / y_m;
} else {
tmp = x * ((1.0 - 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.45d-17)) then
tmp = x * (((-1.0d0) + z) / y_m)
else if (x <= 2.9d+23) then
tmp = (x + 4.0d0) / y_m
else
tmp = x * ((1.0d0 - 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.45e-17) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 2.9e+23) {
tmp = (x + 4.0) / y_m;
} else {
tmp = x * ((1.0 - z) / y_m);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -1.45e-17: tmp = x * ((-1.0 + z) / y_m) elif x <= 2.9e+23: tmp = (x + 4.0) / y_m else: tmp = x * ((1.0 - z) / y_m) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -1.45e-17) tmp = Float64(x * Float64(Float64(-1.0 + z) / y_m)); elseif (x <= 2.9e+23) tmp = Float64(Float64(x + 4.0) / y_m); else tmp = Float64(x * Float64(Float64(1.0 - 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.45e-17) tmp = x * ((-1.0 + z) / y_m); elseif (x <= 2.9e+23) tmp = (x + 4.0) / y_m; else tmp = x * ((1.0 - z) / y_m); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -1.45e-17], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.9e+23], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision], N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-17}:\\
\;\;\;\;x \cdot \frac{-1 + z}{y\_m}\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+23}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1 - z}{y\_m}\\
\end{array}
\end{array}
if x < -1.4500000000000001e-17Initial program 86.8%
fabs-sub86.8%
associate-*l/82.4%
associate-*r/88.5%
fmm-def96.6%
distribute-neg-frac96.6%
+-commutative96.6%
distribute-neg-in96.6%
unsub-neg96.6%
metadata-eval96.6%
Simplified96.6%
add-sqr-sqrt54.5%
fabs-sqr54.5%
add-sqr-sqrt55.1%
fma-undefine48.6%
associate-*r/45.6%
associate-*l/47.0%
div-inv46.9%
sub-neg46.9%
metadata-eval46.9%
distribute-neg-in46.9%
+-commutative46.9%
cancel-sign-sub-inv46.9%
div-inv47.0%
associate-*l/45.6%
sub-div53.6%
Applied egg-rr53.6%
Taylor expanded in x around inf 52.0%
sub-neg52.0%
metadata-eval52.0%
distribute-lft-in52.1%
*-commutative52.1%
neg-mul-152.1%
sub-neg52.1%
div-sub44.0%
associate-*l/45.4%
fmm-def45.4%
neg-mul-145.4%
fma-define45.4%
*-commutative45.4%
distribute-lft-out55.1%
Simplified55.1%
Taylor expanded in x around 0 52.0%
sub-neg52.0%
metadata-eval52.0%
associate-*r/55.1%
Simplified55.1%
if -1.4500000000000001e-17 < x < 2.90000000000000013e23Initial program 93.0%
fabs-sub93.0%
associate-*l/99.2%
associate-*r/95.3%
fmm-def95.3%
distribute-neg-frac95.3%
+-commutative95.3%
distribute-neg-in95.3%
unsub-neg95.3%
metadata-eval95.3%
Simplified95.3%
fma-undefine95.3%
associate-*r/99.2%
associate-*l/93.0%
div-inv93.0%
sub-neg93.0%
metadata-eval93.0%
distribute-neg-in93.0%
+-commutative93.0%
cancel-sign-sub-inv93.0%
div-inv93.0%
fabs-sub93.0%
add-sqr-sqrt45.3%
fabs-sqr45.3%
add-sqr-sqrt46.6%
associate-*l/48.9%
sub-div48.9%
Applied egg-rr48.9%
Taylor expanded in z around 0 41.3%
if 2.90000000000000013e23 < x Initial program 87.0%
fabs-sub87.0%
associate-*l/88.8%
associate-*r/90.7%
fmm-def96.2%
distribute-neg-frac96.2%
+-commutative96.2%
distribute-neg-in96.2%
unsub-neg96.2%
metadata-eval96.2%
Simplified96.2%
fma-undefine90.7%
associate-*r/88.8%
associate-*l/87.0%
div-inv86.9%
sub-neg86.9%
metadata-eval86.9%
distribute-neg-in86.9%
+-commutative86.9%
cancel-sign-sub-inv86.9%
div-inv87.0%
fabs-sub87.0%
add-sqr-sqrt33.2%
fabs-sqr33.2%
add-sqr-sqrt33.8%
associate-*l/31.9%
sub-div35.6%
Applied egg-rr35.6%
Taylor expanded in x around inf 35.7%
associate-/l*37.5%
Simplified37.5%
Final simplification43.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -20000.0) (* (/ x y_m) (+ -1.0 z)) (/ (- (+ x 4.0) (* x z)) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -20000.0) {
tmp = (x / y_m) * (-1.0 + z);
} 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 <= (-20000.0d0)) then
tmp = (x / y_m) * ((-1.0d0) + z)
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 <= -20000.0) {
tmp = (x / y_m) * (-1.0 + z);
} 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 <= -20000.0: tmp = (x / y_m) * (-1.0 + z) 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 <= -20000.0) tmp = Float64(Float64(x / y_m) * Float64(-1.0 + z)); 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 <= -20000.0) tmp = (x / y_m) * (-1.0 + z); 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, -20000.0], N[(N[(x / y$95$m), $MachinePrecision] * N[(-1.0 + z), $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 -20000:\\
\;\;\;\;\frac{x}{y\_m} \cdot \left(-1 + z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\
\end{array}
\end{array}
if x < -2e4Initial program 86.2%
fabs-sub86.2%
associate-*l/81.5%
associate-*r/88.0%
fmm-def96.5%
distribute-neg-frac96.5%
+-commutative96.5%
distribute-neg-in96.5%
unsub-neg96.5%
metadata-eval96.5%
Simplified96.5%
add-sqr-sqrt52.3%
fabs-sqr52.3%
add-sqr-sqrt52.9%
fma-undefine46.0%
associate-*r/42.8%
associate-*l/44.3%
div-inv44.3%
sub-neg44.3%
metadata-eval44.3%
distribute-neg-in44.3%
+-commutative44.3%
cancel-sign-sub-inv44.3%
div-inv44.3%
associate-*l/42.8%
sub-div51.3%
Applied egg-rr51.3%
Taylor expanded in x around inf 51.3%
sub-neg51.3%
metadata-eval51.3%
distribute-lft-in51.3%
*-commutative51.3%
neg-mul-151.3%
sub-neg51.3%
div-sub42.8%
associate-*l/44.3%
fmm-def44.4%
neg-mul-144.4%
fma-define44.3%
*-commutative44.3%
distribute-lft-out54.5%
Simplified54.5%
if -2e4 < x Initial program 91.5%
fabs-sub91.5%
associate-*l/96.3%
associate-*r/94.1%
fmm-def95.6%
distribute-neg-frac95.6%
+-commutative95.6%
distribute-neg-in95.6%
unsub-neg95.6%
metadata-eval95.6%
Simplified95.6%
fma-undefine94.1%
associate-*r/96.3%
associate-*l/91.5%
div-inv91.4%
sub-neg91.4%
metadata-eval91.4%
distribute-neg-in91.4%
+-commutative91.4%
cancel-sign-sub-inv91.4%
div-inv91.5%
fabs-sub91.5%
add-sqr-sqrt41.3%
fabs-sqr41.3%
add-sqr-sqrt42.4%
associate-*l/43.5%
sub-div44.5%
Applied egg-rr44.5%
Final simplification46.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -10.5) (/ x (- y_m)) (if (<= x 4.0) (/ 4.0 y_m) (/ x y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -10.5) {
tmp = x / -y_m;
} else if (x <= 4.0) {
tmp = 4.0 / y_m;
} else {
tmp = 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) :: tmp
if (x <= (-10.5d0)) then
tmp = x / -y_m
else if (x <= 4.0d0) then
tmp = 4.0d0 / y_m
else
tmp = 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 tmp;
if (x <= -10.5) {
tmp = x / -y_m;
} else if (x <= 4.0) {
tmp = 4.0 / y_m;
} else {
tmp = x / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -10.5: tmp = x / -y_m elif x <= 4.0: tmp = 4.0 / y_m else: tmp = x / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -10.5) tmp = Float64(x / Float64(-y_m)); elseif (x <= 4.0) tmp = Float64(4.0 / y_m); else tmp = Float64(x / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -10.5) tmp = x / -y_m; elseif (x <= 4.0) tmp = 4.0 / y_m; else tmp = x / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -10.5], N[(x / (-y$95$m)), $MachinePrecision], If[LessEqual[x, 4.0], N[(4.0 / y$95$m), $MachinePrecision], N[(x / y$95$m), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -10.5:\\
\;\;\;\;\frac{x}{-y\_m}\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\
\end{array}
\end{array}
if x < -10.5Initial program 86.5%
fabs-sub86.5%
associate-*l/81.9%
associate-*r/88.2%
fmm-def96.5%
distribute-neg-frac96.5%
+-commutative96.5%
distribute-neg-in96.5%
unsub-neg96.5%
metadata-eval96.5%
Simplified96.5%
add-sqr-sqrt53.1%
fabs-sqr53.1%
add-sqr-sqrt53.6%
fma-undefine46.9%
associate-*r/43.8%
associate-*l/45.3%
div-inv45.2%
sub-neg45.2%
metadata-eval45.2%
distribute-neg-in45.2%
+-commutative45.2%
cancel-sign-sub-inv45.2%
div-inv45.3%
associate-*l/43.8%
sub-div52.1%
Applied egg-rr52.1%
Taylor expanded in x around inf 52.1%
sub-neg52.1%
metadata-eval52.1%
distribute-lft-in52.1%
*-commutative52.1%
neg-mul-152.1%
sub-neg52.1%
div-sub43.8%
associate-*l/45.3%
fmm-def45.3%
neg-mul-145.3%
fma-define45.3%
*-commutative45.3%
distribute-lft-out55.3%
Simplified55.3%
Taylor expanded in z around 0 30.5%
mul-1-neg30.5%
distribute-frac-neg30.5%
Simplified30.5%
if -10.5 < x < 4Initial program 93.7%
fabs-sub93.7%
associate-*l/99.9%
associate-*r/95.9%
fmm-def95.9%
distribute-neg-frac95.9%
+-commutative95.9%
distribute-neg-in95.9%
unsub-neg95.9%
metadata-eval95.9%
Simplified95.9%
fma-undefine95.9%
associate-*r/99.9%
associate-*l/93.7%
div-inv93.7%
sub-neg93.7%
metadata-eval93.7%
distribute-neg-in93.7%
+-commutative93.7%
cancel-sign-sub-inv93.7%
div-inv93.7%
fabs-sub93.7%
add-sqr-sqrt44.9%
fabs-sqr44.9%
add-sqr-sqrt46.2%
associate-*l/48.5%
sub-div48.5%
Applied egg-rr48.5%
Taylor expanded in x around 0 40.0%
if 4 < x Initial program 85.9%
fabs-sub85.9%
associate-*l/87.7%
associate-*r/89.4%
fmm-def94.7%
distribute-neg-frac94.7%
+-commutative94.7%
distribute-neg-in94.7%
unsub-neg94.7%
metadata-eval94.7%
Simplified94.7%
fma-undefine89.4%
associate-*r/87.7%
associate-*l/85.9%
div-inv85.8%
sub-neg85.8%
metadata-eval85.8%
distribute-neg-in85.8%
+-commutative85.8%
cancel-sign-sub-inv85.8%
div-inv85.9%
fabs-sub85.9%
add-sqr-sqrt33.2%
fabs-sqr33.2%
add-sqr-sqrt33.8%
sub-neg33.8%
distribute-rgt-neg-in33.8%
Applied egg-rr33.8%
Taylor expanded in x around inf 33.8%
Taylor expanded in z around 0 28.2%
Final simplification35.2%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -7.2e-17) (* x (/ (+ -1.0 z) y_m)) (/ (+ x 4.0) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -7.2e-17) {
tmp = x * ((-1.0 + z) / y_m);
} else {
tmp = (x + 4.0) / 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 <= (-7.2d-17)) then
tmp = x * (((-1.0d0) + z) / y_m)
else
tmp = (x + 4.0d0) / 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 <= -7.2e-17) {
tmp = x * ((-1.0 + z) / y_m);
} else {
tmp = (x + 4.0) / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -7.2e-17: tmp = x * ((-1.0 + z) / y_m) else: tmp = (x + 4.0) / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -7.2e-17) tmp = Float64(x * Float64(Float64(-1.0 + z) / y_m)); else tmp = Float64(Float64(x + 4.0) / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -7.2e-17) tmp = x * ((-1.0 + z) / y_m); else tmp = (x + 4.0) / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -7.2e-17], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-17}:\\
\;\;\;\;x \cdot \frac{-1 + z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\
\end{array}
\end{array}
if x < -7.1999999999999999e-17Initial program 86.8%
fabs-sub86.8%
associate-*l/82.4%
associate-*r/88.5%
fmm-def96.6%
distribute-neg-frac96.6%
+-commutative96.6%
distribute-neg-in96.6%
unsub-neg96.6%
metadata-eval96.6%
Simplified96.6%
add-sqr-sqrt54.5%
fabs-sqr54.5%
add-sqr-sqrt55.1%
fma-undefine48.6%
associate-*r/45.6%
associate-*l/47.0%
div-inv46.9%
sub-neg46.9%
metadata-eval46.9%
distribute-neg-in46.9%
+-commutative46.9%
cancel-sign-sub-inv46.9%
div-inv47.0%
associate-*l/45.6%
sub-div53.6%
Applied egg-rr53.6%
Taylor expanded in x around inf 52.0%
sub-neg52.0%
metadata-eval52.0%
distribute-lft-in52.1%
*-commutative52.1%
neg-mul-152.1%
sub-neg52.1%
div-sub44.0%
associate-*l/45.4%
fmm-def45.4%
neg-mul-145.4%
fma-define45.4%
*-commutative45.4%
distribute-lft-out55.1%
Simplified55.1%
Taylor expanded in x around 0 52.0%
sub-neg52.0%
metadata-eval52.0%
associate-*r/55.1%
Simplified55.1%
if -7.1999999999999999e-17 < x Initial program 91.3%
fabs-sub91.3%
associate-*l/96.3%
associate-*r/94.0%
fmm-def95.5%
distribute-neg-frac95.5%
+-commutative95.5%
distribute-neg-in95.5%
unsub-neg95.5%
metadata-eval95.5%
Simplified95.5%
fma-undefine94.0%
associate-*r/96.3%
associate-*l/91.3%
div-inv91.3%
sub-neg91.3%
metadata-eval91.3%
distribute-neg-in91.3%
+-commutative91.3%
cancel-sign-sub-inv91.3%
div-inv91.3%
fabs-sub91.3%
add-sqr-sqrt41.9%
fabs-sqr41.9%
add-sqr-sqrt43.1%
associate-*l/44.1%
sub-div45.2%
Applied egg-rr45.2%
Taylor expanded in z around 0 37.1%
Final simplification41.4%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -4.0) (/ (- -4.0 x) y_m) (/ (+ x 4.0) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -4.0) {
tmp = (-4.0 - x) / y_m;
} else {
tmp = (x + 4.0) / 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 <= (-4.0d0)) then
tmp = ((-4.0d0) - x) / y_m
else
tmp = (x + 4.0d0) / 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 <= -4.0) {
tmp = (-4.0 - x) / y_m;
} else {
tmp = (x + 4.0) / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -4.0: tmp = (-4.0 - x) / y_m else: tmp = (x + 4.0) / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -4.0) tmp = Float64(Float64(-4.0 - x) / y_m); else tmp = Float64(Float64(x + 4.0) / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -4.0) tmp = (-4.0 - x) / y_m; else tmp = (x + 4.0) / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -4.0], N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4:\\
\;\;\;\;\frac{-4 - x}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\
\end{array}
\end{array}
if x < -4Initial program 86.5%
fabs-sub86.5%
associate-*l/81.9%
associate-*r/88.2%
fmm-def96.5%
distribute-neg-frac96.5%
+-commutative96.5%
distribute-neg-in96.5%
unsub-neg96.5%
metadata-eval96.5%
Simplified96.5%
add-sqr-sqrt53.1%
fabs-sqr53.1%
add-sqr-sqrt53.6%
fma-undefine46.9%
associate-*r/43.8%
associate-*l/45.3%
div-inv45.2%
sub-neg45.2%
metadata-eval45.2%
distribute-neg-in45.2%
+-commutative45.2%
cancel-sign-sub-inv45.2%
div-inv45.3%
associate-*l/43.8%
sub-div52.1%
Applied egg-rr52.1%
Taylor expanded in z around 0 30.5%
associate-*r/30.5%
distribute-lft-in30.5%
metadata-eval30.5%
neg-mul-130.5%
sub-neg30.5%
Simplified30.5%
if -4 < x Initial program 91.4%
fabs-sub91.4%
associate-*l/96.3%
associate-*r/94.0%
fmm-def95.6%
distribute-neg-frac95.6%
+-commutative95.6%
distribute-neg-in95.6%
unsub-neg95.6%
metadata-eval95.6%
Simplified95.6%
fma-undefine94.0%
associate-*r/96.3%
associate-*l/91.4%
div-inv91.4%
sub-neg91.4%
metadata-eval91.4%
distribute-neg-in91.4%
+-commutative91.4%
cancel-sign-sub-inv91.4%
div-inv91.4%
fabs-sub91.4%
add-sqr-sqrt41.5%
fabs-sqr41.5%
add-sqr-sqrt42.6%
associate-*l/43.7%
sub-div44.7%
Applied egg-rr44.7%
Taylor expanded in z around 0 36.7%
Final simplification35.3%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -4.0) (/ x (- y_m)) (/ (+ x 4.0) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -4.0) {
tmp = x / -y_m;
} else {
tmp = (x + 4.0) / 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 <= (-4.0d0)) then
tmp = x / -y_m
else
tmp = (x + 4.0d0) / 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 <= -4.0) {
tmp = x / -y_m;
} else {
tmp = (x + 4.0) / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -4.0: tmp = x / -y_m else: tmp = (x + 4.0) / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -4.0) tmp = Float64(x / Float64(-y_m)); else tmp = Float64(Float64(x + 4.0) / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -4.0) tmp = x / -y_m; else tmp = (x + 4.0) / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -4.0], N[(x / (-y$95$m)), $MachinePrecision], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4:\\
\;\;\;\;\frac{x}{-y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\
\end{array}
\end{array}
if x < -4Initial program 86.5%
fabs-sub86.5%
associate-*l/81.9%
associate-*r/88.2%
fmm-def96.5%
distribute-neg-frac96.5%
+-commutative96.5%
distribute-neg-in96.5%
unsub-neg96.5%
metadata-eval96.5%
Simplified96.5%
add-sqr-sqrt53.1%
fabs-sqr53.1%
add-sqr-sqrt53.6%
fma-undefine46.9%
associate-*r/43.8%
associate-*l/45.3%
div-inv45.2%
sub-neg45.2%
metadata-eval45.2%
distribute-neg-in45.2%
+-commutative45.2%
cancel-sign-sub-inv45.2%
div-inv45.3%
associate-*l/43.8%
sub-div52.1%
Applied egg-rr52.1%
Taylor expanded in x around inf 52.1%
sub-neg52.1%
metadata-eval52.1%
distribute-lft-in52.1%
*-commutative52.1%
neg-mul-152.1%
sub-neg52.1%
div-sub43.8%
associate-*l/45.3%
fmm-def45.3%
neg-mul-145.3%
fma-define45.3%
*-commutative45.3%
distribute-lft-out55.3%
Simplified55.3%
Taylor expanded in z around 0 30.5%
mul-1-neg30.5%
distribute-frac-neg30.5%
Simplified30.5%
if -4 < x Initial program 91.4%
fabs-sub91.4%
associate-*l/96.3%
associate-*r/94.0%
fmm-def95.6%
distribute-neg-frac95.6%
+-commutative95.6%
distribute-neg-in95.6%
unsub-neg95.6%
metadata-eval95.6%
Simplified95.6%
fma-undefine94.0%
associate-*r/96.3%
associate-*l/91.4%
div-inv91.4%
sub-neg91.4%
metadata-eval91.4%
distribute-neg-in91.4%
+-commutative91.4%
cancel-sign-sub-inv91.4%
div-inv91.4%
fabs-sub91.4%
add-sqr-sqrt41.5%
fabs-sqr41.5%
add-sqr-sqrt42.6%
associate-*l/43.7%
sub-div44.7%
Applied egg-rr44.7%
Taylor expanded in z around 0 36.7%
Final simplification35.3%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x 4.0) (/ 4.0 y_m) (/ x y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= 4.0) {
tmp = 4.0 / y_m;
} else {
tmp = 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) :: tmp
if (x <= 4.0d0) then
tmp = 4.0d0 / y_m
else
tmp = 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 tmp;
if (x <= 4.0) {
tmp = 4.0 / y_m;
} else {
tmp = x / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= 4.0: tmp = 4.0 / y_m else: tmp = x / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= 4.0) tmp = Float64(4.0 / y_m); else tmp = Float64(x / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= 4.0) tmp = 4.0 / y_m; else tmp = x / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, 4.0], N[(4.0 / y$95$m), $MachinePrecision], N[(x / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4:\\
\;\;\;\;\frac{4}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\
\end{array}
\end{array}
if x < 4Initial program 91.5%
fabs-sub91.5%
associate-*l/94.4%
associate-*r/93.6%
fmm-def96.1%
distribute-neg-frac96.1%
+-commutative96.1%
distribute-neg-in96.1%
unsub-neg96.1%
metadata-eval96.1%
Simplified96.1%
fma-undefine93.6%
associate-*r/94.4%
associate-*l/91.5%
div-inv91.5%
sub-neg91.5%
metadata-eval91.5%
distribute-neg-in91.5%
+-commutative91.5%
cancel-sign-sub-inv91.5%
div-inv91.5%
fabs-sub91.5%
add-sqr-sqrt43.8%
fabs-sqr43.8%
add-sqr-sqrt44.9%
associate-*l/45.6%
sub-div46.6%
Applied egg-rr46.6%
Taylor expanded in x around 0 28.9%
if 4 < x Initial program 85.9%
fabs-sub85.9%
associate-*l/87.7%
associate-*r/89.4%
fmm-def94.7%
distribute-neg-frac94.7%
+-commutative94.7%
distribute-neg-in94.7%
unsub-neg94.7%
metadata-eval94.7%
Simplified94.7%
fma-undefine89.4%
associate-*r/87.7%
associate-*l/85.9%
div-inv85.8%
sub-neg85.8%
metadata-eval85.8%
distribute-neg-in85.8%
+-commutative85.8%
cancel-sign-sub-inv85.8%
div-inv85.9%
fabs-sub85.9%
add-sqr-sqrt33.2%
fabs-sqr33.2%
add-sqr-sqrt33.8%
sub-neg33.8%
distribute-rgt-neg-in33.8%
Applied egg-rr33.8%
Taylor expanded in x around inf 33.8%
Taylor expanded in z around 0 28.2%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (/ 4.0 y_m))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return 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 = 4.0d0 / y_m
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return 4.0 / y_m;
}
y_m = math.fabs(y) def code(x, y_m, z): return 4.0 / y_m
y_m = abs(y) function code(x, y_m, z) return Float64(4.0 / y_m) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = 4.0 / y_m; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[(4.0 / y$95$m), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\frac{4}{y\_m}
\end{array}
Initial program 90.3%
fabs-sub90.3%
associate-*l/92.9%
associate-*r/92.7%
fmm-def95.8%
distribute-neg-frac95.8%
+-commutative95.8%
distribute-neg-in95.8%
unsub-neg95.8%
metadata-eval95.8%
Simplified95.8%
fma-undefine92.7%
associate-*r/92.9%
associate-*l/90.3%
div-inv90.2%
sub-neg90.2%
metadata-eval90.2%
distribute-neg-in90.2%
+-commutative90.2%
cancel-sign-sub-inv90.2%
div-inv90.3%
fabs-sub90.3%
add-sqr-sqrt41.4%
fabs-sqr41.4%
add-sqr-sqrt42.5%
associate-*l/42.5%
sub-div44.1%
Applied egg-rr44.1%
Taylor expanded in x around 0 23.1%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (/ -4.0 y_m))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return -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 = (-4.0d0) / y_m
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return -4.0 / y_m;
}
y_m = math.fabs(y) def code(x, y_m, z): return -4.0 / y_m
y_m = abs(y) function code(x, y_m, z) return Float64(-4.0 / y_m) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = -4.0 / y_m; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[(-4.0 / y$95$m), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\frac{-4}{y\_m}
\end{array}
Initial program 90.3%
fabs-sub90.3%
associate-*l/92.9%
associate-*r/92.7%
fmm-def95.8%
distribute-neg-frac95.8%
+-commutative95.8%
distribute-neg-in95.8%
unsub-neg95.8%
metadata-eval95.8%
Simplified95.8%
add-sqr-sqrt52.4%
fabs-sqr52.4%
add-sqr-sqrt53.4%
fma-undefine51.5%
associate-*r/51.9%
associate-*l/49.3%
div-inv49.3%
sub-neg49.3%
metadata-eval49.3%
distribute-neg-in49.3%
+-commutative49.3%
cancel-sign-sub-inv49.3%
div-inv49.3%
associate-*l/51.9%
sub-div55.4%
Applied egg-rr55.4%
Taylor expanded in x around 0 25.3%
herbie shell --seed 2024146
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))