
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) 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 89.8%
associate-/l/89.3%
associate-*l*89.7%
*-commutative89.7%
sqr-neg89.7%
+-commutative89.7%
sqr-neg89.7%
fma-define89.7%
Simplified89.7%
fma-undefine89.7%
+-commutative89.7%
*-commutative89.7%
associate-*r*89.3%
associate-/l/89.8%
add-sqr-sqrt45.8%
*-un-lft-identity45.8%
times-frac45.8%
*-commutative45.8%
sqrt-prod45.8%
hypot-1-def45.8%
*-commutative45.8%
sqrt-prod46.8%
hypot-1-def50.9%
Applied egg-rr50.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 (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 89.8%
associate-/l/89.3%
associate-*l*89.7%
*-commutative89.7%
sqr-neg89.7%
+-commutative89.7%
sqr-neg89.7%
fma-define89.7%
Simplified89.7%
fma-undefine89.7%
+-commutative89.7%
*-commutative89.7%
associate-*r*89.3%
associate-/l/89.8%
add-sqr-sqrt58.1%
sqrt-div22.7%
inv-pow22.7%
sqrt-pow122.7%
metadata-eval22.7%
*-commutative22.7%
sqrt-prod22.7%
hypot-1-def22.7%
sqrt-div22.7%
inv-pow22.7%
sqrt-pow122.7%
metadata-eval22.7%
*-commutative22.7%
Applied egg-rr25.2%
unpow225.2%
Simplified25.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 (hypot 1.0 z)) (/ (/ 1.0 (* (hypot 1.0 z) 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 / hypot(1.0, z)) * ((1.0 / (hypot(1.0, z) * x_m)) / y));
}
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)) * ((1.0 / (Math.hypot(1.0, z) * 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 / math.hypot(1.0, z)) * ((1.0 / (math.hypot(1.0, z) * 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 / hypot(1.0, z)) * Float64(Float64(1.0 / Float64(hypot(1.0, z) * 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 / hypot(1.0, z)) * ((1.0 / (hypot(1.0, z) * 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 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision] / y), $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 \left(\frac{1}{\mathsf{hypot}\left(1, z\right)} \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot x\_m}}{y}\right)
\end{array}
Initial program 89.8%
associate-/l/89.3%
associate-*l*89.7%
*-commutative89.7%
sqr-neg89.7%
+-commutative89.7%
sqr-neg89.7%
fma-define89.7%
Simplified89.7%
add-sqr-sqrt41.1%
pow241.1%
associate-*r*40.6%
fma-undefine40.6%
+-commutative40.6%
sqrt-prod40.6%
*-commutative40.6%
hypot-1-def44.0%
Applied egg-rr44.0%
*-commutative44.0%
sqrt-prod25.2%
Applied egg-rr25.2%
pow-prod-down21.9%
pow221.9%
swap-sqr21.9%
add-sqr-sqrt46.9%
add-sqr-sqrt89.2%
*-commutative89.2%
associate-/r*89.4%
metadata-eval89.4%
frac-times89.6%
associate-*l/90.1%
*-rgt-identity90.1%
pow290.1%
frac-times93.8%
div-inv93.9%
*-commutative93.9%
associate-/l*98.0%
Applied egg-rr98.0%
Final simplification98.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 (/ (/ 1.0 (* (hypot 1.0 z) (* (hypot 1.0 z) 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 / (hypot(1.0, z) * (hypot(1.0, z) * x_m))) / y);
}
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) * (Math.hypot(1.0, z) * 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 / (math.hypot(1.0, z) * (math.hypot(1.0, z) * 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 / Float64(hypot(1.0, z) * Float64(hypot(1.0, z) * 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 / (hypot(1.0, z) * (hypot(1.0, z) * 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 / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision]), $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}{\mathsf{hypot}\left(1, z\right) \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot x\_m\right)}}{y}
\end{array}
Initial program 89.8%
associate-/l/89.3%
associate-*l*89.7%
*-commutative89.7%
sqr-neg89.7%
+-commutative89.7%
sqr-neg89.7%
fma-define89.7%
Simplified89.7%
fma-undefine89.7%
+-commutative89.7%
*-commutative89.7%
associate-*r*89.3%
associate-/l/89.8%
add-sqr-sqrt45.8%
*-un-lft-identity45.8%
times-frac45.8%
*-commutative45.8%
sqrt-prod45.8%
hypot-1-def45.8%
*-commutative45.8%
sqrt-prod46.8%
hypot-1-def50.9%
Applied egg-rr50.9%
*-commutative50.9%
associate-/r*50.1%
associate-/r*50.1%
frac-times48.3%
add-sqr-sqrt93.9%
Applied egg-rr93.9%
un-div-inv93.9%
clear-num93.9%
associate-/l/93.6%
associate-/r/93.6%
/-rgt-identity93.6%
*-commutative93.6%
Applied egg-rr93.6%
Final simplification93.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
(let* ((t_0 (* y (+ 1.0 (* z z)))))
(*
x_s
(if (<= t_0 INFINITY)
(/ (/ 1.0 x_m) t_0)
(* (/ 1.0 (hypot 1.0 z)) (/ (/ 1.0 (* z 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) {
double t_0 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = (1.0 / hypot(1.0, z)) * ((1.0 / (z * x_m)) / y);
}
return x_s * tmp;
}
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 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = (1.0 / Math.hypot(1.0, z)) * ((1.0 / (z * x_m)) / y);
}
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): t_0 = y * (1.0 + (z * z)) tmp = 0 if t_0 <= math.inf: tmp = (1.0 / x_m) / t_0 else: tmp = (1.0 / math.hypot(1.0, z)) * ((1.0 / (z * x_m)) / 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) t_0 = Float64(y * Float64(1.0 + Float64(z * z))) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(Float64(1.0 / x_m) / t_0); else tmp = Float64(Float64(1.0 / hypot(1.0, z)) * Float64(Float64(1.0 / Float64(z * x_m)) / y)); 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)
t_0 = y * (1.0 + (z * z));
tmp = 0.0;
if (t_0 <= Inf)
tmp = (1.0 / x_m) / t_0;
else
tmp = (1.0 / hypot(1.0, z)) * ((1.0 / (z * x_m)) / y);
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_] := Block[{t$95$0 = N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, Infinity], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(z * x$95$m), $MachinePrecision]), $MachinePrecision] / y), $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 := y \cdot \left(1 + z \cdot z\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(1, z\right)} \cdot \frac{\frac{1}{z \cdot x\_m}}{y}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < +inf.0Initial program 89.8%
if +inf.0 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) Initial program 89.8%
associate-/l/89.3%
associate-*l*89.7%
*-commutative89.7%
sqr-neg89.7%
+-commutative89.7%
sqr-neg89.7%
fma-define89.7%
Simplified89.7%
add-sqr-sqrt41.1%
pow241.1%
associate-*r*40.6%
fma-undefine40.6%
+-commutative40.6%
sqrt-prod40.6%
*-commutative40.6%
hypot-1-def44.0%
Applied egg-rr44.0%
*-commutative44.0%
sqrt-prod25.2%
Applied egg-rr25.2%
pow-prod-down21.9%
pow221.9%
swap-sqr21.9%
add-sqr-sqrt46.9%
add-sqr-sqrt89.2%
*-commutative89.2%
associate-/r*89.4%
metadata-eval89.4%
frac-times89.6%
associate-*l/90.1%
*-rgt-identity90.1%
pow290.1%
frac-times93.8%
div-inv93.9%
*-commutative93.9%
associate-/l*98.0%
Applied egg-rr98.0%
Taylor expanded in z around inf 46.9%
Final simplification89.8%
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 (* y (+ 1.0 (* z z)))))
(*
x_s
(if (<= t_0 INFINITY)
(/ (/ 1.0 x_m) t_0)
(/ (/ (/ (/ 1.0 x_m) (hypot 1.0 z)) 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 t_0 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = (((1.0 / x_m) / hypot(1.0, z)) / z) / y;
}
return x_s * tmp;
}
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 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = (((1.0 / x_m) / Math.hypot(1.0, z)) / z) / y;
}
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): t_0 = y * (1.0 + (z * z)) tmp = 0 if t_0 <= math.inf: tmp = (1.0 / x_m) / t_0 else: tmp = (((1.0 / x_m) / math.hypot(1.0, z)) / 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) t_0 = Float64(y * Float64(1.0 + Float64(z * z))) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(Float64(1.0 / x_m) / t_0); else tmp = Float64(Float64(Float64(Float64(1.0 / x_m) / hypot(1.0, z)) / z) / y); 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)
t_0 = y * (1.0 + (z * z));
tmp = 0.0;
if (t_0 <= Inf)
tmp = (1.0 / x_m) / t_0;
else
tmp = (((1.0 / x_m) / hypot(1.0, z)) / z) / y;
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_] := Block[{t$95$0 = N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, Infinity], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / z), $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])\\
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + z \cdot z\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\frac{1}{x\_m}}{\mathsf{hypot}\left(1, z\right)}}{z}}{y}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < +inf.0Initial program 89.8%
if +inf.0 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) Initial program 89.8%
associate-/l/89.3%
associate-*l*89.7%
*-commutative89.7%
sqr-neg89.7%
+-commutative89.7%
sqr-neg89.7%
fma-define89.7%
Simplified89.7%
fma-undefine89.7%
+-commutative89.7%
*-commutative89.7%
associate-*r*89.3%
associate-/l/89.8%
add-sqr-sqrt45.8%
*-un-lft-identity45.8%
times-frac45.8%
*-commutative45.8%
sqrt-prod45.8%
hypot-1-def45.8%
*-commutative45.8%
sqrt-prod46.8%
hypot-1-def50.9%
Applied egg-rr50.9%
*-commutative50.9%
associate-/r*50.1%
associate-/r*50.1%
frac-times48.3%
add-sqr-sqrt93.9%
Applied egg-rr93.9%
Taylor expanded in z around inf 45.6%
associate-/r*45.6%
frac-times45.5%
metadata-eval45.5%
*-commutative45.5%
Applied egg-rr45.5%
associate-/r*45.6%
associate-/l/45.6%
Simplified45.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
(let* ((t_0 (* y (+ 1.0 (* z z)))))
(*
x_s
(if (<= t_0 INFINITY)
(/ (/ 1.0 x_m) t_0)
(/ (* (/ 1.0 z) (/ (/ 1.0 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 t_0 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y;
}
return x_s * tmp;
}
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 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y;
}
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): t_0 = y * (1.0 + (z * z)) tmp = 0 if t_0 <= math.inf: tmp = (1.0 / x_m) / t_0 else: tmp = ((1.0 / z) * ((1.0 / 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) t_0 = Float64(y * Float64(1.0 + Float64(z * z))) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(Float64(1.0 / x_m) / t_0); else tmp = Float64(Float64(Float64(1.0 / z) * Float64(Float64(1.0 / x_m) / z)) / y); 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)
t_0 = y * (1.0 + (z * z));
tmp = 0.0;
if (t_0 <= Inf)
tmp = (1.0 / x_m) / t_0;
else
tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y;
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_] := Block[{t$95$0 = N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, Infinity], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision]), $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])\\
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + z \cdot z\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{x\_m}}{z}}{y}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < +inf.0Initial program 89.8%
if +inf.0 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) Initial program 89.8%
associate-/l/89.3%
associate-*l*89.7%
*-commutative89.7%
sqr-neg89.7%
+-commutative89.7%
sqr-neg89.7%
fma-define89.7%
Simplified89.7%
fma-undefine89.7%
+-commutative89.7%
*-commutative89.7%
associate-*r*89.3%
associate-/l/89.8%
add-sqr-sqrt45.8%
*-un-lft-identity45.8%
times-frac45.8%
*-commutative45.8%
sqrt-prod45.8%
hypot-1-def45.8%
*-commutative45.8%
sqrt-prod46.8%
hypot-1-def50.9%
Applied egg-rr50.9%
*-commutative50.9%
associate-/r*50.1%
associate-/r*50.1%
frac-times48.3%
add-sqr-sqrt93.9%
Applied egg-rr93.9%
Taylor expanded in z around inf 53.8%
associate-/r*54.1%
*-un-lft-identity54.1%
unpow254.1%
times-frac57.9%
Applied egg-rr57.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 430000.0)
(/ (/ 1.0 x_m) y)
(/ (* (/ 1.0 z) (/ (/ 1.0 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 <= 430000.0) {
tmp = (1.0 / x_m) / y;
} else {
tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y;
}
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 <= 430000.0d0) then
tmp = (1.0d0 / x_m) / y
else
tmp = ((1.0d0 / z) * ((1.0d0 / x_m) / z)) / y
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 <= 430000.0) {
tmp = (1.0 / x_m) / y;
} else {
tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y;
}
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 <= 430000.0: tmp = (1.0 / x_m) / y else: tmp = ((1.0 / z) * ((1.0 / 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 (z <= 430000.0) tmp = Float64(Float64(1.0 / x_m) / y); else tmp = Float64(Float64(Float64(1.0 / z) * Float64(Float64(1.0 / x_m) / z)) / y); 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 <= 430000.0)
tmp = (1.0 / x_m) / y;
else
tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y;
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, 430000.0], N[(N[(1.0 / x$95$m), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision]), $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 \begin{array}{l}
\mathbf{if}\;z \leq 430000:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{x\_m}}{z}}{y}\\
\end{array}
\end{array}
if z < 4.3e5Initial program 92.8%
Taylor expanded in z around 0 71.4%
if 4.3e5 < z Initial program 81.0%
associate-/l/80.3%
associate-*l*83.0%
*-commutative83.0%
sqr-neg83.0%
+-commutative83.0%
sqr-neg83.0%
fma-define83.0%
Simplified83.0%
fma-undefine83.0%
+-commutative83.0%
*-commutative83.0%
associate-*r*80.3%
associate-/l/81.0%
add-sqr-sqrt42.7%
*-un-lft-identity42.7%
times-frac42.7%
*-commutative42.7%
sqrt-prod42.7%
hypot-1-def42.7%
*-commutative42.7%
sqrt-prod46.9%
hypot-1-def51.3%
Applied egg-rr51.3%
*-commutative51.3%
associate-/r*48.4%
associate-/r*48.4%
frac-times48.3%
add-sqr-sqrt89.3%
Applied egg-rr89.3%
Taylor expanded in z around inf 82.9%
associate-/r*83.5%
*-un-lft-identity83.5%
unpow283.5%
times-frac89.3%
Applied egg-rr89.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 (if (<= z 430000.0) (/ (/ 1.0 x_m) y) (/ (* (/ 1.0 x_m) (/ 1.0 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 <= 430000.0) {
tmp = (1.0 / x_m) / y;
} else {
tmp = ((1.0 / x_m) * (1.0 / z)) / y;
}
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 <= 430000.0d0) then
tmp = (1.0d0 / x_m) / y
else
tmp = ((1.0d0 / x_m) * (1.0d0 / z)) / y
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 <= 430000.0) {
tmp = (1.0 / x_m) / y;
} else {
tmp = ((1.0 / x_m) * (1.0 / z)) / y;
}
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 <= 430000.0: tmp = (1.0 / x_m) / y else: tmp = ((1.0 / x_m) * (1.0 / 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 (z <= 430000.0) tmp = Float64(Float64(1.0 / x_m) / y); else tmp = Float64(Float64(Float64(1.0 / x_m) * Float64(1.0 / z)) / y); 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 <= 430000.0)
tmp = (1.0 / x_m) / y;
else
tmp = ((1.0 / x_m) * (1.0 / z)) / y;
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, 430000.0], N[(N[(1.0 / x$95$m), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(1.0 / x$95$m), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $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 \begin{array}{l}
\mathbf{if}\;z \leq 430000:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x\_m} \cdot \frac{1}{z}}{y}\\
\end{array}
\end{array}
if z < 4.3e5Initial program 92.8%
Taylor expanded in z around 0 71.4%
if 4.3e5 < z Initial program 81.0%
associate-/l/80.3%
associate-*l*83.0%
*-commutative83.0%
sqr-neg83.0%
+-commutative83.0%
sqr-neg83.0%
fma-define83.0%
Simplified83.0%
fma-undefine83.0%
+-commutative83.0%
*-commutative83.0%
associate-*r*80.3%
associate-/l/81.0%
add-sqr-sqrt42.7%
*-un-lft-identity42.7%
times-frac42.7%
*-commutative42.7%
sqrt-prod42.7%
hypot-1-def42.7%
*-commutative42.7%
sqrt-prod46.9%
hypot-1-def51.3%
Applied egg-rr51.3%
*-commutative51.3%
associate-/r*48.4%
associate-/r*48.4%
frac-times48.3%
add-sqr-sqrt89.3%
Applied egg-rr89.3%
Taylor expanded in z around inf 89.3%
Taylor expanded in z around 0 32.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 (/ (/ 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 89.8%
Taylor expanded in z around 0 56.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 (/ 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 89.8%
associate-/l/89.3%
associate-*l*89.7%
*-commutative89.7%
sqr-neg89.7%
+-commutative89.7%
sqr-neg89.7%
fma-define89.7%
Simplified89.7%
Taylor expanded in z around 0 56.2%
(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 2024103
(FPCore (x y z)
:name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
:precision binary64
:alt
(if (< (* y (+ 1.0 (* z z))) (- INFINITY)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x)) (if (< (* y (+ 1.0 (* z z))) 8.680743250567252e+305) (/ (/ 1.0 x) (* (+ 1.0 (* z z)) y)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x))))
(/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))