
(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 16 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 3.65e-44) (fabs (/ (- (+ x 4.0) (* x z)) y_m)) (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 <= 3.65e-44) {
tmp = fabs((((x + 4.0) - (x * z)) / y_m));
} 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 <= 3.65e-44) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)); 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, 3.65e-44], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $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 3.65 \cdot 10^{-44}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\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 < 3.64999999999999993e-44Initial program 88.4%
associate-*l/90.9%
sub-div96.1%
Applied egg-rr96.1%
if 3.64999999999999993e-44 < y Initial program 96.9%
fabs-sub96.9%
associate-*l/92.2%
associate-*r/99.9%
fma-neg99.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 (fabs (- (/ (+ x 4.0) y_m) (* z (/ x y_m))))))
(if (or (<= t_0 2e+73) (not (<= t_0 4e+292)))
(fabs (/ (- (+ x 4.0) (* x z)) y_m))
t_0)))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((((x + 4.0) / y_m) - (z * (x / y_m))));
double tmp;
if ((t_0 <= 2e+73) || !(t_0 <= 4e+292)) {
tmp = fabs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = 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) :: tmp
t_0 = abs((((x + 4.0d0) / y_m) - (z * (x / y_m))))
if ((t_0 <= 2d+73) .or. (.not. (t_0 <= 4d+292))) then
tmp = abs((((x + 4.0d0) - (x * z)) / y_m))
else
tmp = 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 = Math.abs((((x + 4.0) / y_m) - (z * (x / y_m))));
double tmp;
if ((t_0 <= 2e+73) || !(t_0 <= 4e+292)) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((((x + 4.0) / y_m) - (z * (x / y_m)))) tmp = 0 if (t_0 <= 2e+73) or not (t_0 <= 4e+292): tmp = math.fabs((((x + 4.0) - (x * z)) / y_m)) else: tmp = t_0 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(Float64(Float64(x + 4.0) / y_m) - Float64(z * Float64(x / y_m)))) tmp = 0.0 if ((t_0 <= 2e+73) || !(t_0 <= 4e+292)) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)); else tmp = t_0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs((((x + 4.0) / y_m) - (z * (x / y_m)))); tmp = 0.0; if ((t_0 <= 2e+73) || ~((t_0 <= 4e+292))) tmp = abs((((x + 4.0) - (x * z)) / y_m)); else tmp = t_0; 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[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[t$95$0, 2e+73], N[Not[LessEqual[t$95$0, 4e+292]], $MachinePrecision]], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], t$95$0]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{x + 4}{y\_m} - z \cdot \frac{x}{y\_m}\right|\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+73} \lor \neg \left(t\_0 \leq 4 \cdot 10^{+292}\right):\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 1.99999999999999997e73 or 4.0000000000000001e292 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) Initial program 84.9%
associate-*l/93.8%
sub-div99.9%
Applied egg-rr99.9%
if 1.99999999999999997e73 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 4.0000000000000001e292Initial program 99.8%
Final simplification99.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= z -3.7e+14) (not (<= z 7.5e-13))) (fabs (- (/ 4.0 y_m) (/ x (/ y_m z)))) (fabs (/ (- x -4.0) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((z <= -3.7e+14) || !(z <= 7.5e-13)) {
tmp = fabs(((4.0 / y_m) - (x / (y_m / z))));
} else {
tmp = fabs(((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 ((z <= (-3.7d+14)) .or. (.not. (z <= 7.5d-13))) then
tmp = abs(((4.0d0 / y_m) - (x / (y_m / z))))
else
tmp = abs(((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 ((z <= -3.7e+14) || !(z <= 7.5e-13)) {
tmp = Math.abs(((4.0 / y_m) - (x / (y_m / z))));
} else {
tmp = Math.abs(((x - -4.0) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (z <= -3.7e+14) or not (z <= 7.5e-13): tmp = math.fabs(((4.0 / y_m) - (x / (y_m / z)))) else: tmp = math.fabs(((x - -4.0) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((z <= -3.7e+14) || !(z <= 7.5e-13)) tmp = abs(Float64(Float64(4.0 / y_m) - Float64(x / Float64(y_m / z)))); else tmp = abs(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 ((z <= -3.7e+14) || ~((z <= 7.5e-13))) tmp = abs(((4.0 / y_m) - (x / (y_m / z)))); else tmp = abs(((x - -4.0) / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[z, -3.7e+14], N[Not[LessEqual[z, 7.5e-13]], $MachinePrecision]], N[Abs[N[(N[(4.0 / y$95$m), $MachinePrecision] - N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x - -4.0), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+14} \lor \neg \left(z \leq 7.5 \cdot 10^{-13}\right):\\
\;\;\;\;\left|\frac{4}{y\_m} - \frac{x}{\frac{y\_m}{z}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x - -4}{y\_m}\right|\\
\end{array}
\end{array}
if z < -3.7e14 or 7.5000000000000004e-13 < z Initial program 85.4%
associate-*l/81.2%
associate-*r/80.5%
clear-num80.4%
un-div-inv80.6%
Applied egg-rr80.6%
Taylor expanded in x around 0 87.9%
if -3.7e14 < z < 7.5000000000000004e-13Initial program 94.4%
fabs-sub94.4%
associate-*l/99.3%
associate-*r/99.3%
fma-neg100.0%
distribute-neg-frac100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 100.0%
associate-*r/100.0%
distribute-lft-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub-neg100.0%
Simplified100.0%
Final simplification94.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 5e-12) (fabs (/ (- (+ x 4.0) (* x z)) y_m)) (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 <= 5e-12) {
tmp = fabs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = fabs((((x + 4.0) / y_m) - (x / (y_m / z))));
}
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 (y_m <= 5d-12) then
tmp = abs((((x + 4.0d0) - (x * z)) / y_m))
else
tmp = abs((((x + 4.0d0) / y_m) - (x / (y_m / z))))
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 (y_m <= 5e-12) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = Math.abs((((x + 4.0) / y_m) - (x / (y_m / z))));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if y_m <= 5e-12: tmp = math.fabs((((x + 4.0) - (x * z)) / y_m)) else: tmp = math.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 <= 5e-12) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)); else tmp = abs(Float64(Float64(Float64(x + 4.0) / y_m) - Float64(x / Float64(y_m / z)))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (y_m <= 5e-12) tmp = abs((((x + 4.0) - (x * z)) / y_m)); else tmp = abs((((x + 4.0) / y_m) - (x / (y_m / z)))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 5e-12], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $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 5 \cdot 10^{-12}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y\_m} - \frac{x}{\frac{y\_m}{z}}\right|\\
\end{array}
\end{array}
if y < 4.9999999999999997e-12Initial program 88.6%
associate-*l/91.1%
sub-div96.1%
Applied egg-rr96.1%
if 4.9999999999999997e-12 < y Initial program 96.7%
associate-*l/91.7%
associate-*r/99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= z -1.45e+47) (not (<= z 2.6e+31))) (fabs (* z (/ x y_m))) (fabs (/ (- x -4.0) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((z <= -1.45e+47) || !(z <= 2.6e+31)) {
tmp = fabs((z * (x / y_m)));
} else {
tmp = fabs(((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 ((z <= (-1.45d+47)) .or. (.not. (z <= 2.6d+31))) then
tmp = abs((z * (x / y_m)))
else
tmp = abs(((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 ((z <= -1.45e+47) || !(z <= 2.6e+31)) {
tmp = Math.abs((z * (x / y_m)));
} else {
tmp = Math.abs(((x - -4.0) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (z <= -1.45e+47) or not (z <= 2.6e+31): tmp = math.fabs((z * (x / y_m))) else: tmp = math.fabs(((x - -4.0) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((z <= -1.45e+47) || !(z <= 2.6e+31)) tmp = abs(Float64(z * Float64(x / y_m))); else tmp = abs(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 ((z <= -1.45e+47) || ~((z <= 2.6e+31))) tmp = abs((z * (x / y_m))); else tmp = abs(((x - -4.0) / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[z, -1.45e+47], N[Not[LessEqual[z, 2.6e+31]], $MachinePrecision]], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x - -4.0), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+47} \lor \neg \left(z \leq 2.6 \cdot 10^{+31}\right):\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x - -4}{y\_m}\right|\\
\end{array}
\end{array}
if z < -1.4499999999999999e47 or 2.6e31 < z Initial program 85.2%
Simplified88.1%
Taylor expanded in z around inf 69.1%
mul-1-neg69.1%
distribute-frac-neg269.1%
associate-*l/74.9%
*-commutative74.9%
Simplified74.9%
if -1.4499999999999999e47 < z < 2.6e31Initial program 94.0%
fabs-sub94.0%
associate-*l/98.7%
associate-*r/98.7%
fma-neg100.0%
distribute-neg-frac100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 98.2%
associate-*r/98.2%
distribute-lft-in98.2%
metadata-eval98.2%
neg-mul-198.2%
sub-neg98.2%
Simplified98.2%
Final simplification88.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ (- (+ x 4.0) (* x z)) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs((((x + 4.0) - (x * z)) / 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 = abs((((x + 4.0d0) - (x * z)) / y_m))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return Math.abs((((x + 4.0) - (x * z)) / y_m));
}
y_m = math.fabs(y) def code(x, y_m, z): return math.fabs((((x + 4.0) - (x * z)) / y_m))
y_m = abs(y) function code(x, y_m, z) return abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = abs((((x + 4.0) - (x * z)) / y_m)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|
\end{array}
Initial program 90.4%
associate-*l/91.2%
sub-div95.1%
Applied egg-rr95.1%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (/ (+ x 4.0) y_m)))
(if (<= x -4.0)
(- (* x (/ z y_m)) t_0)
(if (<= x 2.6e-272)
(/ (- (+ x 4.0) (* x z)) y_m)
(+ t_0 (/ x (/ y_m z)))))))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 <= -4.0) {
tmp = (x * (z / y_m)) - t_0;
} else if (x <= 2.6e-272) {
tmp = ((x + 4.0) - (x * z)) / y_m;
} else {
tmp = t_0 + (x / (y_m / z));
}
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 <= (-4.0d0)) then
tmp = (x * (z / y_m)) - t_0
else if (x <= 2.6d-272) then
tmp = ((x + 4.0d0) - (x * z)) / y_m
else
tmp = t_0 + (x / (y_m / z))
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 <= -4.0) {
tmp = (x * (z / y_m)) - t_0;
} else if (x <= 2.6e-272) {
tmp = ((x + 4.0) - (x * z)) / y_m;
} else {
tmp = t_0 + (x / (y_m / z));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = (x + 4.0) / y_m tmp = 0 if x <= -4.0: tmp = (x * (z / y_m)) - t_0 elif x <= 2.6e-272: tmp = ((x + 4.0) - (x * z)) / y_m else: tmp = t_0 + (x / (y_m / z)) 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 <= -4.0) tmp = Float64(Float64(x * Float64(z / y_m)) - t_0); elseif (x <= 2.6e-272) tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m); else tmp = Float64(t_0 + Float64(x / Float64(y_m / z))); 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 <= -4.0) tmp = (x * (z / y_m)) - t_0; elseif (x <= 2.6e-272) tmp = ((x + 4.0) - (x * z)) / y_m; else tmp = t_0 + (x / (y_m / 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]}, If[LessEqual[x, -4.0], N[(N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 2.6e-272], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(t$95$0 + N[(x / N[(y$95$m / z), $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 -4:\\
\;\;\;\;x \cdot \frac{z}{y\_m} - t\_0\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-272}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{x}{\frac{y\_m}{z}}\\
\end{array}
\end{array}
if x < -4Initial program 84.6%
fabs-sub84.6%
div-inv84.5%
cancel-sign-sub-inv84.5%
+-commutative84.5%
distribute-neg-in84.5%
metadata-eval84.5%
sub-neg84.5%
div-inv84.6%
associate-*l/79.9%
associate-*r/91.6%
fma-undefine94.4%
add-sqr-sqrt51.0%
fabs-sqr51.0%
add-sqr-sqrt51.6%
fma-undefine51.6%
associate-*r/43.8%
associate-*l/46.1%
div-inv46.0%
Applied egg-rr51.6%
if -4 < x < 2.59999999999999992e-272Initial program 92.8%
add-sqr-sqrt38.9%
fabs-sqr38.9%
add-sqr-sqrt40.2%
associate-*l/41.3%
associate-*r/34.4%
Applied egg-rr34.4%
clear-num34.4%
un-div-inv34.6%
Applied egg-rr34.6%
Taylor expanded in y around 0 41.3%
if 2.59999999999999992e-272 < x Initial program 92.5%
add-sqr-sqrt42.7%
fabs-sqr42.7%
add-sqr-sqrt43.6%
associate-*l/43.6%
associate-*r/45.4%
Applied egg-rr45.4%
add-sqr-sqrt21.7%
sqrt-unprod35.3%
sqr-neg35.3%
sqrt-unprod20.8%
add-sqr-sqrt42.7%
distribute-frac-neg42.7%
distribute-rgt-neg-in42.7%
distribute-lft-neg-in42.7%
clear-num42.7%
un-div-inv42.7%
Applied egg-rr42.7%
Final simplification44.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -4.0) (/ (+ (* x z) (- -4.0 x)) y_m) (if (<= x 6.5e+23) (/ (- 4.0 (* x z)) 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 = ((x * z) + (-4.0 - x)) / y_m;
} else if (x <= 6.5e+23) {
tmp = (4.0 - (x * z)) / 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 = ((x * z) + ((-4.0d0) - x)) / y_m
else if (x <= 6.5d+23) then
tmp = (4.0d0 - (x * z)) / 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 = ((x * z) + (-4.0 - x)) / y_m;
} else if (x <= 6.5e+23) {
tmp = (4.0 - (x * z)) / 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 = ((x * z) + (-4.0 - x)) / y_m elif x <= 6.5e+23: tmp = (4.0 - (x * z)) / 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(Float64(Float64(x * z) + Float64(-4.0 - x)) / y_m); elseif (x <= 6.5e+23) tmp = Float64(Float64(4.0 - Float64(x * z)) / 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 = ((x * z) + (-4.0 - x)) / y_m; elseif (x <= 6.5e+23) tmp = (4.0 - (x * z)) / 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[(N[(N[(x * z), $MachinePrecision] + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], If[LessEqual[x, 6.5e+23], N[(N[(4.0 - N[(x * z), $MachinePrecision]), $MachinePrecision] / 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{x \cdot z + \left(-4 - x\right)}{y\_m}\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+23}:\\
\;\;\;\;\frac{4 - x \cdot z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\
\end{array}
\end{array}
if x < -4Initial program 84.6%
associate-*l/79.9%
sub-div88.2%
Applied egg-rr88.2%
Applied egg-rr49.4%
if -4 < x < 6.4999999999999996e23Initial program 94.4%
add-sqr-sqrt39.4%
fabs-sqr39.4%
add-sqr-sqrt40.6%
sub-neg40.6%
+-commutative40.6%
associate-*l/42.7%
associate-*r/38.7%
frac-2neg38.7%
+-commutative38.7%
distribute-neg-in38.7%
metadata-eval38.7%
sub-neg38.7%
distribute-frac-neg238.7%
distribute-neg-in38.7%
fma-undefine38.7%
neg-sub038.7%
fma-undefine38.7%
associate-*r/42.7%
associate-*l/40.6%
Applied egg-rr42.7%
Taylor expanded in x around 0 42.1%
if 6.4999999999999996e23 < x Initial program 88.0%
fabs-sub88.0%
associate-*l/84.4%
associate-*r/92.0%
fma-neg95.9%
distribute-neg-frac95.9%
+-commutative95.9%
distribute-neg-in95.9%
unsub-neg95.9%
metadata-eval95.9%
Simplified95.9%
Taylor expanded in z around 0 75.7%
associate-*r/75.7%
distribute-lft-in75.7%
metadata-eval75.7%
neg-mul-175.7%
sub-neg75.7%
Simplified75.7%
add-sqr-sqrt75.3%
sqrt-unprod64.7%
neg-fabs64.7%
neg-fabs64.7%
sqr-abs64.7%
distribute-frac-neg264.7%
sub-neg64.7%
metadata-eval64.7%
distribute-neg-in64.7%
+-commutative64.7%
frac-2neg64.7%
distribute-frac-neg264.7%
sub-neg64.7%
metadata-eval64.7%
distribute-neg-in64.7%
+-commutative64.7%
frac-2neg64.7%
sqrt-unprod38.4%
add-sqr-sqrt39.1%
clear-num39.0%
Applied egg-rr39.0%
Taylor expanded in x around inf 39.1%
Final simplification43.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -1.22e+51) (/ (- x) y_m) (if (<= x 6.5e+23) (/ (- 4.0 (* x z)) y_m) (/ x y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -1.22e+51) {
tmp = -x / y_m;
} else if (x <= 6.5e+23) {
tmp = (4.0 - (x * z)) / 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 <= (-1.22d+51)) then
tmp = -x / y_m
else if (x <= 6.5d+23) then
tmp = (4.0d0 - (x * z)) / 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 <= -1.22e+51) {
tmp = -x / y_m;
} else if (x <= 6.5e+23) {
tmp = (4.0 - (x * z)) / y_m;
} else {
tmp = x / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -1.22e+51: tmp = -x / y_m elif x <= 6.5e+23: tmp = (4.0 - (x * z)) / y_m else: tmp = x / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -1.22e+51) tmp = Float64(Float64(-x) / y_m); elseif (x <= 6.5e+23) tmp = Float64(Float64(4.0 - Float64(x * z)) / 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 <= -1.22e+51) tmp = -x / y_m; elseif (x <= 6.5e+23) tmp = (4.0 - (x * z)) / 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, -1.22e+51], N[((-x) / y$95$m), $MachinePrecision], If[LessEqual[x, 6.5e+23], N[(N[(4.0 - N[(x * z), $MachinePrecision]), $MachinePrecision] / 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 -1.22 \cdot 10^{+51}:\\
\;\;\;\;\frac{-x}{y\_m}\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+23}:\\
\;\;\;\;\frac{4 - x \cdot z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\
\end{array}
\end{array}
if x < -1.22000000000000005e51Initial program 82.9%
fabs-sub82.9%
associate-*l/77.2%
associate-*r/91.5%
fma-neg94.9%
distribute-neg-frac94.9%
+-commutative94.9%
distribute-neg-in94.9%
unsub-neg94.9%
metadata-eval94.9%
Simplified94.9%
Taylor expanded in z around 0 69.7%
associate-*r/69.7%
distribute-lft-in69.7%
metadata-eval69.7%
neg-mul-169.7%
sub-neg69.7%
Simplified69.7%
add-sqr-sqrt36.2%
fabs-sqr36.2%
add-sqr-sqrt36.8%
div-inv36.7%
Applied egg-rr36.7%
Taylor expanded in x around inf 36.8%
mul-1-neg36.8%
distribute-frac-neg236.8%
Simplified36.8%
if -1.22000000000000005e51 < x < 6.4999999999999996e23Initial program 94.2%
add-sqr-sqrt40.6%
fabs-sqr40.6%
add-sqr-sqrt41.8%
sub-neg41.8%
+-commutative41.8%
associate-*l/43.7%
associate-*r/40.0%
frac-2neg40.0%
+-commutative40.0%
distribute-neg-in40.0%
metadata-eval40.0%
sub-neg40.0%
distribute-frac-neg240.0%
distribute-neg-in40.0%
fma-undefine40.0%
neg-sub040.0%
fma-undefine40.0%
associate-*r/43.7%
associate-*l/41.8%
Applied egg-rr44.4%
Taylor expanded in x around 0 42.7%
if 6.4999999999999996e23 < x Initial program 88.0%
fabs-sub88.0%
associate-*l/84.4%
associate-*r/92.0%
fma-neg95.9%
distribute-neg-frac95.9%
+-commutative95.9%
distribute-neg-in95.9%
unsub-neg95.9%
metadata-eval95.9%
Simplified95.9%
Taylor expanded in z around 0 75.7%
associate-*r/75.7%
distribute-lft-in75.7%
metadata-eval75.7%
neg-mul-175.7%
sub-neg75.7%
Simplified75.7%
add-sqr-sqrt75.3%
sqrt-unprod64.7%
neg-fabs64.7%
neg-fabs64.7%
sqr-abs64.7%
distribute-frac-neg264.7%
sub-neg64.7%
metadata-eval64.7%
distribute-neg-in64.7%
+-commutative64.7%
frac-2neg64.7%
distribute-frac-neg264.7%
sub-neg64.7%
metadata-eval64.7%
distribute-neg-in64.7%
+-commutative64.7%
frac-2neg64.7%
sqrt-unprod38.4%
add-sqr-sqrt39.1%
clear-num39.0%
Applied egg-rr39.0%
Taylor expanded in x around inf 39.1%
Final simplification40.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -4.0) (- (* 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 <= -4.0) {
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 <= (-4.0d0)) 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 <= -4.0) {
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 <= -4.0: 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 <= -4.0) 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 <= -4.0) 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, -4.0], 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 -4:\\
\;\;\;\;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 < -4Initial program 84.6%
fabs-sub84.6%
div-inv84.5%
cancel-sign-sub-inv84.5%
+-commutative84.5%
distribute-neg-in84.5%
metadata-eval84.5%
sub-neg84.5%
div-inv84.6%
associate-*l/79.9%
associate-*r/91.6%
fma-undefine94.4%
add-sqr-sqrt51.0%
fabs-sqr51.0%
add-sqr-sqrt51.6%
fma-undefine51.6%
associate-*r/43.8%
associate-*l/46.1%
div-inv46.0%
Applied egg-rr51.6%
if -4 < x Initial program 92.7%
add-sqr-sqrt41.1%
fabs-sqr41.1%
add-sqr-sqrt42.2%
associate-*l/42.7%
associate-*r/40.8%
Applied egg-rr40.8%
clear-num40.8%
un-div-inv40.8%
Applied egg-rr40.8%
Taylor expanded in y around 0 43.8%
Final simplification46.0%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -4.0) (/ (+ (* x z) (- -4.0 x)) 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 <= -4.0) {
tmp = ((x * z) + (-4.0 - x)) / 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 <= (-4.0d0)) then
tmp = ((x * z) + ((-4.0d0) - x)) / 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 <= -4.0) {
tmp = ((x * z) + (-4.0 - x)) / 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 <= -4.0: tmp = ((x * z) + (-4.0 - x)) / 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 <= -4.0) tmp = Float64(Float64(Float64(x * z) + Float64(-4.0 - x)) / 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 <= -4.0) tmp = ((x * z) + (-4.0 - x)) / 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, -4.0], N[(N[(N[(x * z), $MachinePrecision] + N[(-4.0 - x), $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 -4:\\
\;\;\;\;\frac{x \cdot z + \left(-4 - x\right)}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\
\end{array}
\end{array}
if x < -4Initial program 84.6%
associate-*l/79.9%
sub-div88.2%
Applied egg-rr88.2%
Applied egg-rr49.4%
if -4 < x Initial program 92.7%
add-sqr-sqrt41.1%
fabs-sqr41.1%
add-sqr-sqrt42.2%
associate-*l/42.7%
associate-*r/40.8%
Applied egg-rr40.8%
clear-num40.8%
un-div-inv40.8%
Applied egg-rr40.8%
Taylor expanded in y around 0 43.8%
Final simplification45.3%
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(Float64(-x) / 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 84.4%
fabs-sub84.4%
associate-*l/79.6%
associate-*r/91.5%
fma-neg94.3%
distribute-neg-frac94.3%
+-commutative94.3%
distribute-neg-in94.3%
unsub-neg94.3%
metadata-eval94.3%
Simplified94.3%
Taylor expanded in z around 0 65.6%
associate-*r/65.6%
distribute-lft-in65.6%
metadata-eval65.6%
neg-mul-165.6%
sub-neg65.6%
Simplified65.6%
add-sqr-sqrt35.9%
fabs-sqr35.9%
add-sqr-sqrt36.5%
div-inv36.4%
Applied egg-rr36.4%
Taylor expanded in x around inf 36.5%
mul-1-neg36.5%
distribute-frac-neg236.5%
Simplified36.5%
if -10.5 < x < 4Initial program 94.3%
add-sqr-sqrt39.5%
fabs-sqr39.5%
add-sqr-sqrt40.8%
associate-*l/42.9%
associate-*r/38.8%
Applied egg-rr38.8%
clear-num38.8%
un-div-inv38.9%
Applied egg-rr38.9%
Taylor expanded in x around 0 31.1%
if 4 < x Initial program 88.8%
fabs-sub88.8%
associate-*l/85.5%
associate-*r/92.5%
fma-neg96.2%
distribute-neg-frac96.2%
+-commutative96.2%
distribute-neg-in96.2%
unsub-neg96.2%
metadata-eval96.2%
Simplified96.2%
Taylor expanded in z around 0 72.2%
associate-*r/72.2%
distribute-lft-in72.2%
metadata-eval72.2%
neg-mul-172.2%
sub-neg72.2%
Simplified72.2%
add-sqr-sqrt71.8%
sqrt-unprod61.9%
neg-fabs61.9%
neg-fabs61.9%
sqr-abs61.9%
distribute-frac-neg261.9%
sub-neg61.9%
metadata-eval61.9%
distribute-neg-in61.9%
+-commutative61.9%
frac-2neg61.9%
distribute-frac-neg261.9%
sub-neg61.9%
metadata-eval61.9%
distribute-neg-in61.9%
+-commutative61.9%
frac-2neg61.9%
sqrt-unprod35.8%
add-sqr-sqrt36.4%
clear-num36.4%
Applied egg-rr36.4%
Taylor expanded in x around inf 36.4%
Final simplification33.7%
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 84.6%
fabs-sub84.6%
associate-*l/79.9%
associate-*r/91.6%
fma-neg94.4%
distribute-neg-frac94.4%
+-commutative94.4%
distribute-neg-in94.4%
unsub-neg94.4%
metadata-eval94.4%
Simplified94.4%
Taylor expanded in z around 0 66.1%
associate-*r/66.1%
distribute-lft-in66.1%
metadata-eval66.1%
neg-mul-166.1%
sub-neg66.1%
Simplified66.1%
add-sqr-sqrt35.4%
fabs-sqr35.4%
add-sqr-sqrt36.0%
div-inv35.9%
Applied egg-rr35.9%
Taylor expanded in x around 0 36.0%
mul-1-neg36.0%
neg-sub036.0%
associate-*r/36.0%
metadata-eval36.0%
associate--r+36.0%
+-commutative36.0%
associate--r+36.0%
neg-sub036.0%
distribute-neg-frac36.0%
metadata-eval36.0%
div-sub36.0%
Simplified36.0%
if -4 < x Initial program 92.7%
fabs-sub92.7%
associate-*l/95.7%
associate-*r/90.7%
fma-neg91.8%
distribute-neg-frac91.8%
+-commutative91.8%
distribute-neg-in91.8%
unsub-neg91.8%
metadata-eval91.8%
Simplified91.8%
Taylor expanded in z around 0 74.2%
associate-*r/74.2%
distribute-lft-in74.2%
metadata-eval74.2%
neg-mul-174.2%
sub-neg74.2%
Simplified74.2%
add-sqr-sqrt73.7%
sqrt-unprod47.6%
neg-fabs47.6%
neg-fabs47.6%
sqr-abs47.6%
distribute-frac-neg247.6%
sub-neg47.6%
metadata-eval47.6%
distribute-neg-in47.6%
+-commutative47.6%
frac-2neg47.6%
distribute-frac-neg247.6%
sub-neg47.6%
metadata-eval47.6%
distribute-neg-in47.6%
+-commutative47.6%
frac-2neg47.6%
sqrt-unprod32.1%
add-sqr-sqrt33.2%
Applied egg-rr33.2%
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(Float64(-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 = -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 84.6%
fabs-sub84.6%
associate-*l/79.9%
associate-*r/91.6%
fma-neg94.4%
distribute-neg-frac94.4%
+-commutative94.4%
distribute-neg-in94.4%
unsub-neg94.4%
metadata-eval94.4%
Simplified94.4%
Taylor expanded in z around 0 66.1%
associate-*r/66.1%
distribute-lft-in66.1%
metadata-eval66.1%
neg-mul-166.1%
sub-neg66.1%
Simplified66.1%
add-sqr-sqrt35.4%
fabs-sqr35.4%
add-sqr-sqrt36.0%
div-inv35.9%
Applied egg-rr35.9%
Taylor expanded in x around inf 36.0%
mul-1-neg36.0%
distribute-frac-neg236.0%
Simplified36.0%
if -4 < x Initial program 92.7%
fabs-sub92.7%
associate-*l/95.7%
associate-*r/90.7%
fma-neg91.8%
distribute-neg-frac91.8%
+-commutative91.8%
distribute-neg-in91.8%
unsub-neg91.8%
metadata-eval91.8%
Simplified91.8%
Taylor expanded in z around 0 74.2%
associate-*r/74.2%
distribute-lft-in74.2%
metadata-eval74.2%
neg-mul-174.2%
sub-neg74.2%
Simplified74.2%
add-sqr-sqrt73.7%
sqrt-unprod47.6%
neg-fabs47.6%
neg-fabs47.6%
sqr-abs47.6%
distribute-frac-neg247.6%
sub-neg47.6%
metadata-eval47.6%
distribute-neg-in47.6%
+-commutative47.6%
frac-2neg47.6%
distribute-frac-neg247.6%
sub-neg47.6%
metadata-eval47.6%
distribute-neg-in47.6%
+-commutative47.6%
frac-2neg47.6%
sqrt-unprod32.1%
add-sqr-sqrt33.2%
Applied egg-rr33.2%
Final simplification34.0%
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 90.8%
add-sqr-sqrt38.9%
fabs-sqr38.9%
add-sqr-sqrt39.9%
associate-*l/40.4%
associate-*r/39.1%
Applied egg-rr39.1%
clear-num39.1%
un-div-inv39.2%
Applied egg-rr39.2%
Taylor expanded in x around 0 21.3%
if 4 < x Initial program 88.8%
fabs-sub88.8%
associate-*l/85.5%
associate-*r/92.5%
fma-neg96.2%
distribute-neg-frac96.2%
+-commutative96.2%
distribute-neg-in96.2%
unsub-neg96.2%
metadata-eval96.2%
Simplified96.2%
Taylor expanded in z around 0 72.2%
associate-*r/72.2%
distribute-lft-in72.2%
metadata-eval72.2%
neg-mul-172.2%
sub-neg72.2%
Simplified72.2%
add-sqr-sqrt71.8%
sqrt-unprod61.9%
neg-fabs61.9%
neg-fabs61.9%
sqr-abs61.9%
distribute-frac-neg261.9%
sub-neg61.9%
metadata-eval61.9%
distribute-neg-in61.9%
+-commutative61.9%
frac-2neg61.9%
distribute-frac-neg261.9%
sub-neg61.9%
metadata-eval61.9%
distribute-neg-in61.9%
+-commutative61.9%
frac-2neg61.9%
sqrt-unprod35.8%
add-sqr-sqrt36.4%
clear-num36.4%
Applied egg-rr36.4%
Taylor expanded in x around inf 36.4%
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.4%
add-sqr-sqrt40.4%
fabs-sqr40.4%
add-sqr-sqrt41.3%
associate-*l/41.0%
associate-*r/40.7%
Applied egg-rr40.7%
clear-num40.7%
un-div-inv40.8%
Applied egg-rr40.8%
Taylor expanded in x around 0 17.5%
herbie shell --seed 2024117
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))