
(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 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= y_m 2.3e+204)
(/ (/ (/ 1.0 x_m) (hypot 1.0 z)) (* (hypot 1.0 z) y_m))
(* (/ 1.0 y_m) (/ 1.0 (* x_m (fma z z 1.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 tmp;
if (y_m <= 2.3e+204) {
tmp = ((1.0 / x_m) / hypot(1.0, z)) / (hypot(1.0, z) * y_m);
} else {
tmp = (1.0 / y_m) * (1.0 / (x_m * fma(z, z, 1.0)));
}
return y_s * (x_s * tmp);
}
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (y_m <= 2.3e+204) tmp = Float64(Float64(Float64(1.0 / x_m) / hypot(1.0, z)) / Float64(hypot(1.0, z) * y_m)); else tmp = Float64(Float64(1.0 / y_m) * Float64(1.0 / Float64(x_m * fma(z, z, 1.0)))); 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[y$95$m, 2.3e+204], N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * y$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y$95$m), $MachinePrecision] * N[(1.0 / N[(x$95$m * N[(z * z + 1.0), $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}\;y\_m \leq 2.3 \cdot 10^{+204}:\\
\;\;\;\;\frac{\frac{\frac{1}{x\_m}}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right) \cdot y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y\_m} \cdot \frac{1}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\
\end{array}\right)
\end{array}
if y < 2.2999999999999999e204Initial program 89.2%
associate-/l/89.0%
remove-double-neg89.0%
distribute-rgt-neg-out89.0%
distribute-rgt-neg-out89.0%
remove-double-neg89.0%
associate-*l*85.9%
*-commutative85.9%
sqr-neg85.9%
+-commutative85.9%
sqr-neg85.9%
fma-define85.9%
Simplified85.9%
*-commutative85.9%
associate-*r*89.0%
fma-undefine89.0%
+-commutative89.0%
associate-/l/89.2%
add-sqr-sqrt61.9%
sqrt-div24.8%
inv-pow24.8%
sqrt-pow124.8%
metadata-eval24.8%
+-commutative24.8%
fma-undefine24.8%
*-commutative24.8%
sqrt-prod24.8%
fma-undefine24.8%
+-commutative24.8%
hypot-1-def24.8%
sqrt-div24.8%
Applied egg-rr27.4%
unpow227.4%
Simplified27.4%
Applied egg-rr55.0%
frac-times54.1%
associate-*r/54.1%
pow-prod-up98.3%
metadata-eval98.3%
inv-pow98.3%
Applied egg-rr98.3%
if 2.2999999999999999e204 < y Initial program 93.2%
associate-/l/93.2%
remove-double-neg93.2%
distribute-rgt-neg-out93.2%
distribute-rgt-neg-out93.2%
remove-double-neg93.2%
associate-*l*99.9%
*-commutative99.9%
sqr-neg99.9%
+-commutative99.9%
sqr-neg99.9%
fma-define99.9%
Simplified99.9%
associate-/r*99.4%
div-inv99.7%
Applied egg-rr99.7%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (let* ((t_0 (/ (pow x_m -0.5) (hypot 1.0 z)))) (* y_s (* x_s (* t_0 (/ t_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) {
double t_0 = pow(x_m, -0.5) / hypot(1.0, z);
return y_s * (x_s * (t_0 * (t_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) {
double t_0 = Math.pow(x_m, -0.5) / Math.hypot(1.0, z);
return y_s * (x_s * (t_0 * (t_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): t_0 = math.pow(x_m, -0.5) / math.hypot(1.0, z) return y_s * (x_s * (t_0 * (t_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) t_0 = Float64((x_m ^ -0.5) / hypot(1.0, z)) return Float64(y_s * Float64(x_s * Float64(t_0 * Float64(t_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)
t_0 = (x_m ^ -0.5) / hypot(1.0, z);
tmp = y_s * (x_s * (t_0 * (t_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_] := Block[{t$95$0 = N[(N[Power[x$95$m, -0.5], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * N[(t$95$0 * N[(t$95$0 / y$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])\\
\\
\begin{array}{l}
t_0 := \frac{{x\_m}^{-0.5}}{\mathsf{hypot}\left(1, z\right)}\\
y\_s \cdot \left(x\_s \cdot \left(t\_0 \cdot \frac{t\_0}{y\_m}\right)\right)
\end{array}
\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%
*-commutative86.7%
associate-*r*89.2%
fma-undefine89.2%
+-commutative89.2%
associate-/l/89.4%
add-sqr-sqrt61.6%
sqrt-div24.6%
inv-pow24.6%
sqrt-pow124.6%
metadata-eval24.6%
+-commutative24.6%
fma-undefine24.6%
*-commutative24.6%
sqrt-prod24.6%
fma-undefine24.6%
+-commutative24.6%
hypot-1-def24.6%
sqrt-div24.6%
Applied egg-rr27.1%
unpow227.1%
Simplified27.1%
Applied egg-rr53.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (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 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%
*-commutative86.7%
associate-*r*89.2%
fma-undefine89.2%
+-commutative89.2%
associate-/l/89.4%
add-sqr-sqrt61.6%
sqrt-div24.6%
inv-pow24.6%
sqrt-pow124.6%
metadata-eval24.6%
+-commutative24.6%
fma-undefine24.6%
*-commutative24.6%
sqrt-prod24.6%
fma-undefine24.6%
+-commutative24.6%
hypot-1-def24.6%
sqrt-div24.6%
Applied egg-rr27.1%
unpow227.1%
Simplified27.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 (/ (/ (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(Float64((x_m ^ -0.5) / 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[(N[Power[x$95$m, -0.5], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$95$m], $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{\frac{{x\_m}^{-0.5}}{\mathsf{hypot}\left(1, z\right)}}{\sqrt{y\_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*86.8%
div-inv86.8%
Applied egg-rr86.8%
associate-/r*87.0%
frac-times89.4%
*-un-lft-identity89.4%
inv-pow89.4%
metadata-eval89.4%
pow-prod-up48.7%
add-sqr-sqrt24.6%
fma-undefine24.6%
unpow224.6%
+-commutative24.6%
unpow224.6%
metadata-eval24.6%
rem-square-sqrt24.6%
hypot-undefine24.6%
hypot-undefine24.6%
swap-sqr25.7%
*-commutative25.7%
*-commutative25.7%
frac-times27.1%
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 (* (/ 1.0 y_m) (pow (* (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 * ((1.0 / y_m) * pow((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 * ((1.0 / y_m) * Math.pow((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 * ((1.0 / y_m) * math.pow((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(Float64(1.0 / y_m) * (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 * ((1.0 / y_m) * ((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[(N[(1.0 / y$95$m), $MachinePrecision] * N[Power[N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[x$95$m], $MachinePrecision]), $MachinePrecision], -2.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])\\
\\
y\_s \cdot \left(x\_s \cdot \left(\frac{1}{y\_m} \cdot {\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x\_m}\right)}^{-2}\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*86.8%
div-inv86.8%
Applied egg-rr86.8%
inv-pow86.8%
add-sqr-sqrt46.5%
unpow-prod-down46.4%
*-commutative46.4%
sqrt-prod46.4%
fma-undefine46.4%
unpow246.4%
+-commutative46.4%
metadata-eval46.4%
unpow246.4%
hypot-undefine46.4%
Applied egg-rr48.6%
pow-sqr48.7%
metadata-eval48.7%
Simplified48.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 z) 5e+238)
(* (/ 1.0 y_m) (/ 1.0 (* x_m (fma z z 1.0))))
(/ (/ (/ 1.0 x_m) (hypot 1.0 z)) (* z y_m))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e+238) {
tmp = (1.0 / y_m) * (1.0 / (x_m * fma(z, z, 1.0)));
} else {
tmp = ((1.0 / x_m) / hypot(1.0, z)) / (z * y_m);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e+238) tmp = Float64(Float64(1.0 / y_m) * Float64(1.0 / Float64(x_m * fma(z, z, 1.0)))); else tmp = Float64(Float64(Float64(1.0 / x_m) / hypot(1.0, z)) / Float64(z * y_m)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e+238], N[(N[(1.0 / y$95$m), $MachinePrecision] * N[(1.0 / N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+238}:\\
\;\;\;\;\frac{1}{y\_m} \cdot \frac{1}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{x\_m}}{\mathsf{hypot}\left(1, z\right)}}{z \cdot y\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 4.99999999999999995e238Initial 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*95.4%
div-inv95.3%
Applied egg-rr95.3%
if 4.99999999999999995e238 < (*.f64 z z) Initial program 70.1%
associate-/l/70.1%
remove-double-neg70.1%
distribute-rgt-neg-out70.1%
distribute-rgt-neg-out70.1%
remove-double-neg70.1%
associate-*l*67.7%
*-commutative67.7%
sqr-neg67.7%
+-commutative67.7%
sqr-neg67.7%
fma-define67.7%
Simplified67.7%
*-commutative67.7%
associate-*r*70.1%
fma-undefine70.1%
+-commutative70.1%
associate-/l/70.1%
add-sqr-sqrt65.1%
sqrt-div13.2%
inv-pow13.2%
sqrt-pow113.2%
metadata-eval13.2%
+-commutative13.2%
fma-undefine13.2%
*-commutative13.2%
sqrt-prod13.2%
fma-undefine13.2%
+-commutative13.2%
hypot-1-def13.2%
sqrt-div13.2%
Applied egg-rr21.3%
unpow221.3%
Simplified21.3%
Applied egg-rr49.1%
frac-times49.2%
associate-*r/49.2%
pow-prod-up99.6%
metadata-eval99.6%
inv-pow99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 76.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (+ 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%
*-un-lft-identity67.3%
associate-/r*67.2%
associate-/r*66.3%
pow-flip69.6%
metadata-eval69.6%
Applied egg-rr69.6%
*-lft-identity69.6%
associate-/r*70.5%
Simplified70.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+238)
(/ 1.0 (* y_m (* x_m (fma z z 1.0))))
(/ (/ (/ 1.0 x_m) (hypot 1.0 z)) (* z y_m))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e+238) {
tmp = 1.0 / (y_m * (x_m * fma(z, z, 1.0)));
} else {
tmp = ((1.0 / x_m) / hypot(1.0, z)) / (z * y_m);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e+238) tmp = Float64(1.0 / Float64(y_m * Float64(x_m * fma(z, z, 1.0)))); else tmp = Float64(Float64(Float64(1.0 / x_m) / hypot(1.0, z)) / Float64(z * y_m)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e+238], 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 / x$95$m), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+238}:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x\_m \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{x\_m}}{\mathsf{hypot}\left(1, z\right)}}{z \cdot y\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 4.99999999999999995e238Initial 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%
if 4.99999999999999995e238 < (*.f64 z z) Initial program 70.1%
associate-/l/70.1%
remove-double-neg70.1%
distribute-rgt-neg-out70.1%
distribute-rgt-neg-out70.1%
remove-double-neg70.1%
associate-*l*67.7%
*-commutative67.7%
sqr-neg67.7%
+-commutative67.7%
sqr-neg67.7%
fma-define67.7%
Simplified67.7%
*-commutative67.7%
associate-*r*70.1%
fma-undefine70.1%
+-commutative70.1%
associate-/l/70.1%
add-sqr-sqrt65.1%
sqrt-div13.2%
inv-pow13.2%
sqrt-pow113.2%
metadata-eval13.2%
+-commutative13.2%
fma-undefine13.2%
*-commutative13.2%
sqrt-prod13.2%
fma-undefine13.2%
+-commutative13.2%
hypot-1-def13.2%
sqrt-div13.2%
Applied egg-rr21.3%
unpow221.3%
Simplified21.3%
Applied egg-rr49.1%
frac-times49.2%
associate-*r/49.2%
pow-prod-up99.6%
metadata-eval99.6%
inv-pow99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 76.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 2e+247)
(/ 1.0 (* y_m (* x_m (fma z z 1.0))))
(/ (/ 1.0 (* x_m z)) (* (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) {
double tmp;
if ((z * z) <= 2e+247) {
tmp = 1.0 / (y_m * (x_m * fma(z, z, 1.0)));
} else {
tmp = (1.0 / (x_m * z)) / (hypot(1.0, z) * y_m);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 2e+247) tmp = Float64(1.0 / Float64(y_m * Float64(x_m * fma(z, z, 1.0)))); else tmp = Float64(Float64(1.0 / Float64(x_m * z)) / Float64(hypot(1.0, z) * y_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+247], N[(1.0 / N[(y$95$m * N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * y$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^{+247}:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x\_m \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x\_m \cdot z}}{\mathsf{hypot}\left(1, z\right) \cdot y\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 1.9999999999999999e247Initial program 98.1%
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.2%
*-commutative95.2%
sqr-neg95.2%
+-commutative95.2%
sqr-neg95.2%
fma-define95.2%
Simplified95.2%
if 1.9999999999999999e247 < (*.f64 z z) Initial program 68.5%
associate-/l/68.5%
remove-double-neg68.5%
distribute-rgt-neg-out68.5%
distribute-rgt-neg-out68.5%
remove-double-neg68.5%
associate-*l*66.0%
*-commutative66.0%
sqr-neg66.0%
+-commutative66.0%
sqr-neg66.0%
fma-define66.0%
Simplified66.0%
*-commutative66.0%
associate-*r*68.5%
fma-undefine68.5%
+-commutative68.5%
associate-/l/68.5%
add-sqr-sqrt64.5%
sqrt-div12.6%
inv-pow12.6%
sqrt-pow112.6%
metadata-eval12.6%
+-commutative12.6%
fma-undefine12.6%
*-commutative12.6%
sqrt-prod12.6%
fma-undefine12.6%
+-commutative12.6%
hypot-1-def12.6%
sqrt-div12.6%
Applied egg-rr21.1%
unpow221.1%
Simplified21.1%
Applied egg-rr49.1%
frac-times49.2%
associate-*r/49.1%
pow-prod-up99.6%
metadata-eval99.6%
inv-pow99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 76.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+274)
(/ 1.0 (* y_m (* x_m (* z z))))
(* (/ (/ 1.0 z) y_m) (/ (/ 1.0 z) x_m)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e-15) {
tmp = (1.0 / y_m) / x_m;
} else if ((z * z) <= 1e+274) {
tmp = 1.0 / (y_m * (x_m * (z * z)));
} else {
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x_m);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 5d-15) then
tmp = (1.0d0 / y_m) / x_m
else if ((z * z) <= 1d+274) then
tmp = 1.0d0 / (y_m * (x_m * (z * z)))
else
tmp = ((1.0d0 / z) / y_m) * ((1.0d0 / z) / x_m)
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e-15) {
tmp = (1.0 / y_m) / x_m;
} else if ((z * z) <= 1e+274) {
tmp = 1.0 / (y_m * (x_m * (z * z)));
} else {
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x_m);
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if (z * z) <= 5e-15: tmp = (1.0 / y_m) / x_m elif (z * z) <= 1e+274: tmp = 1.0 / (y_m * (x_m * (z * z))) else: tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x_m) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e-15) tmp = Float64(Float64(1.0 / y_m) / x_m); elseif (Float64(z * z) <= 1e+274) tmp = Float64(1.0 / Float64(y_m * Float64(x_m * Float64(z * z)))); else tmp = Float64(Float64(Float64(1.0 / z) / y_m) * Float64(Float64(1.0 / z) / x_m)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if ((z * z) <= 5e-15)
tmp = (1.0 / y_m) / x_m;
elseif ((z * z) <= 1e+274)
tmp = 1.0 / (y_m * (x_m * (z * z)));
else
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x_m);
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e-15], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+274], N[(1.0 / N[(y$95$m * N[(x$95$m * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{elif}\;z \cdot z \leq 10^{+274}:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x\_m \cdot \left(z \cdot z\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y\_m} \cdot \frac{\frac{1}{z}}{x\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 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.99999999999999921e273Initial program 94.1%
associate-/l/94.1%
remove-double-neg94.1%
distribute-rgt-neg-out94.1%
distribute-rgt-neg-out94.1%
remove-double-neg94.1%
associate-*l*83.3%
*-commutative83.3%
sqr-neg83.3%
+-commutative83.3%
sqr-neg83.3%
fma-define83.3%
Simplified83.3%
Taylor expanded in z around inf 92.4%
*-commutative92.4%
associate-*r*82.1%
*-commutative82.1%
Simplified82.1%
unpow282.1%
Applied egg-rr82.1%
if 9.99999999999999921e273 < (*.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%
*-un-lft-identity67.3%
associate-/r*67.2%
associate-/r*66.3%
pow-flip69.6%
metadata-eval69.6%
Applied egg-rr69.6%
*-lft-identity69.6%
associate-/r*70.5%
Simplified70.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
(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) 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 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) / y_m) * ((1.0 / z) / x_m);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: 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) / y_m) * ((1.0d0 / z) / x_m)
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double 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) / y_m) * ((1.0 / z) / x_m);
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): 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) / 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) 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(Float64(1.0 / z) / y_m) * Float64(Float64(1.0 / z) / x_m)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
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) / y_m) * ((1.0 / z) / x_m);
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := 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[(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])\\
\\
\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{\frac{1}{z}}{y\_m} \cdot \frac{\frac{1}{z}}{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%
*-un-lft-identity67.9%
associate-/r*67.9%
associate-/r*68.3%
pow-flip72.2%
metadata-eval72.2%
Applied egg-rr72.2%
*-lft-identity72.2%
associate-/r*71.2%
Simplified71.2%
sqr-pow71.2%
*-commutative71.2%
times-frac96.7%
metadata-eval96.7%
unpow-196.7%
metadata-eval96.7%
unpow-196.7%
Applied egg-rr96.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 z) 5e-15)
(/ (/ 1.0 y_m) x_m)
(* (/ 1.0 z) (/ (/ 1.0 z) (* x_m y_m)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e-15) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / z) * ((1.0 / z) / (x_m * y_m));
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 5d-15) then
tmp = (1.0d0 / y_m) / x_m
else
tmp = (1.0d0 / z) * ((1.0d0 / z) / (x_m * y_m))
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e-15) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / z) * ((1.0 / z) / (x_m * y_m));
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if (z * z) <= 5e-15: tmp = (1.0 / y_m) / x_m else: tmp = (1.0 / z) * ((1.0 / z) / (x_m * y_m)) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e-15) tmp = Float64(Float64(1.0 / y_m) / x_m); else tmp = Float64(Float64(1.0 / z) * Float64(Float64(1.0 / z) / Float64(x_m * y_m))); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if ((z * z) <= 5e-15)
tmp = (1.0 / y_m) / x_m;
else
tmp = (1.0 / z) * ((1.0 / z) / (x_m * y_m));
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e-15], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / N[(x$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{\frac{1}{z}}{x\_m \cdot y\_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%
*-un-lft-identity77.8%
associate-/r*77.8%
associate-/r*73.5%
pow-flip75.3%
metadata-eval75.3%
Applied egg-rr75.3%
*-lft-identity75.3%
associate-/r*79.8%
Simplified79.8%
sqr-pow79.7%
associate-/l*90.5%
metadata-eval90.5%
unpow-190.5%
metadata-eval90.5%
unpow-190.5%
Applied egg-rr90.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= z 1.0) (/ (/ 1.0 y_m) x_m) (/ 1.0 (* y_m (* x_m (* z 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 / (y_m * (x_m * (z * 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 / (y_m * (x_m * (z * 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 / (y_m * (x_m * (z * 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 / (y_m * (x_m * (z * 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(y_m * Float64(x_m * Float64(z * 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 / (y_m * (x_m * (z * 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[(y$95$m * N[(x$95$m * N[(z * 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}{y\_m \cdot \left(x\_m \cdot \left(z \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%
associate-/l/81.1%
remove-double-neg81.1%
distribute-rgt-neg-out81.1%
distribute-rgt-neg-out81.1%
remove-double-neg81.1%
associate-*l*81.1%
*-commutative81.1%
sqr-neg81.1%
+-commutative81.1%
sqr-neg81.1%
fma-define81.1%
Simplified81.1%
Taylor expanded in z around inf 80.6%
*-commutative80.6%
associate-*r*80.6%
*-commutative80.6%
Simplified80.6%
unpow280.6%
Applied egg-rr80.6%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ 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(1.0 / Float64(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[(1.0 / N[(x$95$m * y$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}{x\_m \cdot 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%
Taylor expanded in z around 0 59.8%
Final simplification59.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)))))