
(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 14 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 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 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) 2e+272)
(/ (/ 1.0 y_m) (* x_m (fma z z 1.0)))
(/ (/ 1.0 (* z 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) <= 2e+272) {
tmp = (1.0 / y_m) / (x_m * fma(z, z, 1.0));
} else {
tmp = (1.0 / (z * 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) <= 2e+272) tmp = Float64(Float64(1.0 / y_m) / Float64(x_m * fma(z, z, 1.0))); else tmp = Float64(Float64(1.0 / Float64(z * y_m)) / Float64(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], 2e+272], N[(N[(1.0 / y$95$m), $MachinePrecision] / N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(z * y$95$m), $MachinePrecision]), $MachinePrecision] / N[(z * 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 2 \cdot 10^{+272}:\\
\;\;\;\;\frac{\frac{1}{y_m}}{x_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z \cdot y_m}}{z \cdot x_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 2.0000000000000001e272Initial program 94.6%
associate-/l/93.7%
metadata-eval93.7%
associate-*r/93.7%
associate-/l/94.6%
associate-*r/94.6%
associate-/l*93.6%
associate-/r/93.7%
/-rgt-identity93.7%
associate-*l*95.2%
*-commutative95.2%
sqr-neg95.2%
+-commutative95.2%
sqr-neg95.2%
fma-def95.2%
Simplified95.2%
fma-udef95.2%
+-commutative95.2%
*-commutative95.2%
associate-*l*93.7%
associate-/l/94.6%
add-sqr-sqrt42.8%
*-un-lft-identity42.8%
times-frac42.8%
*-commutative42.8%
sqrt-prod42.8%
hypot-1-def42.8%
*-commutative42.8%
sqrt-prod46.8%
hypot-1-def46.8%
Applied egg-rr46.8%
*-commutative46.8%
frac-times42.8%
swap-sqr42.8%
hypot-udef42.8%
hypot-udef42.8%
rem-square-sqrt42.8%
metadata-eval42.8%
unpow242.8%
+-commutative42.8%
unpow242.8%
fma-udef42.8%
add-sqr-sqrt94.6%
frac-times96.4%
associate-/r*95.9%
associate-*l/95.9%
*-un-lft-identity95.9%
Applied egg-rr95.9%
if 2.0000000000000001e272 < (*.f64 z z) Initial program 86.0%
associate-/l/86.0%
metadata-eval86.0%
associate-*r/86.0%
associate-/l/86.0%
associate-*r/86.0%
associate-/l*86.0%
associate-/r/86.0%
/-rgt-identity86.0%
associate-*l*86.0%
*-commutative86.0%
sqr-neg86.0%
+-commutative86.0%
sqr-neg86.0%
fma-def86.0%
Simplified86.0%
Taylor expanded in z around inf 86.0%
associate-*r*84.5%
*-commutative84.5%
Simplified84.5%
add-sqr-sqrt51.9%
pow251.9%
sqrt-prod51.9%
unpow251.9%
sqrt-prod23.0%
add-sqr-sqrt59.0%
Applied egg-rr59.0%
inv-pow59.0%
unpow259.0%
swap-sqr51.9%
add-sqr-sqrt84.5%
unpow-prod-down84.4%
pow-prod-down85.3%
pow-prod-up85.3%
metadata-eval85.3%
inv-pow85.3%
un-div-inv85.3%
add-sqr-sqrt85.3%
*-commutative85.3%
times-frac86.8%
sqrt-pow184.6%
metadata-eval84.6%
unpow-184.6%
sqrt-pow199.9%
metadata-eval99.9%
unpow-199.9%
Applied egg-rr99.9%
associate-/l/99.9%
un-div-inv99.9%
associate-/l/99.9%
*-commutative99.9%
Applied egg-rr99.9%
Final simplification97.0%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 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 92.1%
associate-/l/91.5%
metadata-eval91.5%
associate-*r/91.5%
associate-/l/92.1%
associate-*r/92.1%
associate-/l*91.4%
associate-/r/91.5%
/-rgt-identity91.5%
associate-*l*92.6%
*-commutative92.6%
sqr-neg92.6%
+-commutative92.6%
sqr-neg92.6%
fma-def92.6%
Simplified92.6%
fma-udef92.6%
+-commutative92.6%
*-commutative92.6%
associate-*l*91.5%
associate-/l/92.1%
add-sqr-sqrt41.9%
*-un-lft-identity41.9%
times-frac41.9%
*-commutative41.9%
sqrt-prod41.9%
hypot-1-def41.9%
*-commutative41.9%
sqrt-prod44.8%
hypot-1-def47.3%
Applied egg-rr47.3%
Final simplification47.3%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 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 92.1%
associate-/l/91.5%
metadata-eval91.5%
associate-*r/91.5%
associate-/l/92.1%
associate-*r/92.1%
associate-/l*91.4%
associate-/r/91.5%
/-rgt-identity91.5%
associate-*l*92.6%
*-commutative92.6%
sqr-neg92.6%
+-commutative92.6%
sqr-neg92.6%
fma-def92.6%
Simplified92.6%
fma-udef92.6%
+-commutative92.6%
*-commutative92.6%
associate-*l*91.5%
associate-/l/92.1%
add-sqr-sqrt62.8%
sqrt-div22.4%
inv-pow22.4%
sqrt-pow122.4%
metadata-eval22.4%
*-commutative22.4%
sqrt-prod22.4%
hypot-1-def22.4%
sqrt-div22.4%
inv-pow22.4%
sqrt-pow122.4%
metadata-eval22.4%
*-commutative22.4%
Applied egg-rr25.6%
unpow225.6%
Simplified25.6%
Final simplification25.6%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 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) (/ (/ (/ 1.0 x_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) {
return y_s * (x_s * ((1.0 / y_m) * (((1.0 / x_m) / hypot(1.0, z)) / 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 / y_m) * (((1.0 / x_m) / Math.hypot(1.0, z)) / 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 / y_m) * (((1.0 / x_m) / math.hypot(1.0, z)) / 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(1.0 / y_m) * Float64(Float64(Float64(1.0 / x_m) / hypot(1.0, z)) / 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 / y_m) * (((1.0 / x_m) / hypot(1.0, z)) / 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[(1.0 / y$95$m), $MachinePrecision] * N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $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 \left(\frac{1}{y_m} \cdot \frac{\frac{\frac{1}{x_m}}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right)}\right)\right)
\end{array}
Initial program 92.1%
associate-/l/91.5%
metadata-eval91.5%
associate-*r/91.5%
associate-/l/92.1%
associate-*r/92.1%
associate-/l*91.4%
associate-/r/91.5%
/-rgt-identity91.5%
associate-*l*92.6%
*-commutative92.6%
sqr-neg92.6%
+-commutative92.6%
sqr-neg92.6%
fma-def92.6%
Simplified92.6%
associate-/r*93.0%
div-inv93.0%
Applied egg-rr93.0%
associate-/r*93.4%
*-un-lft-identity93.4%
add-sqr-sqrt93.4%
times-frac93.4%
fma-udef93.4%
unpow293.4%
+-commutative93.4%
metadata-eval93.4%
unpow293.4%
hypot-udef93.4%
fma-udef93.4%
unpow293.4%
+-commutative93.4%
metadata-eval93.4%
unpow293.4%
hypot-udef96.0%
Applied egg-rr96.0%
*-commutative96.0%
associate-*r/96.0%
*-rgt-identity96.0%
Simplified96.0%
Final simplification96.0%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 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) (hypot 1.0 z)) (/ 1.0 (hypot 1.0 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) {
return y_s * (x_s * ((((1.0 / x_m) / hypot(1.0, z)) * (1.0 / hypot(1.0, z))) / 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 / x_m) / Math.hypot(1.0, z)) * (1.0 / Math.hypot(1.0, z))) / 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) / math.hypot(1.0, z)) * (1.0 / math.hypot(1.0, z))) / 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(Float64(1.0 / x_m) / hypot(1.0, z)) * Float64(1.0 / hypot(1.0, z))) / 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) / hypot(1.0, z)) * (1.0 / hypot(1.0, z))) / 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[(N[(1.0 / x$95$m), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $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{\frac{1}{x_m}}{\mathsf{hypot}\left(1, z\right)} \cdot \frac{1}{\mathsf{hypot}\left(1, z\right)}}{y_m}\right)
\end{array}
Initial program 92.1%
associate-/l/91.5%
metadata-eval91.5%
associate-*r/91.5%
associate-/l/92.1%
associate-*r/92.1%
associate-/l*91.4%
associate-/r/91.5%
/-rgt-identity91.5%
associate-*l*92.6%
*-commutative92.6%
sqr-neg92.6%
+-commutative92.6%
sqr-neg92.6%
fma-def92.6%
Simplified92.6%
fma-udef92.6%
+-commutative92.6%
*-commutative92.6%
associate-*l*91.5%
associate-/l/92.1%
add-sqr-sqrt41.9%
*-un-lft-identity41.9%
times-frac41.9%
*-commutative41.9%
sqrt-prod41.9%
hypot-1-def41.9%
*-commutative41.9%
sqrt-prod44.8%
hypot-1-def47.3%
Applied egg-rr47.3%
*-commutative47.3%
associate-/r*47.3%
associate-/r*47.4%
frac-times45.9%
add-sqr-sqrt96.0%
Applied egg-rr96.0%
Final simplification96.0%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 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.0 (* z z))) 5e+303)
(/ (/ 1.0 x_m) (fma (* z y_m) z y_m))
(/ (/ 1.0 z) (* 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 ((y_m * (1.0 + (z * z))) <= 5e+303) {
tmp = (1.0 / x_m) / fma((z * y_m), z, y_m);
} else {
tmp = (1.0 / z) / (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(y_m * Float64(1.0 + Float64(z * z))) <= 5e+303) tmp = Float64(Float64(1.0 / x_m) / fma(Float64(z * y_m), z, y_m)); else tmp = Float64(Float64(1.0 / z) / Float64(y_m * Float64(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[(y$95$m * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+303], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(N[(z * y$95$m), $MachinePrecision] * z + y$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] / N[(y$95$m * 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}\;y_m \cdot \left(1 + z \cdot z\right) \leq 5 \cdot 10^{+303}:\\
\;\;\;\;\frac{\frac{1}{x_m}}{\mathsf{fma}\left(z \cdot y_m, z, y_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y_m \cdot \left(z \cdot x_m\right)}\\
\end{array}\right)
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 4.9999999999999997e303Initial program 97.1%
+-commutative97.1%
distribute-lft-in97.1%
associate-*r*98.0%
*-rgt-identity98.0%
fma-def98.0%
Applied egg-rr98.0%
if 4.9999999999999997e303 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 68.7%
associate-/l/68.7%
metadata-eval68.7%
associate-*r/68.7%
associate-/l/68.7%
associate-*r/68.7%
associate-/l*68.7%
associate-/r/68.7%
/-rgt-identity68.7%
associate-*l*85.2%
*-commutative85.2%
sqr-neg85.2%
+-commutative85.2%
sqr-neg85.2%
fma-def85.2%
Simplified85.2%
Taylor expanded in z around inf 68.7%
associate-*r*85.0%
*-commutative85.0%
Simplified85.0%
add-sqr-sqrt49.6%
pow249.6%
sqrt-prod49.5%
unpow249.5%
sqrt-prod20.0%
add-sqr-sqrt57.6%
Applied egg-rr57.6%
inv-pow57.6%
unpow257.6%
swap-sqr49.5%
add-sqr-sqrt85.0%
unpow-prod-down85.1%
pow-prod-down86.4%
pow-prod-up86.5%
metadata-eval86.5%
inv-pow86.5%
un-div-inv86.5%
add-sqr-sqrt86.4%
*-commutative86.4%
times-frac82.8%
sqrt-pow172.7%
metadata-eval72.7%
unpow-172.7%
sqrt-pow195.9%
metadata-eval95.9%
unpow-195.9%
Applied egg-rr95.9%
associate-/l/95.9%
frac-times97.7%
*-rgt-identity97.7%
Applied egg-rr97.7%
Final simplification97.9%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 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 5e+303)
(/ 1.0 (* x_m t_0))
(/ (/ 1.0 z) (* 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 <= 5e+303) {
tmp = 1.0 / (x_m * t_0);
} else {
tmp = (1.0 / z) / (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 <= 5d+303) then
tmp = 1.0d0 / (x_m * t_0)
else
tmp = (1.0d0 / z) / (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 <= 5e+303) {
tmp = 1.0 / (x_m * t_0);
} else {
tmp = (1.0 / z) / (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 <= 5e+303: tmp = 1.0 / (x_m * t_0) else: tmp = (1.0 / z) / (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 <= 5e+303) tmp = Float64(1.0 / Float64(x_m * t_0)); else tmp = Float64(Float64(1.0 / z) / Float64(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 <= 5e+303)
tmp = 1.0 / (x_m * t_0);
else
tmp = (1.0 / z) / (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, 5e+303], N[(1.0 / N[(x$95$m * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] / N[(y$95$m * 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 5 \cdot 10^{+303}:\\
\;\;\;\;\frac{1}{x_m \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y_m \cdot \left(z \cdot x_m\right)}\\
\end{array}\right)
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 4.9999999999999997e303Initial program 97.1%
associate-/l/96.4%
Simplified96.4%
if 4.9999999999999997e303 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 68.7%
associate-/l/68.7%
metadata-eval68.7%
associate-*r/68.7%
associate-/l/68.7%
associate-*r/68.7%
associate-/l*68.7%
associate-/r/68.7%
/-rgt-identity68.7%
associate-*l*85.2%
*-commutative85.2%
sqr-neg85.2%
+-commutative85.2%
sqr-neg85.2%
fma-def85.2%
Simplified85.2%
Taylor expanded in z around inf 68.7%
associate-*r*85.0%
*-commutative85.0%
Simplified85.0%
add-sqr-sqrt49.6%
pow249.6%
sqrt-prod49.5%
unpow249.5%
sqrt-prod20.0%
add-sqr-sqrt57.6%
Applied egg-rr57.6%
inv-pow57.6%
unpow257.6%
swap-sqr49.5%
add-sqr-sqrt85.0%
unpow-prod-down85.1%
pow-prod-down86.4%
pow-prod-up86.5%
metadata-eval86.5%
inv-pow86.5%
un-div-inv86.5%
add-sqr-sqrt86.4%
*-commutative86.4%
times-frac82.8%
sqrt-pow172.7%
metadata-eval72.7%
unpow-172.7%
sqrt-pow195.9%
metadata-eval95.9%
unpow-195.9%
Applied egg-rr95.9%
associate-/l/95.9%
frac-times97.7%
*-rgt-identity97.7%
Applied egg-rr97.7%
Final simplification96.6%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 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 5e+303)
(/ (/ 1.0 x_m) t_0)
(/ (/ 1.0 z) (* 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 <= 5e+303) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = (1.0 / z) / (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 <= 5d+303) then
tmp = (1.0d0 / x_m) / t_0
else
tmp = (1.0d0 / z) / (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 <= 5e+303) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = (1.0 / z) / (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 <= 5e+303: tmp = (1.0 / x_m) / t_0 else: tmp = (1.0 / z) / (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 <= 5e+303) tmp = Float64(Float64(1.0 / x_m) / t_0); else tmp = Float64(Float64(1.0 / z) / Float64(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 <= 5e+303)
tmp = (1.0 / x_m) / t_0;
else
tmp = (1.0 / z) / (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, 5e+303], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] / N[(y$95$m * 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 5 \cdot 10^{+303}:\\
\;\;\;\;\frac{\frac{1}{x_m}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y_m \cdot \left(z \cdot x_m\right)}\\
\end{array}\right)
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 4.9999999999999997e303Initial program 97.1%
if 4.9999999999999997e303 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 68.7%
associate-/l/68.7%
metadata-eval68.7%
associate-*r/68.7%
associate-/l/68.7%
associate-*r/68.7%
associate-/l*68.7%
associate-/r/68.7%
/-rgt-identity68.7%
associate-*l*85.2%
*-commutative85.2%
sqr-neg85.2%
+-commutative85.2%
sqr-neg85.2%
fma-def85.2%
Simplified85.2%
Taylor expanded in z around inf 68.7%
associate-*r*85.0%
*-commutative85.0%
Simplified85.0%
add-sqr-sqrt49.6%
pow249.6%
sqrt-prod49.5%
unpow249.5%
sqrt-prod20.0%
add-sqr-sqrt57.6%
Applied egg-rr57.6%
inv-pow57.6%
unpow257.6%
swap-sqr49.5%
add-sqr-sqrt85.0%
unpow-prod-down85.1%
pow-prod-down86.4%
pow-prod-up86.5%
metadata-eval86.5%
inv-pow86.5%
un-div-inv86.5%
add-sqr-sqrt86.4%
*-commutative86.4%
times-frac82.8%
sqrt-pow172.7%
metadata-eval72.7%
unpow-172.7%
sqrt-pow195.9%
metadata-eval95.9%
unpow-195.9%
Applied egg-rr95.9%
associate-/l/95.9%
frac-times97.7%
*-rgt-identity97.7%
Applied egg-rr97.7%
Final simplification97.2%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 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 (* 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 * (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 * (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 * (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 * (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(1.0 / Float64(z * 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 * (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[(1.0 / N[(z * 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 \left(z \cdot \left(y_m \cdot x_m\right)\right)}\\
\end{array}\right)
\end{array}
if z < 1Initial program 94.4%
associate-/l/93.6%
metadata-eval93.6%
associate-*r/93.6%
associate-/l/94.4%
associate-*r/94.4%
associate-/l*93.5%
associate-/r/93.6%
/-rgt-identity93.6%
associate-*l*95.1%
*-commutative95.1%
sqr-neg95.1%
+-commutative95.1%
sqr-neg95.1%
fma-def95.1%
Simplified95.1%
fma-udef95.1%
+-commutative95.1%
*-commutative95.1%
associate-*l*93.6%
associate-/l/94.4%
add-sqr-sqrt42.7%
*-un-lft-identity42.7%
times-frac42.7%
*-commutative42.7%
sqrt-prod42.7%
hypot-1-def42.7%
*-commutative42.7%
sqrt-prod44.6%
hypot-1-def46.1%
Applied egg-rr46.1%
*-commutative46.1%
frac-times43.2%
swap-sqr42.7%
hypot-udef42.7%
hypot-udef42.7%
rem-square-sqrt42.7%
metadata-eval42.7%
unpow242.7%
+-commutative42.7%
unpow242.7%
fma-udef42.7%
add-sqr-sqrt94.4%
frac-times96.2%
associate-/r*95.7%
associate-*l/95.7%
*-un-lft-identity95.7%
Applied egg-rr95.7%
Taylor expanded in z around 0 70.2%
if 1 < z Initial program 84.9%
associate-/l/84.8%
metadata-eval84.8%
associate-*r/84.8%
associate-/l/84.9%
associate-*r/84.9%
associate-/l*84.8%
associate-/r/84.8%
/-rgt-identity84.8%
associate-*l*84.7%
*-commutative84.7%
sqr-neg84.7%
+-commutative84.7%
sqr-neg84.7%
fma-def84.7%
Simplified84.7%
Taylor expanded in z around inf 84.1%
associate-*r*86.7%
*-commutative86.7%
Simplified86.7%
add-sqr-sqrt51.6%
pow251.6%
sqrt-prod51.6%
unpow251.6%
sqrt-prod53.0%
add-sqr-sqrt53.2%
Applied egg-rr53.2%
inv-pow53.2%
unpow253.2%
swap-sqr51.7%
add-sqr-sqrt86.7%
unpow-prod-down85.4%
pow-prod-down85.3%
pow-prod-up85.3%
metadata-eval85.3%
inv-pow85.3%
un-div-inv86.6%
add-sqr-sqrt86.5%
*-commutative86.5%
times-frac85.5%
sqrt-pow185.5%
metadata-eval85.5%
unpow-185.5%
sqrt-pow193.2%
metadata-eval93.2%
unpow-193.2%
Applied egg-rr93.2%
associate-*r/89.1%
*-commutative89.1%
associate-*l/93.2%
div-inv93.1%
associate-*l*93.2%
times-frac89.6%
*-un-lft-identity89.6%
frac-times89.8%
associate-*l/89.7%
frac-times89.9%
metadata-eval89.9%
Applied egg-rr89.9%
Final simplification75.0%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 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) (* 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 <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / z) / (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 <= 1.0d0) then
tmp = (1.0d0 / y_m) / x_m
else
tmp = (1.0d0 / z) / (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 <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / z) / (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 <= 1.0: tmp = (1.0 / y_m) / x_m else: tmp = (1.0 / z) / (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 (z <= 1.0) tmp = Float64(Float64(1.0 / y_m) / x_m); else tmp = Float64(Float64(1.0 / z) / Float64(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 <= 1.0)
tmp = (1.0 / y_m) / x_m;
else
tmp = (1.0 / z) / (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[z, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] / N[(y$95$m * 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 \leq 1:\\
\;\;\;\;\frac{\frac{1}{y_m}}{x_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y_m \cdot \left(z \cdot x_m\right)}\\
\end{array}\right)
\end{array}
if z < 1Initial program 94.4%
associate-/l/93.6%
metadata-eval93.6%
associate-*r/93.6%
associate-/l/94.4%
associate-*r/94.4%
associate-/l*93.5%
associate-/r/93.6%
/-rgt-identity93.6%
associate-*l*95.1%
*-commutative95.1%
sqr-neg95.1%
+-commutative95.1%
sqr-neg95.1%
fma-def95.1%
Simplified95.1%
fma-udef95.1%
+-commutative95.1%
*-commutative95.1%
associate-*l*93.6%
associate-/l/94.4%
add-sqr-sqrt42.7%
*-un-lft-identity42.7%
times-frac42.7%
*-commutative42.7%
sqrt-prod42.7%
hypot-1-def42.7%
*-commutative42.7%
sqrt-prod44.6%
hypot-1-def46.1%
Applied egg-rr46.1%
*-commutative46.1%
frac-times43.2%
swap-sqr42.7%
hypot-udef42.7%
hypot-udef42.7%
rem-square-sqrt42.7%
metadata-eval42.7%
unpow242.7%
+-commutative42.7%
unpow242.7%
fma-udef42.7%
add-sqr-sqrt94.4%
frac-times96.2%
associate-/r*95.7%
associate-*l/95.7%
*-un-lft-identity95.7%
Applied egg-rr95.7%
Taylor expanded in z around 0 70.2%
if 1 < z Initial program 84.9%
associate-/l/84.8%
metadata-eval84.8%
associate-*r/84.8%
associate-/l/84.9%
associate-*r/84.9%
associate-/l*84.8%
associate-/r/84.8%
/-rgt-identity84.8%
associate-*l*84.7%
*-commutative84.7%
sqr-neg84.7%
+-commutative84.7%
sqr-neg84.7%
fma-def84.7%
Simplified84.7%
Taylor expanded in z around inf 84.1%
associate-*r*86.7%
*-commutative86.7%
Simplified86.7%
add-sqr-sqrt51.6%
pow251.6%
sqrt-prod51.6%
unpow251.6%
sqrt-prod53.0%
add-sqr-sqrt53.2%
Applied egg-rr53.2%
inv-pow53.2%
unpow253.2%
swap-sqr51.7%
add-sqr-sqrt86.7%
unpow-prod-down85.4%
pow-prod-down85.3%
pow-prod-up85.3%
metadata-eval85.3%
inv-pow85.3%
un-div-inv86.6%
add-sqr-sqrt86.5%
*-commutative86.5%
times-frac85.5%
sqrt-pow185.5%
metadata-eval85.5%
unpow-185.5%
sqrt-pow193.2%
metadata-eval93.2%
unpow-193.2%
Applied egg-rr93.2%
associate-/l/93.3%
frac-times93.1%
*-rgt-identity93.1%
Applied egg-rr93.1%
Final simplification75.8%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 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 94.4%
associate-/l/93.6%
metadata-eval93.6%
associate-*r/93.6%
associate-/l/94.4%
associate-*r/94.4%
associate-/l*93.5%
associate-/r/93.6%
/-rgt-identity93.6%
associate-*l*95.1%
*-commutative95.1%
sqr-neg95.1%
+-commutative95.1%
sqr-neg95.1%
fma-def95.1%
Simplified95.1%
fma-udef95.1%
+-commutative95.1%
*-commutative95.1%
associate-*l*93.6%
associate-/l/94.4%
add-sqr-sqrt42.7%
*-un-lft-identity42.7%
times-frac42.7%
*-commutative42.7%
sqrt-prod42.7%
hypot-1-def42.7%
*-commutative42.7%
sqrt-prod44.6%
hypot-1-def46.1%
Applied egg-rr46.1%
*-commutative46.1%
frac-times43.2%
swap-sqr42.7%
hypot-udef42.7%
hypot-udef42.7%
rem-square-sqrt42.7%
metadata-eval42.7%
unpow242.7%
+-commutative42.7%
unpow242.7%
fma-udef42.7%
add-sqr-sqrt94.4%
frac-times96.2%
associate-/r*95.7%
associate-*l/95.7%
*-un-lft-identity95.7%
Applied egg-rr95.7%
Taylor expanded in z around 0 70.2%
if 1 < z Initial program 84.9%
associate-/l/84.8%
metadata-eval84.8%
associate-*r/84.8%
associate-/l/84.9%
associate-*r/84.9%
associate-/l*84.8%
associate-/r/84.8%
/-rgt-identity84.8%
associate-*l*84.7%
*-commutative84.7%
sqr-neg84.7%
+-commutative84.7%
sqr-neg84.7%
fma-def84.7%
Simplified84.7%
fma-udef84.7%
+-commutative84.7%
*-commutative84.7%
associate-*l*84.8%
associate-/l/84.9%
add-sqr-sqrt39.3%
*-un-lft-identity39.3%
times-frac39.3%
*-commutative39.3%
sqrt-prod39.4%
hypot-1-def39.4%
*-commutative39.4%
sqrt-prod45.2%
hypot-1-def51.3%
Applied egg-rr51.3%
*-commutative51.3%
associate-/r*51.3%
associate-/r*51.4%
frac-times46.9%
add-sqr-sqrt87.8%
Applied egg-rr87.8%
Taylor expanded in z around inf 87.1%
Taylor expanded in z around 0 39.7%
Final simplification62.8%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 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 92.1%
associate-/l/91.5%
metadata-eval91.5%
associate-*r/91.5%
associate-/l/92.1%
associate-*r/92.1%
associate-/l*91.4%
associate-/r/91.5%
/-rgt-identity91.5%
associate-*l*92.6%
*-commutative92.6%
sqr-neg92.6%
+-commutative92.6%
sqr-neg92.6%
fma-def92.6%
Simplified92.6%
Taylor expanded in z around 0 56.1%
Final simplification56.1%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 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 92.1%
Taylor expanded in z around 0 56.6%
Final simplification56.6%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 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 92.1%
associate-/l/91.5%
metadata-eval91.5%
associate-*r/91.5%
associate-/l/92.1%
associate-*r/92.1%
associate-/l*91.4%
associate-/r/91.5%
/-rgt-identity91.5%
associate-*l*92.6%
*-commutative92.6%
sqr-neg92.6%
+-commutative92.6%
sqr-neg92.6%
fma-def92.6%
Simplified92.6%
fma-udef92.6%
+-commutative92.6%
*-commutative92.6%
associate-*l*91.5%
associate-/l/92.1%
add-sqr-sqrt41.9%
*-un-lft-identity41.9%
times-frac41.9%
*-commutative41.9%
sqrt-prod41.9%
hypot-1-def41.9%
*-commutative41.9%
sqrt-prod44.8%
hypot-1-def47.3%
Applied egg-rr47.3%
*-commutative47.3%
frac-times43.4%
swap-sqr41.9%
hypot-udef41.9%
hypot-udef41.9%
rem-square-sqrt41.9%
metadata-eval41.9%
unpow241.9%
+-commutative41.9%
unpow241.9%
fma-udef41.9%
add-sqr-sqrt92.1%
frac-times93.4%
associate-/r*93.0%
associate-*l/93.0%
*-un-lft-identity93.0%
Applied egg-rr93.0%
Taylor expanded in z around 0 56.6%
Final simplification56.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 2024017
(FPCore (x y z)
:name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< (* y (+ 1.0 (* z z))) (- INFINITY)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x)) (if (< (* y (+ 1.0 (* z z))) 8.680743250567252e+305) (/ (/ 1.0 x) (* (+ 1.0 (* z z)) y)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x))))
(/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))