
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= y_m 1.2e-128)
(* (/ (/ 1.0 z) y_m) (/ (/ 1.0 z) x_m))
(/ (/ (/ (/ 1.0 x_m) y_m) (hypot 1.0 z)) (hypot 1.0 z))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 1.2e-128) {
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x_m);
} else {
tmp = (((1.0 / x_m) / y_m) / hypot(1.0, z)) / hypot(1.0, z);
}
return y_s * (x_s * tmp);
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 1.2e-128) {
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x_m);
} else {
tmp = (((1.0 / x_m) / y_m) / Math.hypot(1.0, z)) / Math.hypot(1.0, z);
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if y_m <= 1.2e-128: tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x_m) else: tmp = (((1.0 / x_m) / y_m) / math.hypot(1.0, z)) / math.hypot(1.0, z) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (y_m <= 1.2e-128) tmp = Float64(Float64(Float64(1.0 / z) / y_m) * Float64(Float64(1.0 / z) / x_m)); else tmp = Float64(Float64(Float64(Float64(1.0 / x_m) / y_m) / hypot(1.0, z)) / hypot(1.0, z)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (y_m <= 1.2e-128)
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x_m);
else
tmp = (((1.0 / x_m) / y_m) / hypot(1.0, z)) / hypot(1.0, z);
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[y$95$m, 1.2e-128], N[(N[(N[(1.0 / z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.2 \cdot 10^{-128}:\\
\;\;\;\;\frac{\frac{1}{z}}{y\_m} \cdot \frac{\frac{1}{z}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\frac{1}{x\_m}}{y\_m}}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right)}\\
\end{array}\right)
\end{array}
if y < 1.1999999999999999e-128Initial program 85.5%
associate-/l/85.4%
remove-double-neg85.4%
distribute-rgt-neg-out85.4%
distribute-rgt-neg-out85.4%
remove-double-neg85.4%
associate-*l*86.0%
*-commutative86.0%
sqr-neg86.0%
+-commutative86.0%
sqr-neg86.0%
fma-define86.0%
Simplified86.0%
Taylor expanded in z around inf 49.2%
associate-/r*48.8%
associate-/r*52.3%
associate-/r*52.3%
Simplified52.3%
unpow252.3%
Applied egg-rr52.3%
clear-num52.2%
associate-/r/52.3%
pow252.3%
pow-flip52.3%
metadata-eval52.3%
div-inv52.5%
sqr-pow52.4%
*-commutative52.4%
times-frac60.8%
metadata-eval60.8%
inv-pow60.8%
metadata-eval60.8%
inv-pow60.8%
Applied egg-rr60.8%
if 1.1999999999999999e-128 < y Initial program 93.8%
associate-/l/93.2%
remove-double-neg93.2%
distribute-rgt-neg-out93.2%
distribute-rgt-neg-out93.2%
remove-double-neg93.2%
associate-*l*93.3%
*-commutative93.3%
sqr-neg93.3%
+-commutative93.3%
sqr-neg93.3%
fma-define93.3%
Simplified93.3%
fma-undefine93.3%
+-commutative93.3%
*-commutative93.3%
associate-*r*93.2%
associate-/l/93.8%
*-un-lft-identity93.8%
add-sqr-sqrt93.5%
times-frac93.4%
*-commutative93.4%
sqrt-prod93.4%
hypot-1-def93.4%
*-commutative93.4%
sqrt-prod97.3%
hypot-1-def99.3%
Applied egg-rr99.3%
*-commutative99.3%
div-inv99.4%
associate-/r*93.5%
unpow293.5%
hypot-1-def93.5%
sqrt-prod93.5%
*-commutative93.5%
pow293.5%
add-sqr-sqrt93.8%
associate-/r*97.7%
add-sqr-sqrt97.7%
hypot-1-def97.7%
hypot-1-def97.7%
associate-/r*99.7%
Applied egg-rr99.7%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (let* ((t_0 (* (hypot 1.0 z) (sqrt y_m)))) (* y_s (* x_s (* (/ 1.0 t_0) (/ (/ 1.0 x_m) t_0))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double t_0 = hypot(1.0, z) * sqrt(y_m);
return y_s * (x_s * ((1.0 / t_0) * ((1.0 / x_m) / t_0)));
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double t_0 = Math.hypot(1.0, z) * Math.sqrt(y_m);
return y_s * (x_s * ((1.0 / t_0) * ((1.0 / x_m) / t_0)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): t_0 = math.hypot(1.0, z) * math.sqrt(y_m) return y_s * (x_s * ((1.0 / t_0) * ((1.0 / x_m) / t_0)))
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) t_0 = Float64(hypot(1.0, z) * sqrt(y_m)) return Float64(y_s * Float64(x_s * Float64(Float64(1.0 / t_0) * Float64(Float64(1.0 / x_m) / t_0)))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
t_0 = hypot(1.0, z) * sqrt(y_m);
tmp = y_s * (x_s * ((1.0 / t_0) * ((1.0 / x_m) / t_0)));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(1, z\right) \cdot \sqrt{y\_m}\\
y\_s \cdot \left(x\_s \cdot \left(\frac{1}{t\_0} \cdot \frac{\frac{1}{x\_m}}{t\_0}\right)\right)
\end{array}
\end{array}
Initial program 88.5%
associate-/l/88.3%
remove-double-neg88.3%
distribute-rgt-neg-out88.3%
distribute-rgt-neg-out88.3%
remove-double-neg88.3%
associate-*l*88.7%
*-commutative88.7%
sqr-neg88.7%
+-commutative88.7%
sqr-neg88.7%
fma-define88.7%
Simplified88.7%
fma-undefine88.7%
+-commutative88.7%
*-commutative88.7%
associate-*r*88.3%
associate-/l/88.5%
*-un-lft-identity88.5%
add-sqr-sqrt44.2%
times-frac44.2%
*-commutative44.2%
sqrt-prod44.2%
hypot-1-def44.2%
*-commutative44.2%
sqrt-prod45.6%
hypot-1-def50.5%
Applied egg-rr50.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (pow (/ (pow x_m -0.5) (* (hypot 1.0 z) (sqrt y_m))) 2.0))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * pow((pow(x_m, -0.5) / (hypot(1.0, z) * sqrt(y_m))), 2.0));
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * Math.pow((Math.pow(x_m, -0.5) / (Math.hypot(1.0, z) * Math.sqrt(y_m))), 2.0));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * math.pow((math.pow(x_m, -0.5) / (math.hypot(1.0, z) * math.sqrt(y_m))), 2.0))
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * (Float64((x_m ^ -0.5) / Float64(hypot(1.0, z) * sqrt(y_m))) ^ 2.0))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
tmp = y_s * (x_s * (((x_m ^ -0.5) / (hypot(1.0, z) * sqrt(y_m))) ^ 2.0));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[Power[N[(N[Power[x$95$m, -0.5], $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot {\left(\frac{{x\_m}^{-0.5}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y\_m}}\right)}^{2}\right)
\end{array}
Initial program 88.5%
associate-/l/88.3%
remove-double-neg88.3%
distribute-rgt-neg-out88.3%
distribute-rgt-neg-out88.3%
remove-double-neg88.3%
associate-*l*88.7%
*-commutative88.7%
sqr-neg88.7%
+-commutative88.7%
sqr-neg88.7%
fma-define88.7%
Simplified88.7%
fma-undefine88.7%
+-commutative88.7%
*-commutative88.7%
associate-*r*88.3%
associate-/l/88.5%
add-sqr-sqrt63.0%
sqrt-div25.0%
inv-pow25.0%
sqrt-pow125.0%
metadata-eval25.0%
*-commutative25.0%
sqrt-prod25.0%
hypot-1-def25.0%
sqrt-div25.0%
inv-pow25.0%
sqrt-pow125.0%
metadata-eval25.0%
*-commutative25.0%
Applied egg-rr27.9%
unpow227.9%
Simplified27.9%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ (* (/ 1.0 (hypot 1.0 z)) (/ 1.0 (* (hypot 1.0 z) x_m))) y_m))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (((1.0 / hypot(1.0, z)) * (1.0 / (hypot(1.0, z) * x_m))) / y_m));
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (((1.0 / Math.hypot(1.0, z)) * (1.0 / (Math.hypot(1.0, z) * x_m))) / y_m));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * (((1.0 / math.hypot(1.0, z)) * (1.0 / (math.hypot(1.0, z) * x_m))) / y_m))
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(Float64(Float64(1.0 / hypot(1.0, z)) * Float64(1.0 / Float64(hypot(1.0, z) * x_m))) / y_m))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
tmp = y_s * (x_s * (((1.0 / hypot(1.0, z)) * (1.0 / (hypot(1.0, z) * x_m))) / y_m));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)} \cdot \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot x\_m}}{y\_m}\right)
\end{array}
Initial program 88.5%
associate-/l/88.3%
remove-double-neg88.3%
distribute-rgt-neg-out88.3%
distribute-rgt-neg-out88.3%
remove-double-neg88.3%
associate-*l*88.7%
*-commutative88.7%
sqr-neg88.7%
+-commutative88.7%
sqr-neg88.7%
fma-define88.7%
Simplified88.7%
fma-undefine88.7%
+-commutative88.7%
*-commutative88.7%
associate-*r*88.3%
associate-/l/88.5%
*-un-lft-identity88.5%
add-sqr-sqrt44.2%
times-frac44.2%
*-commutative44.2%
sqrt-prod44.2%
hypot-1-def44.2%
*-commutative44.2%
sqrt-prod45.6%
hypot-1-def50.5%
Applied egg-rr50.5%
associate-/r*50.5%
associate-/r*50.2%
frac-times47.1%
associate-/l/47.0%
add-sqr-sqrt94.6%
Applied egg-rr94.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 5e+239)
(/ (/ (/ 1.0 x_m) (fma z z 1.0)) y_m)
(* (/ (/ 1.0 z) y_m) (/ (/ 1.0 z) x_m))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e+239) {
tmp = ((1.0 / x_m) / fma(z, z, 1.0)) / y_m;
} else {
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x_m);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e+239) tmp = Float64(Float64(Float64(1.0 / x_m) / fma(z, z, 1.0)) / y_m); else tmp = Float64(Float64(Float64(1.0 / z) / y_m) * Float64(Float64(1.0 / z) / x_m)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e+239], N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+239}:\\
\;\;\;\;\frac{\frac{\frac{1}{x\_m}}{\mathsf{fma}\left(z, z, 1\right)}}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y\_m} \cdot \frac{\frac{1}{z}}{x\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 5.00000000000000007e239Initial program 94.8%
associate-/l/94.5%
remove-double-neg94.5%
distribute-rgt-neg-out94.5%
distribute-rgt-neg-out94.5%
remove-double-neg94.5%
associate-*l*95.1%
*-commutative95.1%
sqr-neg95.1%
+-commutative95.1%
sqr-neg95.1%
fma-define95.1%
Simplified95.1%
fma-undefine95.1%
+-commutative95.1%
*-commutative95.1%
associate-*r*94.5%
associate-/l/94.8%
*-un-lft-identity94.8%
add-sqr-sqrt48.1%
times-frac48.1%
*-commutative48.1%
sqrt-prod48.1%
hypot-1-def48.1%
*-commutative48.1%
sqrt-prod50.2%
hypot-1-def50.2%
Applied egg-rr50.2%
*-commutative50.2%
div-inv50.2%
associate-/r*48.1%
swap-sqr48.1%
hypot-1-def48.1%
hypot-1-def48.1%
add-sqr-sqrt48.1%
add-sqr-sqrt94.8%
associate-/r*95.6%
+-commutative95.6%
fma-define95.6%
Applied egg-rr95.6%
if 5.00000000000000007e239 < (*.f64 z z) Initial program 76.0%
associate-/l/76.0%
remove-double-neg76.0%
distribute-rgt-neg-out76.0%
distribute-rgt-neg-out76.0%
remove-double-neg76.0%
associate-*l*76.0%
*-commutative76.0%
sqr-neg76.0%
+-commutative76.0%
sqr-neg76.0%
fma-define76.0%
Simplified76.0%
Taylor expanded in z around inf 76.0%
associate-/r*76.0%
associate-/r*75.5%
associate-/r*75.6%
Simplified75.6%
unpow275.6%
Applied egg-rr75.6%
clear-num75.4%
associate-/r/75.6%
pow275.6%
pow-flip75.6%
metadata-eval75.6%
div-inv76.0%
sqr-pow76.0%
*-commutative76.0%
times-frac99.8%
metadata-eval99.8%
inv-pow99.8%
metadata-eval99.8%
inv-pow99.8%
Applied egg-rr99.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 5e+239)
(/ 1.0 (* y_m (* x_m (fma z z 1.0))))
(* (/ (/ 1.0 z) y_m) (/ (/ 1.0 z) x_m))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e+239) {
tmp = 1.0 / (y_m * (x_m * fma(z, z, 1.0)));
} else {
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x_m);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e+239) tmp = Float64(1.0 / Float64(y_m * Float64(x_m * fma(z, z, 1.0)))); else tmp = Float64(Float64(Float64(1.0 / z) / y_m) * Float64(Float64(1.0 / z) / x_m)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e+239], N[(1.0 / N[(y$95$m * N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+239}:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x\_m \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y\_m} \cdot \frac{\frac{1}{z}}{x\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 5.00000000000000007e239Initial program 94.8%
associate-/l/94.5%
remove-double-neg94.5%
distribute-rgt-neg-out94.5%
distribute-rgt-neg-out94.5%
remove-double-neg94.5%
associate-*l*95.1%
*-commutative95.1%
sqr-neg95.1%
+-commutative95.1%
sqr-neg95.1%
fma-define95.1%
Simplified95.1%
if 5.00000000000000007e239 < (*.f64 z z) Initial program 76.0%
associate-/l/76.0%
remove-double-neg76.0%
distribute-rgt-neg-out76.0%
distribute-rgt-neg-out76.0%
remove-double-neg76.0%
associate-*l*76.0%
*-commutative76.0%
sqr-neg76.0%
+-commutative76.0%
sqr-neg76.0%
fma-define76.0%
Simplified76.0%
Taylor expanded in z around inf 76.0%
associate-/r*76.0%
associate-/r*75.5%
associate-/r*75.6%
Simplified75.6%
unpow275.6%
Applied egg-rr75.6%
clear-num75.4%
associate-/r/75.6%
pow275.6%
pow-flip75.6%
metadata-eval75.6%
div-inv76.0%
sqr-pow76.0%
*-commutative76.0%
times-frac99.8%
metadata-eval99.8%
inv-pow99.8%
metadata-eval99.8%
inv-pow99.8%
Applied egg-rr99.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 5e-17)
(/ (/ 1.0 y_m) x_m)
(if (<= (* z z) 1e+275)
(/ (/ (/ (/ 1.0 z) z) x_m) y_m)
(* (/ (/ 1.0 z) y_m) (/ (/ 1.0 z) x_m)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e-17) {
tmp = (1.0 / y_m) / x_m;
} else if ((z * z) <= 1e+275) {
tmp = (((1.0 / z) / z) / x_m) / y_m;
} else {
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x_m);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 5d-17) then
tmp = (1.0d0 / y_m) / x_m
else if ((z * z) <= 1d+275) then
tmp = (((1.0d0 / z) / z) / x_m) / y_m
else
tmp = ((1.0d0 / z) / y_m) * ((1.0d0 / z) / x_m)
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e-17) {
tmp = (1.0 / y_m) / x_m;
} else if ((z * z) <= 1e+275) {
tmp = (((1.0 / z) / z) / x_m) / y_m;
} else {
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x_m);
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if (z * z) <= 5e-17: tmp = (1.0 / y_m) / x_m elif (z * z) <= 1e+275: tmp = (((1.0 / z) / z) / x_m) / y_m else: tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x_m) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e-17) tmp = Float64(Float64(1.0 / y_m) / x_m); elseif (Float64(z * z) <= 1e+275) tmp = Float64(Float64(Float64(Float64(1.0 / z) / z) / x_m) / y_m); else tmp = Float64(Float64(Float64(1.0 / z) / y_m) * Float64(Float64(1.0 / z) / x_m)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if ((z * z) <= 5e-17)
tmp = (1.0 / y_m) / x_m;
elseif ((z * z) <= 1e+275)
tmp = (((1.0 / z) / z) / x_m) / y_m;
else
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x_m);
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e-17], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+275], N[(N[(N[(N[(1.0 / z), $MachinePrecision] / z), $MachinePrecision] / x$95$m), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{elif}\;z \cdot z \leq 10^{+275}:\\
\;\;\;\;\frac{\frac{\frac{\frac{1}{z}}{z}}{x\_m}}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y\_m} \cdot \frac{\frac{1}{z}}{x\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 4.9999999999999999e-17Initial program 99.7%
associate-/l/99.3%
remove-double-neg99.3%
distribute-rgt-neg-out99.3%
distribute-rgt-neg-out99.3%
remove-double-neg99.3%
associate-*l*99.3%
*-commutative99.3%
sqr-neg99.3%
+-commutative99.3%
sqr-neg99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in z around 0 99.3%
inv-pow99.3%
add-sqr-sqrt54.1%
unpow-prod-down53.9%
Applied egg-rr53.9%
pow-sqr54.1%
*-commutative54.1%
metadata-eval54.1%
Simplified54.1%
sqrt-pow299.3%
metadata-eval99.3%
inv-pow99.3%
*-commutative99.3%
associate-/r*99.8%
Applied egg-rr99.8%
if 4.9999999999999999e-17 < (*.f64 z z) < 9.9999999999999996e274Initial program 84.4%
associate-/l/84.3%
remove-double-neg84.3%
distribute-rgt-neg-out84.3%
distribute-rgt-neg-out84.3%
remove-double-neg84.3%
associate-*l*86.1%
*-commutative86.1%
sqr-neg86.1%
+-commutative86.1%
sqr-neg86.1%
fma-define86.1%
Simplified86.1%
Taylor expanded in z around inf 80.8%
associate-/r*80.9%
associate-/r*94.3%
associate-/r*94.3%
Simplified94.3%
div-inv94.1%
*-un-lft-identity94.1%
associate-/r*94.2%
clear-num94.2%
associate-*l/94.3%
*-un-lft-identity94.3%
pow-flip94.3%
metadata-eval94.3%
clear-num94.3%
associate-/r*94.3%
clear-num94.4%
/-rgt-identity94.4%
Applied egg-rr94.4%
*-lft-identity94.4%
associate-/r*83.3%
Simplified83.3%
metadata-eval83.3%
pow-flip83.2%
pow283.2%
associate-/r*83.2%
Applied egg-rr83.2%
if 9.9999999999999996e274 < (*.f64 z z) Initial program 74.3%
associate-/l/74.3%
remove-double-neg74.3%
distribute-rgt-neg-out74.3%
distribute-rgt-neg-out74.3%
remove-double-neg74.3%
associate-*l*74.3%
*-commutative74.3%
sqr-neg74.3%
+-commutative74.3%
sqr-neg74.3%
fma-define74.3%
Simplified74.3%
Taylor expanded in z around inf 74.3%
associate-/r*74.3%
associate-/r*73.7%
associate-/r*73.8%
Simplified73.8%
unpow273.8%
Applied egg-rr73.8%
clear-num73.8%
associate-/r/73.7%
pow273.7%
pow-flip73.8%
metadata-eval73.8%
div-inv74.2%
sqr-pow74.2%
*-commutative74.2%
times-frac99.9%
metadata-eval99.9%
inv-pow99.9%
metadata-eval99.9%
inv-pow99.9%
Applied egg-rr99.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 5e-17)
(/ (/ 1.0 y_m) x_m)
(if (<= (* z z) 2e+262)
(/ (/ (/ (/ 1.0 z) z) x_m) y_m)
(* (/ (/ 1.0 x_m) z) (/ (/ 1.0 y_m) z)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e-17) {
tmp = (1.0 / y_m) / x_m;
} else if ((z * z) <= 2e+262) {
tmp = (((1.0 / z) / z) / x_m) / y_m;
} else {
tmp = ((1.0 / x_m) / z) * ((1.0 / y_m) / z);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 5d-17) then
tmp = (1.0d0 / y_m) / x_m
else if ((z * z) <= 2d+262) then
tmp = (((1.0d0 / z) / z) / x_m) / y_m
else
tmp = ((1.0d0 / x_m) / z) * ((1.0d0 / y_m) / z)
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e-17) {
tmp = (1.0 / y_m) / x_m;
} else if ((z * z) <= 2e+262) {
tmp = (((1.0 / z) / z) / x_m) / y_m;
} else {
tmp = ((1.0 / x_m) / z) * ((1.0 / y_m) / z);
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if (z * z) <= 5e-17: tmp = (1.0 / y_m) / x_m elif (z * z) <= 2e+262: tmp = (((1.0 / z) / z) / x_m) / y_m else: tmp = ((1.0 / x_m) / z) * ((1.0 / y_m) / z) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e-17) tmp = Float64(Float64(1.0 / y_m) / x_m); elseif (Float64(z * z) <= 2e+262) tmp = Float64(Float64(Float64(Float64(1.0 / z) / z) / x_m) / y_m); else tmp = Float64(Float64(Float64(1.0 / x_m) / z) * Float64(Float64(1.0 / y_m) / z)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if ((z * z) <= 5e-17)
tmp = (1.0 / y_m) / x_m;
elseif ((z * z) <= 2e+262)
tmp = (((1.0 / z) / z) / x_m) / y_m;
else
tmp = ((1.0 / x_m) / z) * ((1.0 / y_m) / z);
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e-17], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+262], N[(N[(N[(N[(1.0 / z), $MachinePrecision] / z), $MachinePrecision] / x$95$m), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision] * N[(N[(1.0 / y$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+262}:\\
\;\;\;\;\frac{\frac{\frac{\frac{1}{z}}{z}}{x\_m}}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{z} \cdot \frac{\frac{1}{y\_m}}{z}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 4.9999999999999999e-17Initial program 99.7%
associate-/l/99.3%
remove-double-neg99.3%
distribute-rgt-neg-out99.3%
distribute-rgt-neg-out99.3%
remove-double-neg99.3%
associate-*l*99.3%
*-commutative99.3%
sqr-neg99.3%
+-commutative99.3%
sqr-neg99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in z around 0 99.3%
inv-pow99.3%
add-sqr-sqrt54.1%
unpow-prod-down53.9%
Applied egg-rr53.9%
pow-sqr54.1%
*-commutative54.1%
metadata-eval54.1%
Simplified54.1%
sqrt-pow299.3%
metadata-eval99.3%
inv-pow99.3%
*-commutative99.3%
associate-/r*99.8%
Applied egg-rr99.8%
if 4.9999999999999999e-17 < (*.f64 z z) < 2e262Initial program 83.3%
associate-/l/83.3%
remove-double-neg83.3%
distribute-rgt-neg-out83.3%
distribute-rgt-neg-out83.3%
remove-double-neg83.3%
associate-*l*85.3%
*-commutative85.3%
sqr-neg85.3%
+-commutative85.3%
sqr-neg85.3%
fma-define85.3%
Simplified85.3%
Taylor expanded in z around inf 79.5%
associate-/r*79.5%
associate-/r*93.9%
associate-/r*93.8%
Simplified93.8%
div-inv93.7%
*-un-lft-identity93.7%
associate-/r*93.7%
clear-num93.7%
associate-*l/93.9%
*-un-lft-identity93.9%
pow-flip93.9%
metadata-eval93.9%
clear-num93.8%
associate-/r*93.9%
clear-num94.0%
/-rgt-identity94.0%
Applied egg-rr94.0%
*-lft-identity94.0%
associate-/r*82.2%
Simplified82.2%
metadata-eval82.2%
pow-flip82.0%
pow282.0%
associate-/r*82.1%
Applied egg-rr82.1%
if 2e262 < (*.f64 z z) Initial program 75.5%
associate-/l/75.4%
remove-double-neg75.4%
distribute-rgt-neg-out75.4%
distribute-rgt-neg-out75.4%
remove-double-neg75.4%
associate-*l*75.4%
*-commutative75.4%
sqr-neg75.4%
+-commutative75.4%
sqr-neg75.4%
fma-define75.4%
Simplified75.4%
Taylor expanded in z around inf 75.4%
associate-/r*75.5%
associate-/r*75.0%
associate-/r*75.0%
Simplified75.0%
associate-/r*75.0%
div-inv75.0%
unpow275.0%
times-frac99.8%
Applied egg-rr99.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 5e-17)
(/ (/ 1.0 y_m) x_m)
(if (<= (* z z) 2e+266)
(/ (/ 1.0 (* y_m x_m)) (* z z))
(/ (/ 1.0 x_m) (* z (* z y_m))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e-17) {
tmp = (1.0 / y_m) / x_m;
} else if ((z * z) <= 2e+266) {
tmp = (1.0 / (y_m * x_m)) / (z * z);
} else {
tmp = (1.0 / x_m) / (z * (z * y_m));
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 5d-17) then
tmp = (1.0d0 / y_m) / x_m
else if ((z * z) <= 2d+266) then
tmp = (1.0d0 / (y_m * x_m)) / (z * z)
else
tmp = (1.0d0 / x_m) / (z * (z * y_m))
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e-17) {
tmp = (1.0 / y_m) / x_m;
} else if ((z * z) <= 2e+266) {
tmp = (1.0 / (y_m * x_m)) / (z * z);
} else {
tmp = (1.0 / x_m) / (z * (z * y_m));
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if (z * z) <= 5e-17: tmp = (1.0 / y_m) / x_m elif (z * z) <= 2e+266: tmp = (1.0 / (y_m * x_m)) / (z * z) else: tmp = (1.0 / x_m) / (z * (z * y_m)) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e-17) tmp = Float64(Float64(1.0 / y_m) / x_m); elseif (Float64(z * z) <= 2e+266) tmp = Float64(Float64(1.0 / Float64(y_m * x_m)) / Float64(z * z)); else tmp = Float64(Float64(1.0 / x_m) / Float64(z * Float64(z * y_m))); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if ((z * z) <= 5e-17)
tmp = (1.0 / y_m) / x_m;
elseif ((z * z) <= 2e+266)
tmp = (1.0 / (y_m * x_m)) / (z * z);
else
tmp = (1.0 / x_m) / (z * (z * y_m));
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e-17], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+266], N[(N[(1.0 / N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(z * N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+266}:\\
\;\;\;\;\frac{\frac{1}{y\_m \cdot x\_m}}{z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{z \cdot \left(z \cdot y\_m\right)}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 4.9999999999999999e-17Initial program 99.7%
associate-/l/99.3%
remove-double-neg99.3%
distribute-rgt-neg-out99.3%
distribute-rgt-neg-out99.3%
remove-double-neg99.3%
associate-*l*99.3%
*-commutative99.3%
sqr-neg99.3%
+-commutative99.3%
sqr-neg99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in z around 0 99.3%
inv-pow99.3%
add-sqr-sqrt54.1%
unpow-prod-down53.9%
Applied egg-rr53.9%
pow-sqr54.1%
*-commutative54.1%
metadata-eval54.1%
Simplified54.1%
sqrt-pow299.3%
metadata-eval99.3%
inv-pow99.3%
*-commutative99.3%
associate-/r*99.8%
Applied egg-rr99.8%
if 4.9999999999999999e-17 < (*.f64 z z) < 2.0000000000000001e266Initial program 83.9%
associate-/l/83.7%
remove-double-neg83.7%
distribute-rgt-neg-out83.7%
distribute-rgt-neg-out83.7%
remove-double-neg83.7%
associate-*l*85.7%
*-commutative85.7%
sqr-neg85.7%
+-commutative85.7%
sqr-neg85.7%
fma-define85.7%
Simplified85.7%
Taylor expanded in z around inf 80.1%
associate-/r*80.2%
associate-/r*94.1%
associate-/r*94.1%
Simplified94.1%
unpow294.1%
Applied egg-rr94.1%
if 2.0000000000000001e266 < (*.f64 z z) Initial program 74.9%
add-sqr-sqrt37.2%
pow237.2%
*-commutative37.2%
sqrt-prod37.2%
hypot-1-def48.8%
Applied egg-rr48.8%
Taylor expanded in z around inf 48.8%
unpow248.8%
swap-sqr37.2%
add-sqr-sqrt74.9%
associate-*r*90.1%
Applied egg-rr90.1%
Final simplification95.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= z 1.0)
(/ (/ 1.0 y_m) x_m)
(if (<= z 7.4e+137)
(/ (/ (/ (/ 1.0 z) z) x_m) y_m)
(/ (/ 1.0 x_m) (* z (* z y_m))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else if (z <= 7.4e+137) {
tmp = (((1.0 / z) / z) / x_m) / y_m;
} else {
tmp = (1.0 / x_m) / (z * (z * y_m));
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.0d0) then
tmp = (1.0d0 / y_m) / x_m
else if (z <= 7.4d+137) then
tmp = (((1.0d0 / z) / z) / x_m) / y_m
else
tmp = (1.0d0 / x_m) / (z * (z * y_m))
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else if (z <= 7.4e+137) {
tmp = (((1.0 / z) / z) / x_m) / y_m;
} else {
tmp = (1.0 / x_m) / (z * (z * y_m));
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y_m) / x_m elif z <= 7.4e+137: tmp = (((1.0 / z) / z) / x_m) / y_m else: tmp = (1.0 / x_m) / (z * (z * y_m)) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y_m) / x_m); elseif (z <= 7.4e+137) tmp = Float64(Float64(Float64(Float64(1.0 / z) / z) / x_m) / y_m); else tmp = Float64(Float64(1.0 / x_m) / Float64(z * Float64(z * y_m))); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (z <= 1.0)
tmp = (1.0 / y_m) / x_m;
elseif (z <= 7.4e+137)
tmp = (((1.0 / z) / z) / x_m) / y_m;
else
tmp = (1.0 / x_m) / (z * (z * y_m));
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], If[LessEqual[z, 7.4e+137], N[(N[(N[(N[(1.0 / z), $MachinePrecision] / z), $MachinePrecision] / x$95$m), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(z * N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{elif}\;z \leq 7.4 \cdot 10^{+137}:\\
\;\;\;\;\frac{\frac{\frac{\frac{1}{z}}{z}}{x\_m}}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{z \cdot \left(z \cdot y\_m\right)}\\
\end{array}\right)
\end{array}
if z < 1Initial program 93.6%
associate-/l/93.3%
remove-double-neg93.3%
distribute-rgt-neg-out93.3%
distribute-rgt-neg-out93.3%
remove-double-neg93.3%
associate-*l*93.8%
*-commutative93.8%
sqr-neg93.8%
+-commutative93.8%
sqr-neg93.8%
fma-define93.8%
Simplified93.8%
Taylor expanded in z around 0 71.5%
inv-pow71.5%
add-sqr-sqrt40.1%
unpow-prod-down40.0%
Applied egg-rr40.0%
pow-sqr40.2%
*-commutative40.2%
metadata-eval40.2%
Simplified40.2%
sqrt-pow271.5%
metadata-eval71.5%
inv-pow71.5%
*-commutative71.5%
associate-/r*71.9%
Applied egg-rr71.9%
if 1 < z < 7.40000000000000041e137Initial program 82.4%
associate-/l/82.3%
remove-double-neg82.3%
distribute-rgt-neg-out82.3%
distribute-rgt-neg-out82.3%
remove-double-neg82.3%
associate-*l*82.6%
*-commutative82.6%
sqr-neg82.6%
+-commutative82.6%
sqr-neg82.6%
fma-define82.6%
Simplified82.6%
Taylor expanded in z around inf 77.7%
associate-/r*77.8%
associate-/r*91.3%
associate-/r*91.2%
Simplified91.2%
div-inv91.1%
*-un-lft-identity91.1%
associate-/r*91.2%
clear-num91.1%
associate-*l/91.2%
*-un-lft-identity91.2%
pow-flip91.3%
metadata-eval91.3%
clear-num91.4%
associate-/r*91.4%
clear-num91.5%
/-rgt-identity91.5%
Applied egg-rr91.5%
*-lft-identity91.5%
associate-/r*79.2%
Simplified79.2%
metadata-eval79.2%
pow-flip79.1%
pow279.1%
associate-/r*79.2%
Applied egg-rr79.2%
if 7.40000000000000041e137 < z Initial program 74.3%
add-sqr-sqrt41.1%
pow241.1%
*-commutative41.1%
sqrt-prod41.1%
hypot-1-def52.1%
Applied egg-rr52.1%
Taylor expanded in z around inf 52.1%
unpow252.1%
swap-sqr41.1%
add-sqr-sqrt74.3%
associate-*r*87.2%
Applied egg-rr87.2%
Final simplification75.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 500000.0)
(/ (/ 1.0 x_m) (* y_m (+ 1.0 (* z z))))
(/ (* (/ 1.0 z) (/ 1.0 (* z x_m))) y_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 500000.0) {
tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)));
} else {
tmp = ((1.0 / z) * (1.0 / (z * x_m))) / y_m;
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 500000.0d0) then
tmp = (1.0d0 / x_m) / (y_m * (1.0d0 + (z * z)))
else
tmp = ((1.0d0 / z) * (1.0d0 / (z * x_m))) / y_m
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 500000.0) {
tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)));
} else {
tmp = ((1.0 / z) * (1.0 / (z * x_m))) / y_m;
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if (z * z) <= 500000.0: tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z))) else: tmp = ((1.0 / z) * (1.0 / (z * x_m))) / y_m return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 500000.0) tmp = Float64(Float64(1.0 / x_m) / Float64(y_m * Float64(1.0 + Float64(z * z)))); else tmp = Float64(Float64(Float64(1.0 / z) * Float64(1.0 / Float64(z * x_m))) / y_m); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if ((z * z) <= 500000.0)
tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)));
else
tmp = ((1.0 / z) * (1.0 / (z * x_m))) / y_m;
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 500000.0], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(y$95$m * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] * N[(1.0 / N[(z * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 500000:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y\_m \cdot \left(1 + z \cdot z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z} \cdot \frac{1}{z \cdot x\_m}}{y\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 5e5Initial program 99.7%
if 5e5 < (*.f64 z z) Initial program 77.9%
associate-/l/77.9%
remove-double-neg77.9%
distribute-rgt-neg-out77.9%
distribute-rgt-neg-out77.9%
remove-double-neg77.9%
associate-*l*78.7%
*-commutative78.7%
sqr-neg78.7%
+-commutative78.7%
sqr-neg78.7%
fma-define78.7%
Simplified78.7%
fma-undefine78.7%
+-commutative78.7%
*-commutative78.7%
associate-*r*77.9%
associate-/l/77.9%
*-un-lft-identity77.9%
add-sqr-sqrt36.9%
times-frac36.9%
*-commutative36.9%
sqrt-prod36.9%
hypot-1-def36.9%
*-commutative36.9%
sqrt-prod39.6%
hypot-1-def49.0%
Applied egg-rr49.0%
associate-/r*49.0%
associate-/r*48.4%
frac-times42.3%
associate-/l/42.3%
add-sqr-sqrt89.8%
Applied egg-rr89.8%
Taylor expanded in z around inf 72.2%
Taylor expanded in z around inf 89.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 5e-17)
(/ (/ 1.0 y_m) x_m)
(/ (* (/ 1.0 z) (/ 1.0 (* z x_m))) y_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e-17) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = ((1.0 / z) * (1.0 / (z * x_m))) / y_m;
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 5d-17) then
tmp = (1.0d0 / y_m) / x_m
else
tmp = ((1.0d0 / z) * (1.0d0 / (z * x_m))) / y_m
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e-17) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = ((1.0 / z) * (1.0 / (z * x_m))) / y_m;
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if (z * z) <= 5e-17: tmp = (1.0 / y_m) / x_m else: tmp = ((1.0 / z) * (1.0 / (z * x_m))) / y_m return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e-17) tmp = Float64(Float64(1.0 / y_m) / x_m); else tmp = Float64(Float64(Float64(1.0 / z) * Float64(1.0 / Float64(z * x_m))) / y_m); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if ((z * z) <= 5e-17)
tmp = (1.0 / y_m) / x_m;
else
tmp = ((1.0 / z) * (1.0 / (z * x_m))) / y_m;
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e-17], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] * N[(1.0 / N[(z * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z} \cdot \frac{1}{z \cdot x\_m}}{y\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 4.9999999999999999e-17Initial program 99.7%
associate-/l/99.3%
remove-double-neg99.3%
distribute-rgt-neg-out99.3%
distribute-rgt-neg-out99.3%
remove-double-neg99.3%
associate-*l*99.3%
*-commutative99.3%
sqr-neg99.3%
+-commutative99.3%
sqr-neg99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in z around 0 99.3%
inv-pow99.3%
add-sqr-sqrt54.1%
unpow-prod-down53.9%
Applied egg-rr53.9%
pow-sqr54.1%
*-commutative54.1%
metadata-eval54.1%
Simplified54.1%
sqrt-pow299.3%
metadata-eval99.3%
inv-pow99.3%
*-commutative99.3%
associate-/r*99.8%
Applied egg-rr99.8%
if 4.9999999999999999e-17 < (*.f64 z z) Initial program 78.4%
associate-/l/78.4%
remove-double-neg78.4%
distribute-rgt-neg-out78.4%
distribute-rgt-neg-out78.4%
remove-double-neg78.4%
associate-*l*79.1%
*-commutative79.1%
sqr-neg79.1%
+-commutative79.1%
sqr-neg79.1%
fma-define79.1%
Simplified79.1%
fma-undefine79.1%
+-commutative79.1%
*-commutative79.1%
associate-*r*78.4%
associate-/l/78.4%
*-un-lft-identity78.4%
add-sqr-sqrt36.1%
times-frac36.1%
*-commutative36.1%
sqrt-prod36.1%
hypot-1-def36.1%
*-commutative36.1%
sqrt-prod38.7%
hypot-1-def47.9%
Applied egg-rr47.9%
associate-/r*47.9%
associate-/r*47.3%
frac-times41.4%
associate-/l/41.4%
add-sqr-sqrt90.0%
Applied egg-rr90.0%
Taylor expanded in z around inf 71.2%
Taylor expanded in z around inf 88.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= z 1.0)
(/ (/ 1.0 y_m) x_m)
(* (/ 1.0 z) (/ 1.0 (* z (* y_m x_m))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / z) * (1.0 / (z * (y_m * x_m)));
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.0d0) then
tmp = (1.0d0 / y_m) / x_m
else
tmp = (1.0d0 / z) * (1.0d0 / (z * (y_m * x_m)))
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / z) * (1.0 / (z * (y_m * x_m)));
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y_m) / x_m else: tmp = (1.0 / z) * (1.0 / (z * (y_m * x_m))) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y_m) / x_m); else tmp = Float64(Float64(1.0 / z) * Float64(1.0 / Float64(z * Float64(y_m * x_m)))); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (z <= 1.0)
tmp = (1.0 / y_m) / x_m;
else
tmp = (1.0 / z) * (1.0 / (z * (y_m * x_m)));
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(1.0 / N[(z * N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{1}{z \cdot \left(y\_m \cdot x\_m\right)}\\
\end{array}\right)
\end{array}
if z < 1Initial program 93.6%
associate-/l/93.3%
remove-double-neg93.3%
distribute-rgt-neg-out93.3%
distribute-rgt-neg-out93.3%
remove-double-neg93.3%
associate-*l*93.8%
*-commutative93.8%
sqr-neg93.8%
+-commutative93.8%
sqr-neg93.8%
fma-define93.8%
Simplified93.8%
Taylor expanded in z around 0 71.5%
inv-pow71.5%
add-sqr-sqrt40.1%
unpow-prod-down40.0%
Applied egg-rr40.0%
pow-sqr40.2%
*-commutative40.2%
metadata-eval40.2%
Simplified40.2%
sqrt-pow271.5%
metadata-eval71.5%
inv-pow71.5%
*-commutative71.5%
associate-/r*71.9%
Applied egg-rr71.9%
if 1 < z Initial program 77.1%
associate-/l/77.0%
remove-double-neg77.0%
distribute-rgt-neg-out77.0%
distribute-rgt-neg-out77.0%
remove-double-neg77.0%
associate-*l*77.2%
*-commutative77.2%
sqr-neg77.2%
+-commutative77.2%
sqr-neg77.2%
fma-define77.2%
Simplified77.2%
Taylor expanded in z around inf 75.5%
associate-/r*75.5%
associate-/r*79.6%
associate-/r*79.6%
Simplified79.6%
unpow279.6%
Applied egg-rr79.6%
associate-/r*85.9%
div-inv85.9%
associate-/l/86.0%
clear-num85.9%
associate-/l/86.3%
div-inv86.3%
clear-num86.3%
/-rgt-identity86.3%
Applied egg-rr86.3%
Final simplification76.3%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= z 1.0)
(/ (/ 1.0 y_m) x_m)
(* (/ 1.0 z) (/ (/ 1.0 (* y_m x_m)) z))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / z) * ((1.0 / (y_m * x_m)) / z);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.0d0) then
tmp = (1.0d0 / y_m) / x_m
else
tmp = (1.0d0 / z) * ((1.0d0 / (y_m * x_m)) / z)
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / z) * ((1.0 / (y_m * x_m)) / z);
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y_m) / x_m else: tmp = (1.0 / z) * ((1.0 / (y_m * x_m)) / z) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y_m) / x_m); else tmp = Float64(Float64(1.0 / z) * Float64(Float64(1.0 / Float64(y_m * x_m)) / z)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (z <= 1.0)
tmp = (1.0 / y_m) / x_m;
else
tmp = (1.0 / z) * ((1.0 / (y_m * x_m)) / z);
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{\frac{1}{y\_m \cdot x\_m}}{z}\\
\end{array}\right)
\end{array}
if z < 1Initial program 93.6%
associate-/l/93.3%
remove-double-neg93.3%
distribute-rgt-neg-out93.3%
distribute-rgt-neg-out93.3%
remove-double-neg93.3%
associate-*l*93.8%
*-commutative93.8%
sqr-neg93.8%
+-commutative93.8%
sqr-neg93.8%
fma-define93.8%
Simplified93.8%
Taylor expanded in z around 0 71.5%
inv-pow71.5%
add-sqr-sqrt40.1%
unpow-prod-down40.0%
Applied egg-rr40.0%
pow-sqr40.2%
*-commutative40.2%
metadata-eval40.2%
Simplified40.2%
sqrt-pow271.5%
metadata-eval71.5%
inv-pow71.5%
*-commutative71.5%
associate-/r*71.9%
Applied egg-rr71.9%
if 1 < z Initial program 77.1%
associate-/l/77.0%
remove-double-neg77.0%
distribute-rgt-neg-out77.0%
distribute-rgt-neg-out77.0%
remove-double-neg77.0%
associate-*l*77.2%
*-commutative77.2%
sqr-neg77.2%
+-commutative77.2%
sqr-neg77.2%
fma-define77.2%
Simplified77.2%
Taylor expanded in z around inf 75.5%
associate-/r*75.5%
associate-/r*79.6%
associate-/r*79.6%
Simplified79.6%
*-un-lft-identity79.6%
associate-*r/79.6%
unpow279.6%
times-frac85.9%
Applied egg-rr85.9%
Final simplification76.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= z 1.0) (/ (/ 1.0 y_m) x_m) (/ (/ 1.0 x_m) (* z (* z y_m)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / x_m) / (z * (z * y_m));
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.0d0) then
tmp = (1.0d0 / y_m) / x_m
else
tmp = (1.0d0 / x_m) / (z * (z * y_m))
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / x_m) / (z * (z * y_m));
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y_m) / x_m else: tmp = (1.0 / x_m) / (z * (z * y_m)) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y_m) / x_m); else tmp = Float64(Float64(1.0 / x_m) / Float64(z * Float64(z * y_m))); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (z <= 1.0)
tmp = (1.0 / y_m) / x_m;
else
tmp = (1.0 / x_m) / (z * (z * y_m));
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(z * N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{z \cdot \left(z \cdot y\_m\right)}\\
\end{array}\right)
\end{array}
if z < 1Initial program 93.6%
associate-/l/93.3%
remove-double-neg93.3%
distribute-rgt-neg-out93.3%
distribute-rgt-neg-out93.3%
remove-double-neg93.3%
associate-*l*93.8%
*-commutative93.8%
sqr-neg93.8%
+-commutative93.8%
sqr-neg93.8%
fma-define93.8%
Simplified93.8%
Taylor expanded in z around 0 71.5%
inv-pow71.5%
add-sqr-sqrt40.1%
unpow-prod-down40.0%
Applied egg-rr40.0%
pow-sqr40.2%
*-commutative40.2%
metadata-eval40.2%
Simplified40.2%
sqrt-pow271.5%
metadata-eval71.5%
inv-pow71.5%
*-commutative71.5%
associate-/r*71.9%
Applied egg-rr71.9%
if 1 < z Initial program 77.1%
add-sqr-sqrt42.2%
pow242.2%
*-commutative42.2%
sqrt-prod42.2%
hypot-1-def49.4%
Applied egg-rr49.4%
Taylor expanded in z around inf 49.4%
unpow249.4%
swap-sqr42.2%
add-sqr-sqrt75.5%
associate-*r*84.0%
Applied egg-rr84.0%
Final simplification75.6%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= z 1.0) (/ (/ 1.0 y_m) x_m) (/ 1.0 (* x_m (* z y_m)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = 1.0 / (x_m * (z * y_m));
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.0d0) then
tmp = (1.0d0 / y_m) / x_m
else
tmp = 1.0d0 / (x_m * (z * y_m))
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = 1.0 / (x_m * (z * y_m));
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y_m) / x_m else: tmp = 1.0 / (x_m * (z * y_m)) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y_m) / x_m); else tmp = Float64(1.0 / Float64(x_m * Float64(z * y_m))); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (z <= 1.0)
tmp = (1.0 / y_m) / x_m;
else
tmp = 1.0 / (x_m * (z * y_m));
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(1.0 / N[(x$95$m * N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x\_m \cdot \left(z \cdot y\_m\right)}\\
\end{array}\right)
\end{array}
if z < 1Initial program 93.6%
associate-/l/93.3%
remove-double-neg93.3%
distribute-rgt-neg-out93.3%
distribute-rgt-neg-out93.3%
remove-double-neg93.3%
associate-*l*93.8%
*-commutative93.8%
sqr-neg93.8%
+-commutative93.8%
sqr-neg93.8%
fma-define93.8%
Simplified93.8%
Taylor expanded in z around 0 71.5%
inv-pow71.5%
add-sqr-sqrt40.1%
unpow-prod-down40.0%
Applied egg-rr40.0%
pow-sqr40.2%
*-commutative40.2%
metadata-eval40.2%
Simplified40.2%
sqrt-pow271.5%
metadata-eval71.5%
inv-pow71.5%
*-commutative71.5%
associate-/r*71.9%
Applied egg-rr71.9%
if 1 < z Initial program 77.1%
associate-/l/77.0%
remove-double-neg77.0%
distribute-rgt-neg-out77.0%
distribute-rgt-neg-out77.0%
remove-double-neg77.0%
associate-*l*77.2%
*-commutative77.2%
sqr-neg77.2%
+-commutative77.2%
sqr-neg77.2%
fma-define77.2%
Simplified77.2%
fma-undefine77.2%
+-commutative77.2%
*-commutative77.2%
associate-*r*77.0%
associate-/l/77.1%
*-un-lft-identity77.1%
add-sqr-sqrt42.2%
times-frac42.2%
*-commutative42.2%
sqrt-prod42.3%
hypot-1-def42.3%
*-commutative42.3%
sqrt-prod43.3%
hypot-1-def54.1%
Applied egg-rr54.1%
associate-/r*54.2%
associate-/r*54.2%
frac-times47.7%
associate-/l/47.7%
add-sqr-sqrt90.9%
Applied egg-rr90.9%
Taylor expanded in z around inf 89.4%
Taylor expanded in z around 0 46.4%
Final simplification64.0%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ (/ 1.0 y_m) x_m))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((1.0 / y_m) / x_m));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (x_s * ((1.0d0 / y_m) / x_m))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((1.0 / y_m) / x_m));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * ((1.0 / y_m) / x_m))
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(Float64(1.0 / y_m) / x_m))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
tmp = y_s * (x_s * ((1.0 / y_m) / x_m));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \frac{\frac{1}{y\_m}}{x\_m}\right)
\end{array}
Initial program 88.5%
associate-/l/88.3%
remove-double-neg88.3%
distribute-rgt-neg-out88.3%
distribute-rgt-neg-out88.3%
remove-double-neg88.3%
associate-*l*88.7%
*-commutative88.7%
sqr-neg88.7%
+-commutative88.7%
sqr-neg88.7%
fma-define88.7%
Simplified88.7%
Taylor expanded in z around 0 54.6%
inv-pow54.6%
add-sqr-sqrt29.0%
unpow-prod-down29.0%
Applied egg-rr29.0%
pow-sqr29.1%
*-commutative29.1%
metadata-eval29.1%
Simplified29.1%
sqrt-pow254.6%
metadata-eval54.6%
inv-pow54.6%
*-commutative54.6%
associate-/r*54.8%
Applied egg-rr54.8%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ (/ 1.0 x_m) y_m))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((1.0 / x_m) / y_m));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (x_s * ((1.0d0 / x_m) / y_m))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((1.0 / x_m) / y_m));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * ((1.0 / x_m) / y_m))
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(Float64(1.0 / x_m) / y_m))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
tmp = y_s * (x_s * ((1.0 / x_m) / y_m));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(1.0 / x$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \frac{\frac{1}{x\_m}}{y\_m}\right)
\end{array}
Initial program 88.5%
associate-/l/88.3%
remove-double-neg88.3%
distribute-rgt-neg-out88.3%
distribute-rgt-neg-out88.3%
remove-double-neg88.3%
associate-*l*88.7%
*-commutative88.7%
sqr-neg88.7%
+-commutative88.7%
sqr-neg88.7%
fma-define88.7%
Simplified88.7%
Taylor expanded in z around 0 54.6%
associate-/r*54.8%
Simplified54.8%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ 1.0 (* y_m x_m)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (1.0 / (y_m * x_m)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (x_s * (1.0d0 / (y_m * x_m)))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (1.0 / (y_m * x_m)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * (1.0 / (y_m * x_m)))
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(1.0 / Float64(y_m * x_m)))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
tmp = y_s * (x_s * (1.0 / (y_m * x_m)));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(1.0 / N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \frac{1}{y\_m \cdot x\_m}\right)
\end{array}
Initial program 88.5%
associate-/l/88.3%
remove-double-neg88.3%
distribute-rgt-neg-out88.3%
distribute-rgt-neg-out88.3%
remove-double-neg88.3%
associate-*l*88.7%
*-commutative88.7%
sqr-neg88.7%
+-commutative88.7%
sqr-neg88.7%
fma-define88.7%
Simplified88.7%
Taylor expanded in z around 0 54.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* z z))) (t_1 (* y t_0)) (t_2 (/ (/ 1.0 y) (* t_0 x))))
(if (< t_1 (- INFINITY))
t_2
(if (< t_1 8.680743250567252e+305) (/ (/ 1.0 x) (* t_0 y)) t_2))))
double code(double x, double y, double z) {
double t_0 = 1.0 + (z * z);
double t_1 = y * t_0;
double t_2 = (1.0 / y) / (t_0 * x);
double tmp;
if (t_1 < -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 < 8.680743250567252e+305) {
tmp = (1.0 / x) / (t_0 * y);
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = 1.0 + (z * z);
double t_1 = y * t_0;
double t_2 = (1.0 / y) / (t_0 * x);
double tmp;
if (t_1 < -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if (t_1 < 8.680743250567252e+305) {
tmp = (1.0 / x) / (t_0 * y);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + (z * z) t_1 = y * t_0 t_2 = (1.0 / y) / (t_0 * x) tmp = 0 if t_1 < -math.inf: tmp = t_2 elif t_1 < 8.680743250567252e+305: tmp = (1.0 / x) / (t_0 * y) else: tmp = t_2 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(z * z)) t_1 = Float64(y * t_0) t_2 = Float64(Float64(1.0 / y) / Float64(t_0 * x)) tmp = 0.0 if (t_1 < Float64(-Inf)) tmp = t_2; elseif (t_1 < 8.680743250567252e+305) tmp = Float64(Float64(1.0 / x) / Float64(t_0 * y)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + (z * z); t_1 = y * t_0; t_2 = (1.0 / y) / (t_0 * x); tmp = 0.0; if (t_1 < -Inf) tmp = t_2; elseif (t_1 < 8.680743250567252e+305) tmp = (1.0 / x) / (t_0 * y); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 / y), $MachinePrecision] / N[(t$95$0 * x), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$1, (-Infinity)], t$95$2, If[Less[t$95$1, 8.680743250567252e+305], N[(N[(1.0 / x), $MachinePrecision] / N[(t$95$0 * y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + z \cdot z\\
t_1 := y \cdot t\_0\\
t_2 := \frac{\frac{1}{y}}{t\_0 \cdot x}\\
\mathbf{if}\;t\_1 < -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 < 8.680743250567252 \cdot 10^{+305}:\\
\;\;\;\;\frac{\frac{1}{x}}{t\_0 \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024163
(FPCore (x y z)
:name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (if (< (* y (+ 1 (* z z))) -inf.0) (/ (/ 1 y) (* (+ 1 (* z z)) x)) (if (< (* y (+ 1 (* z z))) 868074325056725200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (/ 1 x) (* (+ 1 (* z z)) y)) (/ (/ 1 y) (* (+ 1 (* z z)) x)))))
(/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))