
(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) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (let* ((t_0 (* (hypot 1.0 z) (sqrt y)))) (* x_s (* (/ 1.0 t_0) (/ (/ 1.0 x_m) t_0)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double t_0 = hypot(1.0, z) * sqrt(y);
return x_s * ((1.0 / t_0) * ((1.0 / x_m) / t_0));
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double t_0 = Math.hypot(1.0, z) * Math.sqrt(y);
return x_s * ((1.0 / t_0) * ((1.0 / x_m) / t_0));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): t_0 = math.hypot(1.0, z) * math.sqrt(y) return x_s * ((1.0 / t_0) * ((1.0 / x_m) / t_0))
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) t_0 = Float64(hypot(1.0, z) * sqrt(y)) return 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);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp = code(x_s, x_m, y, z)
t_0 = hypot(1.0, z) * sqrt(y);
tmp = 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := Block[{t$95$0 = N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, 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]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\\
x\_s \cdot \left(\frac{1}{t\_0} \cdot \frac{\frac{1}{x\_m}}{t\_0}\right)
\end{array}
\end{array}
Initial program 88.6%
associate-/l/87.8%
remove-double-neg87.8%
distribute-rgt-neg-out87.8%
distribute-rgt-neg-out87.8%
remove-double-neg87.8%
associate-*l*86.3%
*-commutative86.3%
sqr-neg86.3%
+-commutative86.3%
sqr-neg86.3%
fma-define86.3%
Simplified86.3%
*-commutative86.3%
associate-*r*87.8%
fma-undefine87.8%
+-commutative87.8%
associate-/l/88.6%
add-sqr-sqrt42.7%
*-un-lft-identity42.7%
times-frac42.7%
+-commutative42.7%
fma-undefine42.7%
*-commutative42.7%
sqrt-prod42.7%
fma-undefine42.7%
+-commutative42.7%
hypot-1-def42.7%
+-commutative42.7%
Applied egg-rr47.3%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (pow (/ (pow x_m -0.5) (* (hypot 1.0 z) (sqrt y))) 2.0)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
return x_s * pow((pow(x_m, -0.5) / (hypot(1.0, z) * sqrt(y))), 2.0);
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
return x_s * Math.pow((Math.pow(x_m, -0.5) / (Math.hypot(1.0, z) * Math.sqrt(y))), 2.0);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): return x_s * math.pow((math.pow(x_m, -0.5) / (math.hypot(1.0, z) * math.sqrt(y))), 2.0)
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) return Float64(x_s * (Float64((x_m ^ -0.5) / Float64(hypot(1.0, z) * sqrt(y))) ^ 2.0)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp = code(x_s, x_m, y, z)
tmp = x_s * (((x_m ^ -0.5) / (hypot(1.0, z) * sqrt(y))) ^ 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := 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], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot {\left(\frac{{x\_m}^{-0.5}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}}\right)}^{2}
\end{array}
Initial program 88.6%
associate-/l/87.8%
remove-double-neg87.8%
distribute-rgt-neg-out87.8%
distribute-rgt-neg-out87.8%
remove-double-neg87.8%
associate-*l*86.3%
*-commutative86.3%
sqr-neg86.3%
+-commutative86.3%
sqr-neg86.3%
fma-define86.3%
Simplified86.3%
*-commutative86.3%
associate-*r*87.8%
fma-undefine87.8%
+-commutative87.8%
associate-/l/88.6%
add-sqr-sqrt55.5%
sqrt-div17.4%
inv-pow17.4%
sqrt-pow117.4%
metadata-eval17.4%
+-commutative17.4%
fma-undefine17.4%
*-commutative17.4%
sqrt-prod17.4%
fma-undefine17.4%
+-commutative17.4%
hypot-1-def17.4%
sqrt-div17.3%
Applied egg-rr20.9%
unpow220.9%
Simplified20.9%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (/ (/ 1.0 (hypot 1.0 z)) (* y (* (hypot 1.0 z) x_m)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
return x_s * ((1.0 / hypot(1.0, z)) / (y * (hypot(1.0, z) * x_m)));
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
return x_s * ((1.0 / Math.hypot(1.0, z)) / (y * (Math.hypot(1.0, z) * x_m)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): return x_s * ((1.0 / math.hypot(1.0, z)) / (y * (math.hypot(1.0, z) * x_m)))
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) return Float64(x_s * Float64(Float64(1.0 / hypot(1.0, z)) / Float64(y * Float64(hypot(1.0, z) * x_m)))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp = code(x_s, x_m, y, z)
tmp = x_s * ((1.0 / hypot(1.0, z)) / (y * (hypot(1.0, z) * 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[(y * N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{y \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot x\_m\right)}
\end{array}
Initial program 88.6%
associate-/l/87.8%
remove-double-neg87.8%
distribute-rgt-neg-out87.8%
distribute-rgt-neg-out87.8%
remove-double-neg87.8%
associate-*l*86.3%
*-commutative86.3%
sqr-neg86.3%
+-commutative86.3%
sqr-neg86.3%
fma-define86.3%
Simplified86.3%
*-commutative86.3%
associate-*r*87.8%
fma-undefine87.8%
+-commutative87.8%
associate-/l/88.6%
add-sqr-sqrt55.5%
sqrt-div17.4%
inv-pow17.4%
sqrt-pow117.4%
metadata-eval17.4%
+-commutative17.4%
fma-undefine17.4%
*-commutative17.4%
sqrt-prod17.4%
fma-undefine17.4%
+-commutative17.4%
hypot-1-def17.4%
sqrt-div17.3%
Applied egg-rr20.9%
unpow220.9%
Simplified20.9%
unpow220.9%
frac-times18.4%
pow-prod-up44.1%
metadata-eval44.1%
inv-pow44.1%
swap-sqr42.7%
hypot-undefine42.7%
hypot-undefine42.7%
rem-square-sqrt42.7%
add-sqr-sqrt88.6%
associate-/l/87.8%
associate-/l/87.1%
rem-square-sqrt87.1%
hypot-undefine87.1%
hypot-undefine87.1%
associate-/l/94.9%
div-inv94.9%
Applied egg-rr97.4%
Final simplification97.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= (* z z) 4e+283)
(* (/ 1.0 y) (/ (/ 1.0 x_m) (fma z z 1.0)))
(/ (/ 1.0 (hypot 1.0 z)) (* x_m (* z y))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z * z) <= 4e+283) {
tmp = (1.0 / y) * ((1.0 / x_m) / fma(z, z, 1.0));
} else {
tmp = (1.0 / hypot(1.0, z)) / (x_m * (z * y));
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (Float64(z * z) <= 4e+283) tmp = Float64(Float64(1.0 / y) * Float64(Float64(1.0 / x_m) / fma(z, z, 1.0))); else tmp = Float64(Float64(1.0 / hypot(1.0, z)) / Float64(x_m * Float64(z * y))); end return 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 4e+283], N[(N[(1.0 / y), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[(x$95$m * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+283}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{\frac{1}{x\_m}}{\mathsf{fma}\left(z, z, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{x\_m \cdot \left(z \cdot y\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 3.99999999999999982e283Initial program 98.7%
associate-/l/97.5%
remove-double-neg97.5%
distribute-rgt-neg-out97.5%
distribute-rgt-neg-out97.5%
remove-double-neg97.5%
associate-*l*96.0%
*-commutative96.0%
sqr-neg96.0%
+-commutative96.0%
sqr-neg96.0%
fma-define96.0%
Simplified96.0%
*-commutative96.0%
associate-*r*97.5%
fma-undefine97.5%
+-commutative97.5%
associate-/l/98.7%
*-un-lft-identity98.7%
+-commutative98.7%
fma-undefine98.7%
times-frac97.0%
Applied egg-rr97.0%
if 3.99999999999999982e283 < (*.f64 z z) Initial program 63.5%
associate-/l/63.5%
remove-double-neg63.5%
distribute-rgt-neg-out63.5%
distribute-rgt-neg-out63.5%
remove-double-neg63.5%
associate-*l*62.2%
*-commutative62.2%
sqr-neg62.2%
+-commutative62.2%
sqr-neg62.2%
fma-define62.2%
Simplified62.2%
*-commutative62.2%
associate-*r*63.5%
fma-undefine63.5%
+-commutative63.5%
associate-/l/63.5%
add-sqr-sqrt62.2%
sqrt-div6.4%
inv-pow6.4%
sqrt-pow16.4%
metadata-eval6.4%
+-commutative6.4%
fma-undefine6.4%
*-commutative6.4%
sqrt-prod6.4%
fma-undefine6.4%
+-commutative6.4%
hypot-1-def6.4%
sqrt-div6.4%
Applied egg-rr17.6%
unpow217.6%
Simplified17.6%
unpow217.6%
frac-times10.1%
pow-prod-up28.2%
metadata-eval28.2%
inv-pow28.2%
swap-sqr23.0%
hypot-undefine23.0%
hypot-undefine23.0%
rem-square-sqrt23.0%
add-sqr-sqrt63.5%
associate-/l/63.1%
associate-/l/63.1%
rem-square-sqrt63.1%
hypot-undefine63.1%
hypot-undefine63.1%
associate-/l/90.5%
div-inv90.5%
Applied egg-rr98.6%
Taylor expanded in z around inf 78.6%
Final simplification91.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= (* z z) 4e+283)
(/ 1.0 (* y (* x_m (fma z z 1.0))))
(/ (/ 1.0 (hypot 1.0 z)) (* x_m (* z y))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z * z) <= 4e+283) {
tmp = 1.0 / (y * (x_m * fma(z, z, 1.0)));
} else {
tmp = (1.0 / hypot(1.0, z)) / (x_m * (z * y));
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (Float64(z * z) <= 4e+283) tmp = Float64(1.0 / Float64(y * Float64(x_m * fma(z, z, 1.0)))); else tmp = Float64(Float64(1.0 / hypot(1.0, z)) / Float64(x_m * Float64(z * y))); end return 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 4e+283], N[(1.0 / N[(y * N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[(x$95$m * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+283}:\\
\;\;\;\;\frac{1}{y \cdot \left(x\_m \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{x\_m \cdot \left(z \cdot y\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 3.99999999999999982e283Initial program 98.7%
associate-/l/97.5%
remove-double-neg97.5%
distribute-rgt-neg-out97.5%
distribute-rgt-neg-out97.5%
remove-double-neg97.5%
associate-*l*96.0%
*-commutative96.0%
sqr-neg96.0%
+-commutative96.0%
sqr-neg96.0%
fma-define96.0%
Simplified96.0%
if 3.99999999999999982e283 < (*.f64 z z) Initial program 63.5%
associate-/l/63.5%
remove-double-neg63.5%
distribute-rgt-neg-out63.5%
distribute-rgt-neg-out63.5%
remove-double-neg63.5%
associate-*l*62.2%
*-commutative62.2%
sqr-neg62.2%
+-commutative62.2%
sqr-neg62.2%
fma-define62.2%
Simplified62.2%
*-commutative62.2%
associate-*r*63.5%
fma-undefine63.5%
+-commutative63.5%
associate-/l/63.5%
add-sqr-sqrt62.2%
sqrt-div6.4%
inv-pow6.4%
sqrt-pow16.4%
metadata-eval6.4%
+-commutative6.4%
fma-undefine6.4%
*-commutative6.4%
sqrt-prod6.4%
fma-undefine6.4%
+-commutative6.4%
hypot-1-def6.4%
sqrt-div6.4%
Applied egg-rr17.6%
unpow217.6%
Simplified17.6%
unpow217.6%
frac-times10.1%
pow-prod-up28.2%
metadata-eval28.2%
inv-pow28.2%
swap-sqr23.0%
hypot-undefine23.0%
hypot-undefine23.0%
rem-square-sqrt23.0%
add-sqr-sqrt63.5%
associate-/l/63.1%
associate-/l/63.1%
rem-square-sqrt63.1%
hypot-undefine63.1%
hypot-undefine63.1%
associate-/l/90.5%
div-inv90.5%
Applied egg-rr98.6%
Taylor expanded in z around inf 78.6%
Final simplification91.0%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= (* z z) 4e+283)
(/ 1.0 (* y (* x_m (fma z z 1.0))))
(/ (/ 1.0 (* x_m (* z y))) (hypot 1.0 z)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z * z) <= 4e+283) {
tmp = 1.0 / (y * (x_m * fma(z, z, 1.0)));
} else {
tmp = (1.0 / (x_m * (z * y))) / hypot(1.0, z);
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (Float64(z * z) <= 4e+283) tmp = Float64(1.0 / Float64(y * Float64(x_m * fma(z, z, 1.0)))); else tmp = Float64(Float64(1.0 / Float64(x_m * Float64(z * y))) / hypot(1.0, z)); end return 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 4e+283], N[(1.0 / N[(y * N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(x$95$m * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+283}:\\
\;\;\;\;\frac{1}{y \cdot \left(x\_m \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x\_m \cdot \left(z \cdot y\right)}}{\mathsf{hypot}\left(1, z\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 3.99999999999999982e283Initial program 98.7%
associate-/l/97.5%
remove-double-neg97.5%
distribute-rgt-neg-out97.5%
distribute-rgt-neg-out97.5%
remove-double-neg97.5%
associate-*l*96.0%
*-commutative96.0%
sqr-neg96.0%
+-commutative96.0%
sqr-neg96.0%
fma-define96.0%
Simplified96.0%
if 3.99999999999999982e283 < (*.f64 z z) Initial program 63.5%
associate-/l/63.5%
remove-double-neg63.5%
distribute-rgt-neg-out63.5%
distribute-rgt-neg-out63.5%
remove-double-neg63.5%
associate-*l*62.2%
*-commutative62.2%
sqr-neg62.2%
+-commutative62.2%
sqr-neg62.2%
fma-define62.2%
Simplified62.2%
*-commutative62.2%
associate-*r*63.5%
fma-undefine63.5%
+-commutative63.5%
associate-/l/63.5%
add-sqr-sqrt23.0%
*-un-lft-identity23.0%
times-frac23.0%
+-commutative23.0%
fma-undefine23.0%
*-commutative23.0%
sqrt-prod23.0%
fma-undefine23.0%
+-commutative23.0%
hypot-1-def23.0%
+-commutative23.0%
Applied egg-rr38.2%
frac-times28.2%
pow228.2%
*-commutative28.2%
hypot-1-def23.0%
sqrt-prod23.0%
pow223.0%
add-sqr-sqrt63.5%
associate-*r/63.5%
associate-/r*63.1%
*-un-lft-identity63.1%
add-sqr-sqrt63.1%
hypot-1-def63.1%
hypot-1-def63.1%
associate-/r*90.5%
associate-/l/90.5%
Applied egg-rr90.5%
Taylor expanded in z around inf 78.5%
Final simplification91.0%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= (* z z) 4e+283)
(/ 1.0 (* y (* x_m (fma z z 1.0))))
(* (/ (/ 1.0 z) y) (/ (/ 1.0 z) x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z * z) <= 4e+283) {
tmp = 1.0 / (y * (x_m * fma(z, z, 1.0)));
} else {
tmp = ((1.0 / z) / y) * ((1.0 / z) / x_m);
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (Float64(z * z) <= 4e+283) tmp = Float64(1.0 / Float64(y * Float64(x_m * fma(z, z, 1.0)))); else tmp = Float64(Float64(Float64(1.0 / z) / y) * Float64(Float64(1.0 / z) / x_m)); end return 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 4e+283], N[(1.0 / N[(y * N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+283}:\\
\;\;\;\;\frac{1}{y \cdot \left(x\_m \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y} \cdot \frac{\frac{1}{z}}{x\_m}\\
\end{array}
\end{array}
if (*.f64 z z) < 3.99999999999999982e283Initial program 98.7%
associate-/l/97.5%
remove-double-neg97.5%
distribute-rgt-neg-out97.5%
distribute-rgt-neg-out97.5%
remove-double-neg97.5%
associate-*l*96.0%
*-commutative96.0%
sqr-neg96.0%
+-commutative96.0%
sqr-neg96.0%
fma-define96.0%
Simplified96.0%
if 3.99999999999999982e283 < (*.f64 z z) Initial program 63.5%
remove-double-neg63.5%
distribute-lft-neg-out63.5%
distribute-rgt-neg-in63.5%
associate-/r*63.1%
associate-/l/63.1%
associate-/l/63.1%
distribute-lft-neg-out63.1%
distribute-rgt-neg-in63.1%
distribute-lft-neg-in63.1%
remove-double-neg63.1%
sqr-neg63.1%
+-commutative63.1%
sqr-neg63.1%
fma-define63.1%
*-commutative63.1%
Simplified63.1%
Taylor expanded in z around inf 63.1%
*-un-lft-identity63.1%
associate-/r*63.1%
associate-/r*63.4%
pow-flip64.4%
metadata-eval64.4%
Applied egg-rr64.4%
*-lft-identity64.4%
associate-/r*63.6%
Simplified63.6%
sqr-pow63.6%
*-commutative63.6%
times-frac97.9%
metadata-eval97.9%
unpow-197.9%
metadata-eval97.9%
unpow-197.9%
Applied egg-rr97.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= (* z z) 2e-10)
(/ (/ 1.0 y) x_m)
(* (/ 1.0 z) (/ (/ 1.0 z) (* y x_m))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z * z) <= 2e-10) {
tmp = (1.0 / y) / x_m;
} else {
tmp = (1.0 / z) * ((1.0 / z) / (y * x_m));
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 2d-10) then
tmp = (1.0d0 / y) / x_m
else
tmp = (1.0d0 / z) * ((1.0d0 / z) / (y * x_m))
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z * z) <= 2e-10) {
tmp = (1.0 / y) / x_m;
} else {
tmp = (1.0 / z) * ((1.0 / z) / (y * x_m));
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): tmp = 0 if (z * z) <= 2e-10: tmp = (1.0 / y) / x_m else: tmp = (1.0 / z) * ((1.0 / z) / (y * x_m)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (Float64(z * z) <= 2e-10) tmp = Float64(Float64(1.0 / y) / x_m); else tmp = Float64(Float64(1.0 / z) * Float64(Float64(1.0 / z) / Float64(y * x_m))); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
tmp = 0.0;
if ((z * z) <= 2e-10)
tmp = (1.0 / y) / x_m;
else
tmp = (1.0 / z) * ((1.0 / z) / (y * x_m));
end
tmp_2 = 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 2e-10], N[(N[(1.0 / y), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / N[(y * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\frac{\frac{1}{y}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{\frac{1}{z}}{y \cdot x\_m}\\
\end{array}
\end{array}
if (*.f64 z z) < 2.00000000000000007e-10Initial program 99.7%
associate-/l/98.4%
remove-double-neg98.4%
distribute-rgt-neg-out98.4%
distribute-rgt-neg-out98.4%
remove-double-neg98.4%
associate-*l*98.4%
*-commutative98.4%
sqr-neg98.4%
+-commutative98.4%
sqr-neg98.4%
fma-define98.4%
Simplified98.4%
Taylor expanded in z around 0 98.0%
inv-pow98.0%
add-sqr-sqrt46.6%
unpow-prod-down46.6%
Applied egg-rr46.6%
pow-sqr46.6%
metadata-eval46.6%
*-commutative46.6%
Simplified46.6%
sqrt-pow298.0%
metadata-eval98.0%
inv-pow98.0%
associate-/l/99.3%
Applied egg-rr99.3%
if 2.00000000000000007e-10 < (*.f64 z z) Initial program 77.4%
remove-double-neg77.4%
distribute-lft-neg-out77.4%
distribute-rgt-neg-in77.4%
associate-/r*75.7%
associate-/l/75.7%
associate-/l/75.4%
distribute-lft-neg-out75.4%
distribute-rgt-neg-in75.4%
distribute-lft-neg-in75.4%
remove-double-neg75.4%
sqr-neg75.4%
+-commutative75.4%
sqr-neg75.4%
fma-define75.4%
*-commutative75.4%
Simplified75.4%
Taylor expanded in z around inf 74.8%
*-un-lft-identity74.8%
associate-/r*75.1%
associate-/r*74.5%
pow-flip75.1%
metadata-eval75.1%
Applied egg-rr75.1%
*-lft-identity75.1%
associate-/r*75.4%
Simplified75.4%
sqr-pow75.4%
associate-/l*90.8%
metadata-eval90.8%
unpow-190.8%
metadata-eval90.8%
unpow-190.8%
Applied egg-rr90.8%
Final simplification95.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= z 3e+18)
(/ (/ 1.0 x_m) (* y (+ 1.0 (* z z))))
(* (/ (/ 1.0 z) y) (/ (/ 1.0 z) x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= 3e+18) {
tmp = (1.0 / x_m) / (y * (1.0 + (z * z)));
} else {
tmp = ((1.0 / z) / y) * ((1.0 / z) / x_m);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 3d+18) then
tmp = (1.0d0 / x_m) / (y * (1.0d0 + (z * z)))
else
tmp = ((1.0d0 / z) / y) * ((1.0d0 / z) / x_m)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= 3e+18) {
tmp = (1.0 / x_m) / (y * (1.0 + (z * z)));
} else {
tmp = ((1.0 / z) / y) * ((1.0 / z) / x_m);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): tmp = 0 if z <= 3e+18: tmp = (1.0 / x_m) / (y * (1.0 + (z * z))) else: tmp = ((1.0 / z) / y) * ((1.0 / z) / x_m) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= 3e+18) tmp = Float64(Float64(1.0 / x_m) / Float64(y * Float64(1.0 + Float64(z * z)))); else tmp = Float64(Float64(Float64(1.0 / z) / y) * Float64(Float64(1.0 / z) / x_m)); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
tmp = 0.0;
if (z <= 3e+18)
tmp = (1.0 / x_m) / (y * (1.0 + (z * z)));
else
tmp = ((1.0 / z) / y) * ((1.0 / z) / x_m);
end
tmp_2 = 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, 3e+18], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 3 \cdot 10^{+18}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y \cdot \left(1 + z \cdot z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y} \cdot \frac{\frac{1}{z}}{x\_m}\\
\end{array}
\end{array}
if z < 3e18Initial program 91.2%
if 3e18 < z Initial program 81.6%
remove-double-neg81.6%
distribute-lft-neg-out81.6%
distribute-rgt-neg-in81.6%
associate-/r*79.9%
associate-/l/79.8%
associate-/l/79.3%
distribute-lft-neg-out79.3%
distribute-rgt-neg-in79.3%
distribute-lft-neg-in79.3%
remove-double-neg79.3%
sqr-neg79.3%
+-commutative79.3%
sqr-neg79.3%
fma-define79.3%
*-commutative79.3%
Simplified79.3%
Taylor expanded in z around inf 79.3%
*-un-lft-identity79.3%
associate-/r*79.9%
associate-/r*78.3%
pow-flip78.9%
metadata-eval78.9%
Applied egg-rr78.9%
*-lft-identity78.9%
associate-/r*80.0%
Simplified80.0%
sqr-pow80.0%
*-commutative80.0%
times-frac96.5%
metadata-eval96.5%
unpow-196.5%
metadata-eval96.5%
unpow-196.5%
Applied egg-rr96.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= z 0.47) (/ (/ 1.0 y) x_m) (* (/ (/ 1.0 z) y) (/ (/ 1.0 z) x_m)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= 0.47) {
tmp = (1.0 / y) / x_m;
} else {
tmp = ((1.0 / z) / y) * ((1.0 / z) / x_m);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 0.47d0) then
tmp = (1.0d0 / y) / x_m
else
tmp = ((1.0d0 / z) / y) * ((1.0d0 / z) / x_m)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= 0.47) {
tmp = (1.0 / y) / x_m;
} else {
tmp = ((1.0 / z) / y) * ((1.0 / z) / x_m);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): tmp = 0 if z <= 0.47: tmp = (1.0 / y) / x_m else: tmp = ((1.0 / z) / y) * ((1.0 / z) / x_m) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= 0.47) tmp = Float64(Float64(1.0 / y) / x_m); else tmp = Float64(Float64(Float64(1.0 / z) / y) * Float64(Float64(1.0 / z) / x_m)); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
tmp = 0.0;
if (z <= 0.47)
tmp = (1.0 / y) / x_m;
else
tmp = ((1.0 / z) / y) * ((1.0 / z) / x_m);
end
tmp_2 = 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, 0.47], N[(N[(1.0 / y), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 0.47:\\
\;\;\;\;\frac{\frac{1}{y}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y} \cdot \frac{\frac{1}{z}}{x\_m}\\
\end{array}
\end{array}
if z < 0.46999999999999997Initial program 91.1%
associate-/l/90.1%
remove-double-neg90.1%
distribute-rgt-neg-out90.1%
distribute-rgt-neg-out90.1%
remove-double-neg90.1%
associate-*l*89.6%
*-commutative89.6%
sqr-neg89.6%
+-commutative89.6%
sqr-neg89.6%
fma-define89.6%
Simplified89.6%
Taylor expanded in z around 0 75.2%
inv-pow75.2%
add-sqr-sqrt34.9%
unpow-prod-down34.9%
Applied egg-rr34.9%
pow-sqr34.9%
metadata-eval34.9%
*-commutative34.9%
Simplified34.9%
sqrt-pow275.2%
metadata-eval75.2%
inv-pow75.2%
associate-/l/75.8%
Applied egg-rr75.8%
if 0.46999999999999997 < z Initial program 82.6%
remove-double-neg82.6%
distribute-lft-neg-out82.6%
distribute-rgt-neg-in82.6%
associate-/r*81.0%
associate-/l/80.9%
associate-/l/80.5%
distribute-lft-neg-out80.5%
distribute-rgt-neg-in80.5%
distribute-lft-neg-in80.5%
remove-double-neg80.5%
sqr-neg80.5%
+-commutative80.5%
sqr-neg80.5%
fma-define80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in z around inf 80.5%
*-un-lft-identity80.5%
associate-/r*81.0%
associate-/r*79.5%
pow-flip80.0%
metadata-eval80.0%
Applied egg-rr80.0%
*-lft-identity80.0%
associate-/r*81.1%
Simplified81.1%
sqr-pow81.1%
*-commutative81.1%
times-frac96.6%
metadata-eval96.6%
unpow-196.6%
metadata-eval96.6%
unpow-196.6%
Applied egg-rr96.6%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= (* z z) 0.225) (/ (/ 1.0 y) x_m) (/ 1.0 (* (* z z) (* y x_m))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z * z) <= 0.225) {
tmp = (1.0 / y) / x_m;
} else {
tmp = 1.0 / ((z * z) * (y * x_m));
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 0.225d0) then
tmp = (1.0d0 / y) / x_m
else
tmp = 1.0d0 / ((z * z) * (y * x_m))
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z * z) <= 0.225) {
tmp = (1.0 / y) / x_m;
} else {
tmp = 1.0 / ((z * z) * (y * x_m));
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): tmp = 0 if (z * z) <= 0.225: tmp = (1.0 / y) / x_m else: tmp = 1.0 / ((z * z) * (y * x_m)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (Float64(z * z) <= 0.225) tmp = Float64(Float64(1.0 / y) / x_m); else tmp = Float64(1.0 / Float64(Float64(z * z) * Float64(y * x_m))); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
tmp = 0.0;
if ((z * z) <= 0.225)
tmp = (1.0 / y) / x_m;
else
tmp = 1.0 / ((z * z) * (y * x_m));
end
tmp_2 = 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 0.225], N[(N[(1.0 / y), $MachinePrecision] / x$95$m), $MachinePrecision], N[(1.0 / N[(N[(z * z), $MachinePrecision] * N[(y * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 0.225:\\
\;\;\;\;\frac{\frac{1}{y}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(z \cdot z\right) \cdot \left(y \cdot x\_m\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 0.225000000000000006Initial program 99.7%
associate-/l/98.4%
remove-double-neg98.4%
distribute-rgt-neg-out98.4%
distribute-rgt-neg-out98.4%
remove-double-neg98.4%
associate-*l*98.4%
*-commutative98.4%
sqr-neg98.4%
+-commutative98.4%
sqr-neg98.4%
fma-define98.4%
Simplified98.4%
Taylor expanded in z around 0 98.0%
inv-pow98.0%
add-sqr-sqrt46.6%
unpow-prod-down46.6%
Applied egg-rr46.6%
pow-sqr46.6%
metadata-eval46.6%
*-commutative46.6%
Simplified46.6%
sqrt-pow298.0%
metadata-eval98.0%
inv-pow98.0%
associate-/l/99.3%
Applied egg-rr99.3%
if 0.225000000000000006 < (*.f64 z z) Initial program 77.4%
remove-double-neg77.4%
distribute-lft-neg-out77.4%
distribute-rgt-neg-in77.4%
associate-/r*75.7%
associate-/l/75.7%
associate-/l/75.4%
distribute-lft-neg-out75.4%
distribute-rgt-neg-in75.4%
distribute-lft-neg-in75.4%
remove-double-neg75.4%
sqr-neg75.4%
+-commutative75.4%
sqr-neg75.4%
fma-define75.4%
*-commutative75.4%
Simplified75.4%
Taylor expanded in z around inf 74.8%
unpow274.8%
Applied egg-rr74.8%
Final simplification87.1%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (/ (/ 1.0 y) x_m)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
return x_s * ((1.0 / y) / x_m);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x_s * ((1.0d0 / y) / x_m)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
return x_s * ((1.0 / y) / x_m);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): return x_s * ((1.0 / y) / x_m)
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) return Float64(x_s * Float64(Float64(1.0 / y) / x_m)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp = code(x_s, x_m, y, z)
tmp = x_s * ((1.0 / y) / 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * N[(N[(1.0 / y), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \frac{\frac{1}{y}}{x\_m}
\end{array}
Initial program 88.6%
associate-/l/87.8%
remove-double-neg87.8%
distribute-rgt-neg-out87.8%
distribute-rgt-neg-out87.8%
remove-double-neg87.8%
associate-*l*86.3%
*-commutative86.3%
sqr-neg86.3%
+-commutative86.3%
sqr-neg86.3%
fma-define86.3%
Simplified86.3%
Taylor expanded in z around 0 58.8%
inv-pow58.8%
add-sqr-sqrt27.5%
unpow-prod-down27.5%
Applied egg-rr27.5%
pow-sqr27.5%
metadata-eval27.5%
*-commutative27.5%
Simplified27.5%
sqrt-pow258.8%
metadata-eval58.8%
inv-pow58.8%
associate-/l/59.2%
Applied egg-rr59.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (/ (/ 1.0 x_m) y)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
return x_s * ((1.0 / x_m) / y);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x_s * ((1.0d0 / x_m) / y)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
return x_s * ((1.0 / x_m) / y);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): return x_s * ((1.0 / x_m) / y)
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) return Float64(x_s * Float64(Float64(1.0 / x_m) / y)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp = code(x_s, x_m, y, z)
tmp = x_s * ((1.0 / x_m) / y);
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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * N[(N[(1.0 / x$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \frac{\frac{1}{x\_m}}{y}
\end{array}
Initial program 88.6%
associate-/l/87.8%
remove-double-neg87.8%
distribute-rgt-neg-out87.8%
distribute-rgt-neg-out87.8%
remove-double-neg87.8%
associate-*l*86.3%
*-commutative86.3%
sqr-neg86.3%
+-commutative86.3%
sqr-neg86.3%
fma-define86.3%
Simplified86.3%
Taylor expanded in z around 0 58.8%
associate-/r*59.2%
Simplified59.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (/ 1.0 (* y x_m))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
return x_s * (1.0 / (y * x_m));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x_s * (1.0d0 / (y * x_m))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
return x_s * (1.0 / (y * x_m));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): return x_s * (1.0 / (y * x_m))
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) return Float64(x_s * Float64(1.0 / Float64(y * x_m))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp = code(x_s, x_m, y, z)
tmp = x_s * (1.0 / (y * 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * N[(1.0 / N[(y * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \frac{1}{y \cdot x\_m}
\end{array}
Initial program 88.6%
associate-/l/87.8%
remove-double-neg87.8%
distribute-rgt-neg-out87.8%
distribute-rgt-neg-out87.8%
remove-double-neg87.8%
associate-*l*86.3%
*-commutative86.3%
sqr-neg86.3%
+-commutative86.3%
sqr-neg86.3%
fma-define86.3%
Simplified86.3%
Taylor expanded in z around 0 58.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 2024170
(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)))))