
(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 11 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 (<= (* z z) 1e+222)
(/ (/ 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) <= 1e+222) {
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) <= 1e+222) tmp = Float64(Float64(1.0 / 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], 1e+222], N[(N[(1.0 / y$95$m), $MachinePrecision] / N[(x$95$m * N[(z * z + 1.0), $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 10^{+222}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\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) < 1e222Initial program 98.0%
associate-/l/97.8%
remove-double-neg97.8%
distribute-rgt-neg-out97.8%
distribute-rgt-neg-out97.8%
remove-double-neg97.8%
associate-*l*95.1%
*-commutative95.1%
sqr-neg95.1%
+-commutative95.1%
sqr-neg95.1%
fma-define95.1%
Simplified95.1%
associate-*r*97.9%
*-commutative97.9%
associate-/r*97.3%
*-commutative97.3%
associate-/l/97.6%
fma-undefine97.6%
+-commutative97.6%
associate-/r*98.0%
*-un-lft-identity98.0%
add-sqr-sqrt49.4%
times-frac49.4%
+-commutative49.4%
fma-undefine49.4%
*-commutative49.4%
sqrt-prod49.4%
fma-undefine49.4%
+-commutative49.4%
hypot-1-def49.4%
+-commutative49.4%
Applied egg-rr50.0%
associate-/l/49.9%
associate-*r/49.9%
*-rgt-identity49.9%
*-commutative49.9%
associate-/r*49.9%
*-commutative49.9%
Simplified49.9%
Applied egg-rr28.8%
div-inv28.7%
unpow-prod-down27.8%
pow227.8%
pow-prod-up52.2%
metadata-eval52.2%
inv-pow52.2%
associate-/r*52.2%
metadata-eval52.2%
hypot-undefine52.2%
metadata-eval52.2%
pow252.2%
+-commutative52.2%
pow252.2%
fma-undefine52.2%
/-rgt-identity52.2%
sqrt-div52.2%
clear-num52.2%
sqrt-div53.0%
pow253.0%
add-sqr-sqrt95.7%
Applied egg-rr95.3%
if 1e222 < (*.f64 z z) Initial program 70.8%
remove-double-neg70.8%
distribute-lft-neg-out70.8%
distribute-rgt-neg-in70.8%
associate-/r*70.5%
associate-/l/70.5%
associate-/l/70.5%
distribute-lft-neg-out70.5%
distribute-rgt-neg-in70.5%
distribute-lft-neg-in70.5%
remove-double-neg70.5%
sqr-neg70.5%
+-commutative70.5%
sqr-neg70.5%
fma-define70.5%
*-commutative70.5%
Simplified70.5%
Taylor expanded in z around inf 70.5%
/-rgt-identity70.5%
clear-num70.5%
associate-/r*70.5%
pow-flip73.4%
metadata-eval73.4%
Applied egg-rr73.4%
associate-/r/70.5%
associate-*l/73.4%
*-lft-identity73.4%
Simplified73.4%
clear-num73.4%
sqr-pow73.4%
*-commutative73.4%
times-frac99.5%
metadata-eval99.5%
unpow-199.5%
metadata-eval99.5%
unpow-199.5%
Applied egg-rr99.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
(/
(/ (/ 1.0 (sqrt y_m)) (hypot 1.0 z))
(* x_m (* (sqrt y_m) (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) {
return y_s * (x_s * (((1.0 / sqrt(y_m)) / hypot(1.0, z)) / (x_m * (sqrt(y_m) * hypot(1.0, z)))));
}
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.sqrt(y_m)) / Math.hypot(1.0, z)) / (x_m * (Math.sqrt(y_m) * Math.hypot(1.0, z)))));
}
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.sqrt(y_m)) / math.hypot(1.0, z)) / (x_m * (math.sqrt(y_m) * math.hypot(1.0, z)))))
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 / sqrt(y_m)) / hypot(1.0, z)) / Float64(x_m * Float64(sqrt(y_m) * hypot(1.0, z)))))) 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 / sqrt(y_m)) / hypot(1.0, z)) / (x_m * (sqrt(y_m) * hypot(1.0, z)))));
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[y$95$m], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[(x$95$m * N[(N[Sqrt[y$95$m], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + z ^ 2], $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 \frac{\frac{\frac{1}{\sqrt{y\_m}}}{\mathsf{hypot}\left(1, z\right)}}{x\_m \cdot \left(\sqrt{y\_m} \cdot \mathsf{hypot}\left(1, z\right)\right)}\right)
\end{array}
Initial program 89.4%
associate-/l/89.2%
remove-double-neg89.2%
distribute-rgt-neg-out89.2%
distribute-rgt-neg-out89.2%
remove-double-neg89.2%
associate-*l*86.7%
*-commutative86.7%
sqr-neg86.7%
+-commutative86.7%
sqr-neg86.7%
fma-define86.7%
Simplified86.7%
associate-*r*89.2%
*-commutative89.2%
associate-/r*88.8%
*-commutative88.8%
associate-/l/89.0%
fma-undefine89.0%
+-commutative89.0%
associate-/r*89.4%
*-un-lft-identity89.4%
add-sqr-sqrt44.2%
times-frac44.2%
+-commutative44.2%
fma-undefine44.2%
*-commutative44.2%
sqrt-prod44.2%
fma-undefine44.2%
+-commutative44.2%
hypot-1-def44.2%
+-commutative44.2%
Applied egg-rr49.3%
associate-/l/49.2%
associate-*r/49.3%
*-rgt-identity49.3%
*-commutative49.3%
associate-/r*49.3%
*-commutative49.3%
Simplified49.3%
Final simplification49.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 (pow (/ (pow y_m -0.5) (* (hypot 1.0 z) (sqrt x_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(y_m, -0.5) / (hypot(1.0, z) * sqrt(x_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(y_m, -0.5) / (Math.hypot(1.0, z) * Math.sqrt(x_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(y_m, -0.5) / (math.hypot(1.0, z) * math.sqrt(x_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((y_m ^ -0.5) / Float64(hypot(1.0, z) * sqrt(x_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 * (((y_m ^ -0.5) / (hypot(1.0, z) * sqrt(x_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[y$95$m, -0.5], $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[x$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{{y\_m}^{-0.5}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x\_m}}\right)}^{2}\right)
\end{array}
Initial program 89.4%
associate-/l/89.2%
remove-double-neg89.2%
distribute-rgt-neg-out89.2%
distribute-rgt-neg-out89.2%
remove-double-neg89.2%
associate-*l*86.7%
*-commutative86.7%
sqr-neg86.7%
+-commutative86.7%
sqr-neg86.7%
fma-define86.7%
Simplified86.7%
associate-*r*89.2%
*-commutative89.2%
associate-/r*88.8%
*-commutative88.8%
associate-/l/89.0%
fma-undefine89.0%
+-commutative89.0%
associate-/r*89.4%
*-un-lft-identity89.4%
add-sqr-sqrt44.2%
times-frac44.2%
+-commutative44.2%
fma-undefine44.2%
*-commutative44.2%
sqrt-prod44.2%
fma-undefine44.2%
+-commutative44.2%
hypot-1-def44.2%
+-commutative44.2%
Applied egg-rr49.3%
associate-/l/49.2%
associate-*r/49.3%
*-rgt-identity49.3%
*-commutative49.3%
associate-/r*49.3%
*-commutative49.3%
Simplified49.3%
Applied egg-rr27.1%
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 (* (hypot 1.0 z) (sqrt x_m)) -2.0) 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 * (pow((hypot(1.0, z) * sqrt(x_m)), -2.0) / 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 * (Math.pow((Math.hypot(1.0, z) * Math.sqrt(x_m)), -2.0) / 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 * (math.pow((math.hypot(1.0, z) * math.sqrt(x_m)), -2.0) / 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(hypot(1.0, z) * sqrt(x_m)) ^ -2.0) / 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 * (((hypot(1.0, z) * sqrt(x_m)) ^ -2.0) / 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[Power[N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[x$95$m], $MachinePrecision]), $MachinePrecision], -2.0], $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{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x\_m}\right)}^{-2}}{y\_m}\right)
\end{array}
Initial program 89.4%
associate-/l/89.2%
remove-double-neg89.2%
distribute-rgt-neg-out89.2%
distribute-rgt-neg-out89.2%
remove-double-neg89.2%
associate-*l*86.7%
*-commutative86.7%
sqr-neg86.7%
+-commutative86.7%
sqr-neg86.7%
fma-define86.7%
Simplified86.7%
associate-*r*89.2%
*-commutative89.2%
associate-/r*88.8%
*-commutative88.8%
associate-/l/89.0%
fma-undefine89.0%
+-commutative89.0%
associate-/r*89.4%
*-un-lft-identity89.4%
add-sqr-sqrt44.2%
times-frac44.2%
+-commutative44.2%
fma-undefine44.2%
*-commutative44.2%
sqrt-prod44.2%
fma-undefine44.2%
+-commutative44.2%
hypot-1-def44.2%
+-commutative44.2%
Applied egg-rr49.3%
associate-/l/49.2%
associate-*r/49.3%
*-rgt-identity49.3%
*-commutative49.3%
associate-/r*49.3%
*-commutative49.3%
Simplified49.3%
Taylor expanded in y around 0 89.2%
Simplified48.7%
Final simplification48.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
(*
y_s
(*
x_s
(if (<= (+ 1.0 (* z z)) 1e+274)
(/ 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 ((1.0 + (z * z)) <= 1e+274) {
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(1.0 + Float64(z * z)) <= 1e+274) 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[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision], 1e+274], 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}\;1 + z \cdot z \leq 10^{+274}:\\
\;\;\;\;\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 #s(literal 1 binary64) (*.f64 z z)) < 9.99999999999999921e273Initial program 98.1%
associate-/l/97.9%
remove-double-neg97.9%
distribute-rgt-neg-out97.9%
distribute-rgt-neg-out97.9%
remove-double-neg97.9%
associate-*l*94.8%
*-commutative94.8%
sqr-neg94.8%
+-commutative94.8%
sqr-neg94.8%
fma-define94.8%
Simplified94.8%
if 9.99999999999999921e273 < (+.f64 #s(literal 1 binary64) (*.f64 z z)) Initial program 67.7%
remove-double-neg67.7%
distribute-lft-neg-out67.7%
distribute-rgt-neg-in67.7%
associate-/r*67.3%
associate-/l/67.3%
associate-/l/67.3%
distribute-lft-neg-out67.3%
distribute-rgt-neg-in67.3%
distribute-lft-neg-in67.3%
remove-double-neg67.3%
sqr-neg67.3%
+-commutative67.3%
sqr-neg67.3%
fma-define67.3%
*-commutative67.3%
Simplified67.3%
Taylor expanded in z around inf 67.3%
/-rgt-identity67.3%
clear-num67.3%
associate-/r*67.2%
pow-flip70.5%
metadata-eval70.5%
Applied egg-rr70.5%
associate-/r/67.2%
associate-*l/70.5%
*-lft-identity70.5%
Simplified70.5%
clear-num70.5%
sqr-pow70.6%
*-commutative70.6%
times-frac99.5%
metadata-eval99.5%
unpow-199.5%
metadata-eval99.5%
unpow-199.5%
Applied egg-rr99.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 z) 5e-15)
(/ (/ 1.0 y_m) x_m)
(if (<= (* z z) 1e+283)
(/ 1.0 (* (* z z) (* y_m x_m)))
(/ (/ 1.0 z) (* x_m (* 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-15) {
tmp = (1.0 / y_m) / x_m;
} else if ((z * z) <= 1e+283) {
tmp = 1.0 / ((z * z) * (y_m * x_m));
} else {
tmp = (1.0 / z) / (x_m * (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-15) then
tmp = (1.0d0 / y_m) / x_m
else if ((z * z) <= 1d+283) then
tmp = 1.0d0 / ((z * z) * (y_m * x_m))
else
tmp = (1.0d0 / z) / (x_m * (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-15) {
tmp = (1.0 / y_m) / x_m;
} else if ((z * z) <= 1e+283) {
tmp = 1.0 / ((z * z) * (y_m * x_m));
} else {
tmp = (1.0 / z) / (x_m * (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-15: tmp = (1.0 / y_m) / x_m elif (z * z) <= 1e+283: tmp = 1.0 / ((z * z) * (y_m * x_m)) else: tmp = (1.0 / z) / (x_m * (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-15) tmp = Float64(Float64(1.0 / y_m) / x_m); elseif (Float64(z * z) <= 1e+283) tmp = Float64(1.0 / Float64(Float64(z * z) * Float64(y_m * x_m))); else tmp = Float64(Float64(1.0 / z) / Float64(x_m * Float64(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-15)
tmp = (1.0 / y_m) / x_m;
elseif ((z * z) <= 1e+283)
tmp = 1.0 / ((z * z) * (y_m * x_m));
else
tmp = (1.0 / z) / (x_m * (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-15], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+283], N[(1.0 / N[(N[(z * z), $MachinePrecision] * N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] / N[(x$95$m * N[(y$95$m * z), $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^{-15}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{elif}\;z \cdot z \leq 10^{+283}:\\
\;\;\;\;\frac{1}{\left(z \cdot z\right) \cdot \left(y\_m \cdot x\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{x\_m \cdot \left(y\_m \cdot z\right)}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 4.99999999999999999e-15Initial 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%
associate-/r*99.6%
div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 99.5%
un-div-inv99.6%
Applied egg-rr99.6%
if 4.99999999999999999e-15 < (*.f64 z z) < 9.99999999999999955e282Initial program 94.5%
remove-double-neg94.5%
distribute-lft-neg-out94.5%
distribute-rgt-neg-in94.5%
associate-/r*93.1%
associate-/l/93.2%
associate-/l/94.8%
distribute-lft-neg-out94.8%
distribute-rgt-neg-in94.8%
distribute-lft-neg-in94.8%
remove-double-neg94.8%
sqr-neg94.8%
+-commutative94.8%
sqr-neg94.8%
fma-define94.8%
*-commutative94.8%
Simplified94.8%
Taylor expanded in z around inf 93.2%
unpow293.2%
Applied egg-rr93.2%
if 9.99999999999999955e282 < (*.f64 z z) Initial program 65.8%
remove-double-neg65.8%
distribute-lft-neg-out65.8%
distribute-rgt-neg-in65.8%
associate-/r*65.4%
associate-/l/65.4%
associate-/l/65.4%
distribute-lft-neg-out65.4%
distribute-rgt-neg-in65.4%
distribute-lft-neg-in65.4%
remove-double-neg65.4%
sqr-neg65.4%
+-commutative65.4%
sqr-neg65.4%
fma-define65.4%
*-commutative65.4%
Simplified65.4%
Taylor expanded in z around inf 65.4%
/-rgt-identity65.4%
clear-num65.4%
associate-/r*65.4%
pow-flip68.9%
metadata-eval68.9%
Applied egg-rr68.9%
associate-/r/65.4%
associate-*l/68.9%
*-lft-identity68.9%
Simplified68.9%
associate-/r/68.9%
associate-/r*68.9%
sqr-pow68.9%
associate-*r*88.6%
associate-/l/88.5%
metadata-eval88.5%
unpow-188.5%
metadata-eval88.5%
unpow-188.5%
Applied egg-rr88.5%
frac-times88.6%
metadata-eval88.6%
associate-*l/88.7%
*-un-lft-identity88.7%
*-commutative88.7%
associate-*l*98.4%
Applied egg-rr98.4%
Final simplification97.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-15)
(/ (/ 1.0 y_m) x_m)
(if (<= (* z z) 1e+283)
(/ 1.0 (* (* z z) (* y_m x_m)))
(/ 1.0 (* z (* x_m (* 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-15) {
tmp = (1.0 / y_m) / x_m;
} else if ((z * z) <= 1e+283) {
tmp = 1.0 / ((z * z) * (y_m * x_m));
} else {
tmp = 1.0 / (z * (x_m * (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-15) then
tmp = (1.0d0 / y_m) / x_m
else if ((z * z) <= 1d+283) then
tmp = 1.0d0 / ((z * z) * (y_m * x_m))
else
tmp = 1.0d0 / (z * (x_m * (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-15) {
tmp = (1.0 / y_m) / x_m;
} else if ((z * z) <= 1e+283) {
tmp = 1.0 / ((z * z) * (y_m * x_m));
} else {
tmp = 1.0 / (z * (x_m * (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-15: tmp = (1.0 / y_m) / x_m elif (z * z) <= 1e+283: tmp = 1.0 / ((z * z) * (y_m * x_m)) else: tmp = 1.0 / (z * (x_m * (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-15) tmp = Float64(Float64(1.0 / y_m) / x_m); elseif (Float64(z * z) <= 1e+283) tmp = Float64(1.0 / Float64(Float64(z * z) * Float64(y_m * x_m))); else tmp = Float64(1.0 / Float64(z * Float64(x_m * Float64(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-15)
tmp = (1.0 / y_m) / x_m;
elseif ((z * z) <= 1e+283)
tmp = 1.0 / ((z * z) * (y_m * x_m));
else
tmp = 1.0 / (z * (x_m * (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-15], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+283], N[(1.0 / N[(N[(z * z), $MachinePrecision] * N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(z * N[(x$95$m * N[(y$95$m * z), $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 \cdot z \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{elif}\;z \cdot z \leq 10^{+283}:\\
\;\;\;\;\frac{1}{\left(z \cdot z\right) \cdot \left(y\_m \cdot x\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z \cdot \left(x\_m \cdot \left(y\_m \cdot z\right)\right)}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 4.99999999999999999e-15Initial 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%
associate-/r*99.6%
div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 99.5%
un-div-inv99.6%
Applied egg-rr99.6%
if 4.99999999999999999e-15 < (*.f64 z z) < 9.99999999999999955e282Initial program 94.5%
remove-double-neg94.5%
distribute-lft-neg-out94.5%
distribute-rgt-neg-in94.5%
associate-/r*93.1%
associate-/l/93.2%
associate-/l/94.8%
distribute-lft-neg-out94.8%
distribute-rgt-neg-in94.8%
distribute-lft-neg-in94.8%
remove-double-neg94.8%
sqr-neg94.8%
+-commutative94.8%
sqr-neg94.8%
fma-define94.8%
*-commutative94.8%
Simplified94.8%
Taylor expanded in z around inf 93.2%
unpow293.2%
Applied egg-rr93.2%
if 9.99999999999999955e282 < (*.f64 z z) Initial program 65.8%
remove-double-neg65.8%
distribute-lft-neg-out65.8%
distribute-rgt-neg-in65.8%
associate-/r*65.4%
associate-/l/65.4%
associate-/l/65.4%
distribute-lft-neg-out65.4%
distribute-rgt-neg-in65.4%
distribute-lft-neg-in65.4%
remove-double-neg65.4%
sqr-neg65.4%
+-commutative65.4%
sqr-neg65.4%
fma-define65.4%
*-commutative65.4%
Simplified65.4%
Taylor expanded in z around inf 65.4%
/-rgt-identity65.4%
clear-num65.4%
associate-/r*65.4%
pow-flip68.9%
metadata-eval68.9%
Applied egg-rr68.9%
associate-/r/65.4%
associate-*l/68.9%
*-lft-identity68.9%
Simplified68.9%
associate-/r/68.9%
associate-/r*68.9%
sqr-pow68.9%
associate-*r*88.6%
associate-/l/88.5%
metadata-eval88.5%
unpow-188.5%
metadata-eval88.5%
unpow-188.5%
Applied egg-rr88.5%
frac-times88.6%
metadata-eval88.6%
frac-times87.1%
metadata-eval87.1%
*-commutative87.1%
associate-*l*96.9%
Applied egg-rr96.9%
Final simplification97.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
(let* ((t_0 (* y_m (+ 1.0 (* z z)))))
(*
y_s
(*
x_s
(if (<= t_0 1e+306)
(/ (/ 1.0 x_m) t_0)
(* (/ 1.0 z) (/ (/ 1.0 y_m) (* 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 t_0 = y_m * (1.0 + (z * z));
double tmp;
if (t_0 <= 1e+306) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = (1.0 / z) * ((1.0 / y_m) / (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) :: t_0
real(8) :: tmp
t_0 = y_m * (1.0d0 + (z * z))
if (t_0 <= 1d+306) then
tmp = (1.0d0 / x_m) / t_0
else
tmp = (1.0d0 / z) * ((1.0d0 / y_m) / (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 t_0 = y_m * (1.0 + (z * z));
double tmp;
if (t_0 <= 1e+306) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = (1.0 / z) * ((1.0 / y_m) / (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): t_0 = y_m * (1.0 + (z * z)) tmp = 0 if t_0 <= 1e+306: tmp = (1.0 / x_m) / t_0 else: tmp = (1.0 / z) * ((1.0 / y_m) / (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) t_0 = Float64(y_m * Float64(1.0 + Float64(z * z))) tmp = 0.0 if (t_0 <= 1e+306) tmp = Float64(Float64(1.0 / x_m) / t_0); else tmp = Float64(Float64(1.0 / z) * Float64(Float64(1.0 / y_m) / Float64(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)
t_0 = y_m * (1.0 + (z * z));
tmp = 0.0;
if (t_0 <= 1e+306)
tmp = (1.0 / x_m) / t_0;
else
tmp = (1.0 / z) * ((1.0 / y_m) / (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_] := Block[{t$95$0 = N[(y$95$m * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[t$95$0, 1e+306], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / y$95$m), $MachinePrecision] / N[(z * x$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])\\
\\
\begin{array}{l}
t_0 := y\_m \cdot \left(1 + z \cdot z\right)\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 10^{+306}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{\frac{1}{y\_m}}{z \cdot x\_m}\\
\end{array}\right)
\end{array}
\end{array}
if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 1.00000000000000002e306Initial program 93.7%
if 1.00000000000000002e306 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) Initial program 63.2%
remove-double-neg63.2%
distribute-lft-neg-out63.2%
distribute-rgt-neg-in63.2%
associate-/r*67.9%
associate-/l/67.9%
associate-/l/67.9%
distribute-lft-neg-out67.9%
distribute-rgt-neg-in67.9%
distribute-lft-neg-in67.9%
remove-double-neg67.9%
sqr-neg67.9%
+-commutative67.9%
sqr-neg67.9%
fma-define67.9%
*-commutative67.9%
Simplified67.9%
Taylor expanded in z around inf 67.9%
/-rgt-identity67.9%
clear-num67.9%
associate-/r*67.8%
pow-flip71.2%
metadata-eval71.2%
Applied egg-rr71.2%
associate-/r/67.9%
associate-*l/71.3%
*-lft-identity71.3%
Simplified71.3%
associate-/r/71.3%
associate-/r*71.3%
sqr-pow71.3%
associate-*r*89.1%
associate-/l/89.0%
metadata-eval89.0%
unpow-189.0%
metadata-eval89.0%
unpow-189.0%
Applied egg-rr89.0%
un-div-inv89.0%
associate-/r*89.1%
associate-/l/96.8%
Applied egg-rr96.8%
Final simplification94.1%
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-15)
(/ (/ 1.0 y_m) x_m)
(* (/ 1.0 z) (/ (/ 1.0 y_m) (* 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-15) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / z) * ((1.0 / y_m) / (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-15) then
tmp = (1.0d0 / y_m) / x_m
else
tmp = (1.0d0 / z) * ((1.0d0 / y_m) / (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-15) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / z) * ((1.0 / y_m) / (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-15: tmp = (1.0 / y_m) / x_m else: tmp = (1.0 / z) * ((1.0 / y_m) / (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-15) tmp = Float64(Float64(1.0 / y_m) / x_m); else tmp = Float64(Float64(1.0 / z) * Float64(Float64(1.0 / y_m) / Float64(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-15)
tmp = (1.0 / y_m) / x_m;
else
tmp = (1.0 / z) * ((1.0 / y_m) / (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-15], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / y$95$m), $MachinePrecision] / N[(z * x$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^{-15}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{\frac{1}{y\_m}}{z \cdot x\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 4.99999999999999999e-15Initial 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%
associate-/r*99.6%
div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 99.5%
un-div-inv99.6%
Applied egg-rr99.6%
if 4.99999999999999999e-15 < (*.f64 z z) Initial program 78.7%
remove-double-neg78.7%
distribute-lft-neg-out78.7%
distribute-rgt-neg-in78.7%
associate-/r*77.8%
associate-/l/77.9%
associate-/l/78.6%
distribute-lft-neg-out78.6%
distribute-rgt-neg-in78.6%
distribute-lft-neg-in78.6%
remove-double-neg78.6%
sqr-neg78.6%
+-commutative78.6%
sqr-neg78.6%
fma-define78.6%
*-commutative78.6%
Simplified78.6%
Taylor expanded in z around inf 77.8%
/-rgt-identity77.8%
clear-num77.8%
associate-/r*77.8%
pow-flip79.7%
metadata-eval79.7%
Applied egg-rr79.7%
associate-/r/77.8%
associate-*l/79.7%
*-lft-identity79.7%
Simplified79.7%
associate-/r/79.0%
associate-/r*78.9%
sqr-pow78.8%
associate-*r*89.8%
associate-/l/89.7%
metadata-eval89.7%
unpow-189.7%
metadata-eval89.7%
unpow-189.7%
Applied egg-rr89.7%
un-div-inv89.8%
associate-/r*89.9%
associate-/l/91.6%
Applied egg-rr91.6%
Final simplification95.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 (* y_s (* x_s (if (<= z 1.0) (/ (/ 1.0 y_m) x_m) (/ 1.0 (* z (* x_m (* 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 <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = 1.0 / (z * (x_m * (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 <= 1.0d0) then
tmp = (1.0d0 / y_m) / x_m
else
tmp = 1.0d0 / (z * (x_m * (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 <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = 1.0 / (z * (x_m * (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 <= 1.0: tmp = (1.0 / y_m) / x_m else: tmp = 1.0 / (z * (x_m * (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 (z <= 1.0) tmp = Float64(Float64(1.0 / y_m) / x_m); else tmp = Float64(1.0 / Float64(z * Float64(x_m * Float64(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 <= 1.0)
tmp = (1.0 / y_m) / x_m;
else
tmp = 1.0 / (z * (x_m * (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[z, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(1.0 / N[(z * N[(x$95$m * N[(y$95$m * z), $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 \left(x\_m \cdot \left(y\_m \cdot z\right)\right)}\\
\end{array}\right)
\end{array}
if z < 1Initial program 91.7%
associate-/l/91.5%
remove-double-neg91.5%
distribute-rgt-neg-out91.5%
distribute-rgt-neg-out91.5%
remove-double-neg91.5%
associate-*l*88.2%
*-commutative88.2%
sqr-neg88.2%
+-commutative88.2%
sqr-neg88.2%
fma-define88.2%
Simplified88.2%
associate-/r*88.4%
div-inv88.4%
Applied egg-rr88.4%
Taylor expanded in z around 0 72.3%
un-div-inv72.4%
Applied egg-rr72.4%
if 1 < z Initial program 81.2%
remove-double-neg81.2%
distribute-lft-neg-out81.2%
distribute-rgt-neg-in81.2%
associate-/r*76.1%
associate-/l/76.1%
associate-/l/77.7%
distribute-lft-neg-out77.7%
distribute-rgt-neg-in77.7%
distribute-lft-neg-in77.7%
remove-double-neg77.7%
sqr-neg77.7%
+-commutative77.7%
sqr-neg77.7%
fma-define77.7%
*-commutative77.7%
Simplified77.7%
Taylor expanded in z around inf 77.2%
/-rgt-identity77.2%
clear-num77.2%
associate-/r*77.1%
pow-flip79.7%
metadata-eval79.7%
Applied egg-rr79.7%
associate-/r/77.1%
associate-*l/79.8%
*-lft-identity79.8%
Simplified79.8%
associate-/r/78.1%
associate-/r*78.0%
sqr-pow77.9%
associate-*r*89.0%
associate-/l/89.0%
metadata-eval89.0%
unpow-189.0%
metadata-eval89.0%
unpow-189.0%
Applied egg-rr89.0%
frac-times90.8%
metadata-eval90.8%
frac-times90.4%
metadata-eval90.4%
*-commutative90.4%
associate-*l*95.6%
Applied egg-rr95.6%
Final simplification77.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 (/ 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 89.4%
associate-/l/89.2%
remove-double-neg89.2%
distribute-rgt-neg-out89.2%
distribute-rgt-neg-out89.2%
remove-double-neg89.2%
associate-*l*86.7%
*-commutative86.7%
sqr-neg86.7%
+-commutative86.7%
sqr-neg86.7%
fma-define86.7%
Simplified86.7%
Taylor expanded in z around 0 59.8%
(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 2024132
(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)))))