
(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 1.05e-62) (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.05e-62) {
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.05e-62) 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.05e-62], 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.05 \cdot 10^{-62}:\\
\;\;\;\;\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.05e-62Initial program 91.4%
Simplified96.4%
if 1.05e-62 < y Initial program 98.6%
fabs-sub98.6%
associate-*l/91.6%
associate-*r/99.8%
fma-neg99.8%
distribute-neg-frac99.8%
+-commutative99.8%
distribute-neg-in99.8%
unsub-neg99.8%
metadata-eval99.8%
Simplified99.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 4.8e+32) (fabs (* (/ -1.0 y_m) (fma x z (- -4.0 x)))) (fabs (* x (- (/ (+ -1.0 z) y_m) (/ 4.0 (* y_m x)))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 4.8e+32) {
tmp = fabs(((-1.0 / y_m) * fma(x, z, (-4.0 - x))));
} else {
tmp = fabs((x * (((-1.0 + z) / y_m) - (4.0 / (y_m * x)))));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 4.8e+32) tmp = abs(Float64(Float64(-1.0 / y_m) * fma(x, z, Float64(-4.0 - x)))); else tmp = abs(Float64(x * Float64(Float64(Float64(-1.0 + z) / y_m) - Float64(4.0 / Float64(y_m * x))))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 4.8e+32], 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[(N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(4.0 / N[(y$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 4.8 \cdot 10^{+32}:\\
\;\;\;\;\left|\frac{-1}{y\_m} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \left(\frac{-1 + z}{y\_m} - \frac{4}{y\_m \cdot x}\right)\right|\\
\end{array}
\end{array}
if y < 4.79999999999999983e32Initial program 92.3%
Simplified96.8%
if 4.79999999999999983e32 < y Initial program 98.2%
fabs-sub98.2%
associate-*l/89.5%
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%
Taylor expanded in x around inf 99.6%
associate--r+99.6%
div-sub99.6%
sub-neg99.6%
remove-double-neg99.6%
neg-mul-199.6%
metadata-eval99.6%
metadata-eval99.6%
distribute-lft-in99.6%
+-commutative99.6%
neg-mul-199.6%
associate-*r/99.6%
Simplified99.6%
Final simplification97.6%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (/ (+ x 4.0) y_m)))
(if (<= (- t_0 (* z (/ x y_m))) 1e+302)
(fabs (- (/ z (/ y_m x)) t_0))
(fabs (* x (- (/ (+ -1.0 z) y_m) (/ 4.0 (* 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 ((t_0 - (z * (x / y_m))) <= 1e+302) {
tmp = fabs(((z / (y_m / x)) - t_0));
} else {
tmp = fabs((x * (((-1.0 + z) / y_m) - (4.0 / (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 ((t_0 - (z * (x / y_m))) <= 1d+302) then
tmp = abs(((z / (y_m / x)) - t_0))
else
tmp = abs((x * ((((-1.0d0) + z) / y_m) - (4.0d0 / (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 ((t_0 - (z * (x / y_m))) <= 1e+302) {
tmp = Math.abs(((z / (y_m / x)) - t_0));
} else {
tmp = Math.abs((x * (((-1.0 + z) / y_m) - (4.0 / (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 (t_0 - (z * (x / y_m))) <= 1e+302: tmp = math.fabs(((z / (y_m / x)) - t_0)) else: tmp = math.fabs((x * (((-1.0 + z) / y_m) - (4.0 / (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 (Float64(t_0 - Float64(z * Float64(x / y_m))) <= 1e+302) tmp = abs(Float64(Float64(z / Float64(y_m / x)) - t_0)); else tmp = abs(Float64(x * Float64(Float64(Float64(-1.0 + z) / y_m) - Float64(4.0 / 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 ((t_0 - (z * (x / y_m))) <= 1e+302) tmp = abs(((z / (y_m / x)) - t_0)); else tmp = abs((x * (((-1.0 + z) / y_m) - (4.0 / (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[N[(t$95$0 - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+302], N[Abs[N[(N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(4.0 / N[(y$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y\_m}\\
\mathbf{if}\;t\_0 - z \cdot \frac{x}{y\_m} \leq 10^{+302}:\\
\;\;\;\;\left|\frac{z}{\frac{y\_m}{x}} - t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \left(\frac{-1 + z}{y\_m} - \frac{4}{y\_m \cdot x}\right)\right|\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) < 1.0000000000000001e302Initial program 99.4%
*-commutative99.4%
clear-num99.3%
un-div-inv99.4%
Applied egg-rr99.4%
if 1.0000000000000001e302 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) Initial program 62.2%
fabs-sub62.2%
associate-*l/75.7%
associate-*r/75.7%
fma-neg89.2%
distribute-neg-frac89.2%
+-commutative89.2%
distribute-neg-in89.2%
unsub-neg89.2%
metadata-eval89.2%
Simplified89.2%
Taylor expanded in x around inf 100.0%
associate--r+100.0%
div-sub100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-mul-1100.0%
metadata-eval100.0%
metadata-eval100.0%
distribute-lft-in100.0%
+-commutative100.0%
neg-mul-1100.0%
associate-*r/100.0%
Simplified100.0%
Final simplification99.5%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (/ (+ x 4.0) y_m)))
(if (<= (- t_0 (* z (/ x y_m))) 2e+299)
(fabs (- (/ z (/ y_m x)) t_0))
(/ (- (+ x 4.0) (* x z)) 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 ((t_0 - (z * (x / y_m))) <= 2e+299) {
tmp = fabs(((z / (y_m / x)) - t_0));
} 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) :: t_0
real(8) :: tmp
t_0 = (x + 4.0d0) / y_m
if ((t_0 - (z * (x / y_m))) <= 2d+299) then
tmp = abs(((z / (y_m / x)) - t_0))
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 t_0 = (x + 4.0) / y_m;
double tmp;
if ((t_0 - (z * (x / y_m))) <= 2e+299) {
tmp = Math.abs(((z / (y_m / x)) - t_0));
} else {
tmp = ((x + 4.0) - (x * z)) / 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 (t_0 - (z * (x / y_m))) <= 2e+299: tmp = math.fabs(((z / (y_m / x)) - t_0)) else: tmp = ((x + 4.0) - (x * z)) / 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 (Float64(t_0 - Float64(z * Float64(x / y_m))) <= 2e+299) tmp = abs(Float64(Float64(z / Float64(y_m / x)) - t_0)); 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) t_0 = (x + 4.0) / y_m; tmp = 0.0; if ((t_0 - (z * (x / y_m))) <= 2e+299) tmp = abs(((z / (y_m / x)) - t_0)); 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_] := Block[{t$95$0 = N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+299], N[Abs[N[(N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision] - t$95$0), $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}
t_0 := \frac{x + 4}{y\_m}\\
\mathbf{if}\;t\_0 - z \cdot \frac{x}{y\_m} \leq 2 \cdot 10^{+299}:\\
\;\;\;\;\left|\frac{z}{\frac{y\_m}{x}} - t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) < 2.0000000000000001e299Initial program 99.3%
*-commutative99.3%
clear-num99.3%
un-div-inv99.4%
Applied egg-rr99.4%
if 2.0000000000000001e299 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) Initial program 63.2%
fabs-sub63.2%
associate-*l/76.3%
associate-*r/76.3%
fma-neg89.5%
distribute-neg-frac89.5%
+-commutative89.5%
distribute-neg-in89.5%
unsub-neg89.5%
metadata-eval89.5%
Simplified89.5%
fma-undefine76.3%
associate-*r/76.3%
associate-*l/63.2%
div-inv63.1%
sub-neg63.1%
metadata-eval63.1%
distribute-neg-in63.1%
+-commutative63.1%
cancel-sign-sub-inv63.1%
div-inv63.2%
fabs-sub63.2%
add-sqr-sqrt63.1%
fabs-sqr63.1%
add-sqr-sqrt63.2%
associate-*l/65.8%
sub-div78.9%
Applied egg-rr78.9%
Final simplification96.3%
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 2e+299) (fabs t_0) (/ (- (+ x 4.0) (* x z)) 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 <= 2e+299) {
tmp = fabs(t_0);
} 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) :: t_0
real(8) :: tmp
t_0 = ((x + 4.0d0) / y_m) - (z * (x / y_m))
if (t_0 <= 2d+299) then
tmp = abs(t_0)
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 t_0 = ((x + 4.0) / y_m) - (z * (x / y_m));
double tmp;
if (t_0 <= 2e+299) {
tmp = Math.abs(t_0);
} else {
tmp = ((x + 4.0) - (x * z)) / 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 <= 2e+299: tmp = math.fabs(t_0) else: tmp = ((x + 4.0) - (x * z)) / 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 <= 2e+299) tmp = abs(t_0); 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) t_0 = ((x + 4.0) / y_m) - (z * (x / y_m)); tmp = 0.0; if (t_0 <= 2e+299) tmp = abs(t_0); 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_] := 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, 2e+299], N[Abs[t$95$0], $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}
t_0 := \frac{x + 4}{y\_m} - z \cdot \frac{x}{y\_m}\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+299}:\\
\;\;\;\;\left|t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) < 2.0000000000000001e299Initial program 99.3%
if 2.0000000000000001e299 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) Initial program 63.2%
fabs-sub63.2%
associate-*l/76.3%
associate-*r/76.3%
fma-neg89.5%
distribute-neg-frac89.5%
+-commutative89.5%
distribute-neg-in89.5%
unsub-neg89.5%
metadata-eval89.5%
Simplified89.5%
fma-undefine76.3%
associate-*r/76.3%
associate-*l/63.2%
div-inv63.1%
sub-neg63.1%
metadata-eval63.1%
distribute-neg-in63.1%
+-commutative63.1%
cancel-sign-sub-inv63.1%
div-inv63.2%
fabs-sub63.2%
add-sqr-sqrt63.1%
fabs-sqr63.1%
add-sqr-sqrt63.2%
associate-*l/65.8%
sub-div78.9%
Applied egg-rr78.9%
Final simplification96.3%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -180000000000.0)
(* x (/ (+ -1.0 z) y_m))
(if (<= x 6e-12)
(/ (- (+ x 4.0) (* x z)) y_m)
(- (/ (+ x 4.0) y_m) (* x (/ z y_m))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -180000000000.0) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 6e-12) {
tmp = ((x + 4.0) - (x * z)) / y_m;
} else {
tmp = ((x + 4.0) / y_m) - (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 <= (-180000000000.0d0)) then
tmp = x * (((-1.0d0) + z) / y_m)
else if (x <= 6d-12) then
tmp = ((x + 4.0d0) - (x * z)) / y_m
else
tmp = ((x + 4.0d0) / y_m) - (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 <= -180000000000.0) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 6e-12) {
tmp = ((x + 4.0) - (x * z)) / y_m;
} else {
tmp = ((x + 4.0) / y_m) - (x * (z / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -180000000000.0: tmp = x * ((-1.0 + z) / y_m) elif x <= 6e-12: tmp = ((x + 4.0) - (x * z)) / y_m else: tmp = ((x + 4.0) / y_m) - (x * (z / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -180000000000.0) tmp = Float64(x * Float64(Float64(-1.0 + z) / y_m)); elseif (x <= 6e-12) tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m); else tmp = Float64(Float64(Float64(x + 4.0) / y_m) - Float64(x * Float64(z / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -180000000000.0) tmp = x * ((-1.0 + z) / y_m); elseif (x <= 6e-12) tmp = ((x + 4.0) - (x * z)) / y_m; else tmp = ((x + 4.0) / y_m) - (x * (z / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -180000000000.0], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6e-12], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -180000000000:\\
\;\;\;\;x \cdot \frac{-1 + z}{y\_m}\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-12}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y\_m} - x \cdot \frac{z}{y\_m}\\
\end{array}
\end{array}
if x < -1.8e11Initial program 87.5%
fabs-sub87.5%
associate-*l/80.4%
associate-*r/89.1%
fma-neg95.3%
distribute-neg-frac95.3%
+-commutative95.3%
distribute-neg-in95.3%
unsub-neg95.3%
metadata-eval95.3%
Simplified95.3%
add-sqr-sqrt44.4%
fabs-sqr44.4%
add-sqr-sqrt44.9%
fma-undefine43.4%
associate-*r/39.0%
associate-*l/41.8%
div-inv41.7%
sub-neg41.7%
metadata-eval41.7%
distribute-neg-in41.7%
+-commutative41.7%
cancel-sign-sub-inv41.7%
div-inv41.8%
associate-*l/39.0%
sub-div43.6%
Applied egg-rr43.6%
Taylor expanded in x around inf 43.6%
sub-neg43.6%
metadata-eval43.6%
associate-/l*47.9%
Simplified47.9%
if -1.8e11 < x < 6.0000000000000003e-12Initial program 99.0%
fabs-sub99.0%
associate-*l/99.9%
associate-*r/92.3%
fma-neg92.3%
distribute-neg-frac92.3%
+-commutative92.3%
distribute-neg-in92.3%
unsub-neg92.3%
metadata-eval92.3%
Simplified92.3%
fma-undefine92.3%
associate-*r/99.9%
associate-*l/99.0%
div-inv99.0%
sub-neg99.0%
metadata-eval99.0%
distribute-neg-in99.0%
+-commutative99.0%
cancel-sign-sub-inv99.0%
div-inv99.0%
fabs-sub99.0%
add-sqr-sqrt47.8%
fabs-sqr47.8%
add-sqr-sqrt49.4%
associate-*l/49.5%
sub-div49.5%
Applied egg-rr49.5%
if 6.0000000000000003e-12 < x Initial program 90.9%
fabs-sub90.9%
associate-*l/85.7%
associate-*r/96.9%
fma-neg98.4%
distribute-neg-frac98.4%
+-commutative98.4%
distribute-neg-in98.4%
unsub-neg98.4%
metadata-eval98.4%
Simplified98.4%
fma-undefine96.9%
associate-*r/85.7%
associate-*l/90.9%
div-inv90.7%
sub-neg90.7%
metadata-eval90.7%
distribute-neg-in90.7%
+-commutative90.7%
cancel-sign-sub-inv90.7%
div-inv90.9%
fabs-sub90.9%
add-sqr-sqrt54.8%
fabs-sqr54.8%
add-sqr-sqrt55.4%
associate-*l/51.3%
associate-*r/57.0%
Applied egg-rr57.0%
Final simplification51.0%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -180000000000.0) (* x (/ (+ -1.0 z) y_m)) (if (<= x 4.9e+16) (/ (- (+ x 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 <= -180000000000.0) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 4.9e+16) {
tmp = ((x + 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 <= (-180000000000.0d0)) then
tmp = x * (((-1.0d0) + z) / y_m)
else if (x <= 4.9d+16) then
tmp = ((x + 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 <= -180000000000.0) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 4.9e+16) {
tmp = ((x + 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 <= -180000000000.0: tmp = x * ((-1.0 + z) / y_m) elif x <= 4.9e+16: tmp = ((x + 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 <= -180000000000.0) tmp = Float64(x * Float64(Float64(-1.0 + z) / y_m)); elseif (x <= 4.9e+16) tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / 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 <= -180000000000.0) tmp = x * ((-1.0 + z) / y_m); elseif (x <= 4.9e+16) tmp = ((x + 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, -180000000000.0], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.9e+16], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $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 -180000000000:\\
\;\;\;\;x \cdot \frac{-1 + z}{y\_m}\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{+16}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1 - z}{y\_m}\\
\end{array}
\end{array}
if x < -1.8e11Initial program 87.5%
fabs-sub87.5%
associate-*l/80.4%
associate-*r/89.1%
fma-neg95.3%
distribute-neg-frac95.3%
+-commutative95.3%
distribute-neg-in95.3%
unsub-neg95.3%
metadata-eval95.3%
Simplified95.3%
add-sqr-sqrt44.4%
fabs-sqr44.4%
add-sqr-sqrt44.9%
fma-undefine43.4%
associate-*r/39.0%
associate-*l/41.8%
div-inv41.7%
sub-neg41.7%
metadata-eval41.7%
distribute-neg-in41.7%
+-commutative41.7%
cancel-sign-sub-inv41.7%
div-inv41.8%
associate-*l/39.0%
sub-div43.6%
Applied egg-rr43.6%
Taylor expanded in x around inf 43.6%
sub-neg43.6%
metadata-eval43.6%
associate-/l*47.9%
Simplified47.9%
if -1.8e11 < x < 4.9e16Initial program 99.1%
fabs-sub99.1%
associate-*l/99.9%
associate-*r/92.6%
fma-neg92.6%
distribute-neg-frac92.6%
+-commutative92.6%
distribute-neg-in92.6%
unsub-neg92.6%
metadata-eval92.6%
Simplified92.6%
fma-undefine92.6%
associate-*r/99.9%
associate-*l/99.1%
div-inv99.1%
sub-neg99.1%
metadata-eval99.1%
distribute-neg-in99.1%
+-commutative99.1%
cancel-sign-sub-inv99.1%
div-inv99.1%
fabs-sub99.1%
add-sqr-sqrt48.3%
fabs-sqr48.3%
add-sqr-sqrt49.8%
associate-*l/49.9%
sub-div49.9%
Applied egg-rr49.9%
if 4.9e16 < x Initial program 90.2%
fabs-sub90.2%
associate-*l/84.5%
associate-*r/96.7%
fma-neg98.3%
distribute-neg-frac98.3%
+-commutative98.3%
distribute-neg-in98.3%
unsub-neg98.3%
metadata-eval98.3%
Simplified98.3%
fma-undefine96.7%
associate-*r/84.5%
associate-*l/90.2%
div-inv90.0%
sub-neg90.0%
metadata-eval90.0%
distribute-neg-in90.0%
+-commutative90.0%
cancel-sign-sub-inv90.0%
div-inv90.2%
fabs-sub90.2%
add-sqr-sqrt54.5%
fabs-sqr54.5%
add-sqr-sqrt55.0%
associate-*l/50.6%
sub-div52.2%
Applied egg-rr52.2%
Taylor expanded in x around inf 52.2%
associate-/l*58.1%
Simplified58.1%
Final simplification51.4%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -180000000000.0) (* x (/ (+ -1.0 z) y_m)) (if (<= x 0.00017) (/ (- 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 <= -180000000000.0) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 0.00017) {
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 <= (-180000000000.0d0)) then
tmp = x * (((-1.0d0) + z) / y_m)
else if (x <= 0.00017d0) 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 <= -180000000000.0) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 0.00017) {
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 <= -180000000000.0: tmp = x * ((-1.0 + z) / y_m) elif x <= 0.00017: 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 <= -180000000000.0) tmp = Float64(x * Float64(Float64(-1.0 + z) / y_m)); elseif (x <= 0.00017) tmp = Float64(Float64(4.0 - Float64(x * z)) / 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 <= -180000000000.0) tmp = x * ((-1.0 + z) / y_m); elseif (x <= 0.00017) 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, -180000000000.0], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.00017], N[(N[(4.0 - N[(x * z), $MachinePrecision]), $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 -180000000000:\\
\;\;\;\;x \cdot \frac{-1 + z}{y\_m}\\
\mathbf{elif}\;x \leq 0.00017:\\
\;\;\;\;\frac{4 - x \cdot z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1 - z}{y\_m}\\
\end{array}
\end{array}
if x < -1.8e11Initial program 87.5%
fabs-sub87.5%
associate-*l/80.4%
associate-*r/89.1%
fma-neg95.3%
distribute-neg-frac95.3%
+-commutative95.3%
distribute-neg-in95.3%
unsub-neg95.3%
metadata-eval95.3%
Simplified95.3%
add-sqr-sqrt44.4%
fabs-sqr44.4%
add-sqr-sqrt44.9%
fma-undefine43.4%
associate-*r/39.0%
associate-*l/41.8%
div-inv41.7%
sub-neg41.7%
metadata-eval41.7%
distribute-neg-in41.7%
+-commutative41.7%
cancel-sign-sub-inv41.7%
div-inv41.8%
associate-*l/39.0%
sub-div43.6%
Applied egg-rr43.6%
Taylor expanded in x around inf 43.6%
sub-neg43.6%
metadata-eval43.6%
associate-/l*47.9%
Simplified47.9%
if -1.8e11 < x < 1.7e-4Initial program 99.0%
fabs-sub99.0%
associate-*l/99.9%
associate-*r/92.4%
fma-neg92.4%
distribute-neg-frac92.4%
+-commutative92.4%
distribute-neg-in92.4%
unsub-neg92.4%
metadata-eval92.4%
Simplified92.4%
fma-undefine92.4%
associate-*r/99.9%
associate-*l/99.0%
div-inv99.0%
sub-neg99.0%
metadata-eval99.0%
distribute-neg-in99.0%
+-commutative99.0%
cancel-sign-sub-inv99.0%
div-inv99.0%
fabs-sub99.0%
add-sqr-sqrt47.4%
fabs-sqr47.4%
add-sqr-sqrt49.0%
associate-*l/49.1%
sub-div49.1%
Applied egg-rr49.1%
Taylor expanded in x around 0 49.2%
if 1.7e-4 < x Initial program 90.8%
fabs-sub90.8%
associate-*l/85.5%
associate-*r/96.9%
fma-neg98.4%
distribute-neg-frac98.4%
+-commutative98.4%
distribute-neg-in98.4%
unsub-neg98.4%
metadata-eval98.4%
Simplified98.4%
fma-undefine96.9%
associate-*r/85.5%
associate-*l/90.8%
div-inv90.6%
sub-neg90.6%
metadata-eval90.6%
distribute-neg-in90.6%
+-commutative90.6%
cancel-sign-sub-inv90.6%
div-inv90.8%
fabs-sub90.8%
add-sqr-sqrt55.7%
fabs-sqr55.7%
add-sqr-sqrt56.2%
associate-*l/52.0%
sub-div53.5%
Applied egg-rr53.5%
Taylor expanded in x around inf 53.3%
associate-/l*58.9%
Simplified58.9%
Final simplification51.4%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -3.8) (* x (/ (+ -1.0 z) y_m)) (if (<= x 7e-18) (/ (+ 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 <= -3.8) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 7e-18) {
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 <= (-3.8d0)) then
tmp = x * (((-1.0d0) + z) / y_m)
else if (x <= 7d-18) 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 <= -3.8) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 7e-18) {
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 <= -3.8: tmp = x * ((-1.0 + z) / y_m) elif x <= 7e-18: 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 <= -3.8) tmp = Float64(x * Float64(Float64(-1.0 + z) / y_m)); elseif (x <= 7e-18) 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 <= -3.8) tmp = x * ((-1.0 + z) / y_m); elseif (x <= 7e-18) 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, -3.8], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7e-18], 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 -3.8:\\
\;\;\;\;x \cdot \frac{-1 + z}{y\_m}\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-18}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1 - z}{y\_m}\\
\end{array}
\end{array}
if x < -3.7999999999999998Initial program 87.8%
fabs-sub87.8%
associate-*l/81.0%
associate-*r/89.4%
fma-neg95.4%
distribute-neg-frac95.4%
+-commutative95.4%
distribute-neg-in95.4%
unsub-neg95.4%
metadata-eval95.4%
Simplified95.4%
add-sqr-sqrt44.5%
fabs-sqr44.5%
add-sqr-sqrt45.1%
fma-undefine43.6%
associate-*r/39.4%
associate-*l/42.1%
div-inv42.0%
sub-neg42.0%
metadata-eval42.0%
distribute-neg-in42.0%
+-commutative42.0%
cancel-sign-sub-inv42.0%
div-inv42.1%
associate-*l/39.4%
sub-div43.8%
Applied egg-rr43.8%
Taylor expanded in x around inf 43.0%
sub-neg43.0%
metadata-eval43.0%
associate-/l*47.2%
Simplified47.2%
if -3.7999999999999998 < x < 6.9999999999999997e-18Initial program 99.0%
fabs-sub99.0%
associate-*l/99.9%
associate-*r/92.0%
fma-neg92.0%
distribute-neg-frac92.0%
+-commutative92.0%
distribute-neg-in92.0%
unsub-neg92.0%
metadata-eval92.0%
Simplified92.0%
fma-undefine92.0%
associate-*r/99.9%
associate-*l/99.0%
div-inv99.0%
sub-neg99.0%
metadata-eval99.0%
distribute-neg-in99.0%
+-commutative99.0%
cancel-sign-sub-inv99.0%
div-inv99.0%
fabs-sub99.0%
add-sqr-sqrt47.8%
fabs-sqr47.8%
add-sqr-sqrt49.3%
associate-*l/49.4%
sub-div49.4%
Applied egg-rr49.4%
Taylor expanded in z around 0 39.6%
if 6.9999999999999997e-18 < x Initial program 91.4%
fabs-sub91.4%
associate-*l/86.5%
associate-*r/97.1%
fma-neg98.5%
distribute-neg-frac98.5%
+-commutative98.5%
distribute-neg-in98.5%
unsub-neg98.5%
metadata-eval98.5%
Simplified98.5%
fma-undefine97.1%
associate-*r/86.5%
associate-*l/91.4%
div-inv91.2%
sub-neg91.2%
metadata-eval91.2%
distribute-neg-in91.2%
+-commutative91.2%
cancel-sign-sub-inv91.2%
div-inv91.4%
fabs-sub91.4%
add-sqr-sqrt54.5%
fabs-sqr54.5%
add-sqr-sqrt55.1%
associate-*l/51.3%
sub-div52.7%
Applied egg-rr52.7%
Taylor expanded in x around inf 52.5%
associate-/l*57.6%
Simplified57.6%
Final simplification46.6%
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 87.8%
fabs-sub87.8%
associate-*l/81.0%
associate-*r/89.4%
fma-neg95.4%
distribute-neg-frac95.4%
+-commutative95.4%
distribute-neg-in95.4%
unsub-neg95.4%
metadata-eval95.4%
Simplified95.4%
add-sqr-sqrt44.5%
fabs-sqr44.5%
add-sqr-sqrt45.1%
fma-undefine43.6%
associate-*r/39.4%
associate-*l/42.1%
div-inv42.0%
sub-neg42.0%
metadata-eval42.0%
distribute-neg-in42.0%
+-commutative42.0%
cancel-sign-sub-inv42.0%
div-inv42.1%
associate-*l/39.4%
sub-div43.8%
Applied egg-rr43.8%
Taylor expanded in z around 0 29.9%
associate-*r/29.9%
distribute-lft-in29.9%
metadata-eval29.9%
neg-mul-129.9%
unsub-neg29.9%
Simplified29.9%
Taylor expanded in x around inf 29.1%
neg-mul-129.1%
Simplified29.1%
if -10.5 < x < 4Initial program 99.0%
fabs-sub99.0%
associate-*l/99.9%
associate-*r/92.3%
fma-neg92.3%
distribute-neg-frac92.3%
+-commutative92.3%
distribute-neg-in92.3%
unsub-neg92.3%
metadata-eval92.3%
Simplified92.3%
fma-undefine92.3%
associate-*r/99.9%
associate-*l/99.0%
div-inv99.0%
sub-neg99.0%
metadata-eval99.0%
distribute-neg-in99.0%
+-commutative99.0%
cancel-sign-sub-inv99.0%
div-inv99.0%
fabs-sub99.0%
add-sqr-sqrt47.8%
fabs-sqr47.8%
add-sqr-sqrt49.3%
associate-*l/49.5%
sub-div49.5%
Applied egg-rr49.5%
Taylor expanded in x around 0 37.9%
if 4 < x Initial program 90.6%
fabs-sub90.6%
associate-*l/85.2%
associate-*r/96.8%
fma-neg98.4%
distribute-neg-frac98.4%
+-commutative98.4%
distribute-neg-in98.4%
unsub-neg98.4%
metadata-eval98.4%
Simplified98.4%
fma-undefine96.8%
associate-*r/85.2%
associate-*l/90.6%
div-inv90.5%
sub-neg90.5%
metadata-eval90.5%
distribute-neg-in90.5%
+-commutative90.5%
cancel-sign-sub-inv90.5%
div-inv90.6%
fabs-sub90.6%
add-sqr-sqrt55.0%
fabs-sqr55.0%
add-sqr-sqrt55.6%
associate-*l/51.3%
sub-div52.8%
Applied egg-rr52.8%
Taylor expanded in x around inf 52.6%
Taylor expanded in z around 0 38.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -4.0) (* 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 <= -4.0) {
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 <= (-4.0d0)) 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 <= -4.0) {
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 <= -4.0: 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 <= -4.0) 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 <= -4.0) 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, -4.0], 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 -4:\\
\;\;\;\;x \cdot \frac{-1 + z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\
\end{array}
\end{array}
if x < -4Initial program 87.8%
fabs-sub87.8%
associate-*l/81.0%
associate-*r/89.4%
fma-neg95.4%
distribute-neg-frac95.4%
+-commutative95.4%
distribute-neg-in95.4%
unsub-neg95.4%
metadata-eval95.4%
Simplified95.4%
add-sqr-sqrt44.5%
fabs-sqr44.5%
add-sqr-sqrt45.1%
fma-undefine43.6%
associate-*r/39.4%
associate-*l/42.1%
div-inv42.0%
sub-neg42.0%
metadata-eval42.0%
distribute-neg-in42.0%
+-commutative42.0%
cancel-sign-sub-inv42.0%
div-inv42.1%
associate-*l/39.4%
sub-div43.8%
Applied egg-rr43.8%
Taylor expanded in x around inf 43.0%
sub-neg43.0%
metadata-eval43.0%
associate-/l*47.2%
Simplified47.2%
if -4 < x Initial program 96.2%
fabs-sub96.2%
associate-*l/94.9%
associate-*r/93.9%
fma-neg94.4%
distribute-neg-frac94.4%
+-commutative94.4%
distribute-neg-in94.4%
unsub-neg94.4%
metadata-eval94.4%
Simplified94.4%
fma-undefine93.9%
associate-*r/94.9%
associate-*l/96.2%
div-inv96.1%
sub-neg96.1%
metadata-eval96.1%
distribute-neg-in96.1%
+-commutative96.1%
cancel-sign-sub-inv96.1%
div-inv96.2%
fabs-sub96.2%
add-sqr-sqrt50.3%
fabs-sqr50.3%
add-sqr-sqrt51.5%
associate-*l/50.1%
sub-div50.6%
Applied egg-rr50.6%
Taylor expanded in z around 0 38.2%
Final simplification40.6%
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 87.8%
fabs-sub87.8%
associate-*l/81.0%
associate-*r/89.4%
fma-neg95.4%
distribute-neg-frac95.4%
+-commutative95.4%
distribute-neg-in95.4%
unsub-neg95.4%
metadata-eval95.4%
Simplified95.4%
add-sqr-sqrt44.5%
fabs-sqr44.5%
add-sqr-sqrt45.1%
fma-undefine43.6%
associate-*r/39.4%
associate-*l/42.1%
div-inv42.0%
sub-neg42.0%
metadata-eval42.0%
distribute-neg-in42.0%
+-commutative42.0%
cancel-sign-sub-inv42.0%
div-inv42.1%
associate-*l/39.4%
sub-div43.8%
Applied egg-rr43.8%
Taylor expanded in z around 0 29.9%
associate-*r/29.9%
distribute-lft-in29.9%
metadata-eval29.9%
neg-mul-129.9%
unsub-neg29.9%
Simplified29.9%
if -4 < x Initial program 96.2%
fabs-sub96.2%
associate-*l/94.9%
associate-*r/93.9%
fma-neg94.4%
distribute-neg-frac94.4%
+-commutative94.4%
distribute-neg-in94.4%
unsub-neg94.4%
metadata-eval94.4%
Simplified94.4%
fma-undefine93.9%
associate-*r/94.9%
associate-*l/96.2%
div-inv96.1%
sub-neg96.1%
metadata-eval96.1%
distribute-neg-in96.1%
+-commutative96.1%
cancel-sign-sub-inv96.1%
div-inv96.2%
fabs-sub96.2%
add-sqr-sqrt50.3%
fabs-sqr50.3%
add-sqr-sqrt51.5%
associate-*l/50.1%
sub-div50.6%
Applied egg-rr50.6%
Taylor expanded in z around 0 38.2%
Final simplification36.0%
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 87.8%
fabs-sub87.8%
associate-*l/81.0%
associate-*r/89.4%
fma-neg95.4%
distribute-neg-frac95.4%
+-commutative95.4%
distribute-neg-in95.4%
unsub-neg95.4%
metadata-eval95.4%
Simplified95.4%
add-sqr-sqrt44.5%
fabs-sqr44.5%
add-sqr-sqrt45.1%
fma-undefine43.6%
associate-*r/39.4%
associate-*l/42.1%
div-inv42.0%
sub-neg42.0%
metadata-eval42.0%
distribute-neg-in42.0%
+-commutative42.0%
cancel-sign-sub-inv42.0%
div-inv42.1%
associate-*l/39.4%
sub-div43.8%
Applied egg-rr43.8%
Taylor expanded in z around 0 29.9%
associate-*r/29.9%
distribute-lft-in29.9%
metadata-eval29.9%
neg-mul-129.9%
unsub-neg29.9%
Simplified29.9%
Taylor expanded in x around inf 29.1%
neg-mul-129.1%
Simplified29.1%
if -4 < x Initial program 96.2%
fabs-sub96.2%
associate-*l/94.9%
associate-*r/93.9%
fma-neg94.4%
distribute-neg-frac94.4%
+-commutative94.4%
distribute-neg-in94.4%
unsub-neg94.4%
metadata-eval94.4%
Simplified94.4%
fma-undefine93.9%
associate-*r/94.9%
associate-*l/96.2%
div-inv96.1%
sub-neg96.1%
metadata-eval96.1%
distribute-neg-in96.1%
+-commutative96.1%
cancel-sign-sub-inv96.1%
div-inv96.2%
fabs-sub96.2%
add-sqr-sqrt50.3%
fabs-sqr50.3%
add-sqr-sqrt51.5%
associate-*l/50.1%
sub-div50.6%
Applied egg-rr50.6%
Taylor expanded in z around 0 38.2%
Final simplification35.8%
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 95.1%
fabs-sub95.1%
associate-*l/93.3%
associate-*r/91.3%
fma-neg93.4%
distribute-neg-frac93.4%
+-commutative93.4%
distribute-neg-in93.4%
unsub-neg93.4%
metadata-eval93.4%
Simplified93.4%
fma-undefine91.3%
associate-*r/93.3%
associate-*l/95.1%
div-inv95.1%
sub-neg95.1%
metadata-eval95.1%
distribute-neg-in95.1%
+-commutative95.1%
cancel-sign-sub-inv95.1%
div-inv95.1%
fabs-sub95.1%
add-sqr-sqrt47.2%
fabs-sqr47.2%
add-sqr-sqrt48.4%
associate-*l/47.0%
sub-div49.1%
Applied egg-rr49.1%
Taylor expanded in x around 0 25.7%
if 4 < x Initial program 90.6%
fabs-sub90.6%
associate-*l/85.2%
associate-*r/96.8%
fma-neg98.4%
distribute-neg-frac98.4%
+-commutative98.4%
distribute-neg-in98.4%
unsub-neg98.4%
metadata-eval98.4%
Simplified98.4%
fma-undefine96.8%
associate-*r/85.2%
associate-*l/90.6%
div-inv90.5%
sub-neg90.5%
metadata-eval90.5%
distribute-neg-in90.5%
+-commutative90.5%
cancel-sign-sub-inv90.5%
div-inv90.6%
fabs-sub90.6%
add-sqr-sqrt55.0%
fabs-sqr55.0%
add-sqr-sqrt55.6%
associate-*l/51.3%
sub-div52.8%
Applied egg-rr52.8%
Taylor expanded in x around inf 52.6%
Taylor expanded in z around 0 38.7%
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 94.0%
fabs-sub94.0%
associate-*l/91.2%
associate-*r/92.7%
fma-neg94.7%
distribute-neg-frac94.7%
+-commutative94.7%
distribute-neg-in94.7%
unsub-neg94.7%
metadata-eval94.7%
Simplified94.7%
fma-undefine92.7%
associate-*r/91.2%
associate-*l/94.0%
div-inv93.9%
sub-neg93.9%
metadata-eval93.9%
distribute-neg-in93.9%
+-commutative93.9%
cancel-sign-sub-inv93.9%
div-inv94.0%
fabs-sub94.0%
add-sqr-sqrt49.2%
fabs-sqr49.2%
add-sqr-sqrt50.2%
associate-*l/48.1%
sub-div50.1%
Applied egg-rr50.1%
Taylor expanded in x around 0 20.0%
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 94.0%
fabs-sub94.0%
associate-*l/91.2%
associate-*r/92.7%
fma-neg94.7%
distribute-neg-frac94.7%
+-commutative94.7%
distribute-neg-in94.7%
unsub-neg94.7%
metadata-eval94.7%
Simplified94.7%
add-sqr-sqrt45.1%
fabs-sqr45.1%
add-sqr-sqrt46.1%
fma-undefine45.7%
associate-*r/44.6%
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/44.6%
sub-div46.2%
Applied egg-rr46.2%
Taylor expanded in x around 0 22.0%
herbie shell --seed 2024135
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))