
(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 9 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}
z_m = (fabs.f64 z)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
:precision binary64
(let* ((t_0 (* y (+ 1.0 (* z_m z_m)))))
(*
x_s
(if (<= t_0 5e+307)
(/ (/ 1.0 x_m) t_0)
(/ (/ (sqrt (/ 1.0 y)) z_m) (* x_m (* (sqrt y) (hypot 1.0 z_m))))))))z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double t_0 = y * (1.0 + (z_m * z_m));
double tmp;
if (t_0 <= 5e+307) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = (sqrt((1.0 / y)) / z_m) / (x_m * (sqrt(y) * hypot(1.0, z_m)));
}
return x_s * tmp;
}
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
double t_0 = y * (1.0 + (z_m * z_m));
double tmp;
if (t_0 <= 5e+307) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = (Math.sqrt((1.0 / y)) / z_m) / (x_m * (Math.sqrt(y) * Math.hypot(1.0, z_m)));
}
return x_s * tmp;
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): t_0 = y * (1.0 + (z_m * z_m)) tmp = 0 if t_0 <= 5e+307: tmp = (1.0 / x_m) / t_0 else: tmp = (math.sqrt((1.0 / y)) / z_m) / (x_m * (math.sqrt(y) * math.hypot(1.0, z_m))) return x_s * tmp
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) t_0 = Float64(y * Float64(1.0 + Float64(z_m * z_m))) tmp = 0.0 if (t_0 <= 5e+307) tmp = Float64(Float64(1.0 / x_m) / t_0); else tmp = Float64(Float64(sqrt(Float64(1.0 / y)) / z_m) / Float64(x_m * Float64(sqrt(y) * hypot(1.0, z_m)))); end return Float64(x_s * tmp) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp_2 = code(x_s, x_m, y, z_m)
t_0 = y * (1.0 + (z_m * z_m));
tmp = 0.0;
if (t_0 <= 5e+307)
tmp = (1.0 / x_m) / t_0;
else
tmp = (sqrt((1.0 / y)) / z_m) / (x_m * (sqrt(y) * hypot(1.0, z_m)));
end
tmp_2 = x_s * tmp;
end
z_m = N[Abs[z], $MachinePrecision]
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_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := Block[{t$95$0 = N[(y * N[(1.0 + N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, 5e+307], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] / z$95$m), $MachinePrecision] / N[(x$95$m * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + z\_m \cdot z\_m\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\sqrt{\frac{1}{y}}}{z\_m}}{x\_m \cdot \left(\sqrt{y} \cdot \mathsf{hypot}\left(1, z\_m\right)\right)}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 5e307Initial program 94.3%
if 5e307 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) Initial program 61.4%
associate-/l/61.4%
associate-*l*74.1%
*-commutative74.1%
sqr-neg74.1%
+-commutative74.1%
sqr-neg74.1%
fma-define74.1%
Simplified74.1%
associate-*r*73.4%
*-commutative73.4%
associate-/r*73.3%
*-commutative73.3%
associate-/l/73.2%
fma-undefine73.2%
+-commutative73.2%
associate-/r*61.4%
*-un-lft-identity61.4%
add-sqr-sqrt61.4%
times-frac61.4%
+-commutative61.4%
fma-undefine61.4%
*-commutative61.4%
sqrt-prod61.4%
fma-undefine61.4%
+-commutative61.4%
hypot-1-def61.4%
+-commutative61.4%
Applied egg-rr99.5%
associate-/l/99.5%
associate-*r/99.5%
*-rgt-identity99.5%
*-commutative99.5%
associate-/r*99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in z around inf 81.5%
associate-*r/81.6%
*-rgt-identity81.6%
Simplified81.6%
Final simplification92.5%
z_m = (fabs.f64 z) x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z_m) :precision binary64 (* x_s (/ (/ (/ 1.0 (sqrt y)) (hypot 1.0 z_m)) (* x_m (* (sqrt y) (hypot 1.0 z_m))))))
z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
return x_s * (((1.0 / sqrt(y)) / hypot(1.0, z_m)) / (x_m * (sqrt(y) * hypot(1.0, z_m))));
}
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
return x_s * (((1.0 / Math.sqrt(y)) / Math.hypot(1.0, z_m)) / (x_m * (Math.sqrt(y) * Math.hypot(1.0, z_m))));
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): return x_s * (((1.0 / math.sqrt(y)) / math.hypot(1.0, z_m)) / (x_m * (math.sqrt(y) * math.hypot(1.0, z_m))))
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) return Float64(x_s * Float64(Float64(Float64(1.0 / sqrt(y)) / hypot(1.0, z_m)) / Float64(x_m * Float64(sqrt(y) * hypot(1.0, z_m))))) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp = code(x_s, x_m, y, z_m)
tmp = x_s * (((1.0 / sqrt(y)) / hypot(1.0, z_m)) / (x_m * (sqrt(y) * hypot(1.0, z_m))));
end
z_m = N[Abs[z], $MachinePrecision]
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_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := N[(x$95$s * N[(N[(N[(1.0 / N[Sqrt[y], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision]), $MachinePrecision] / N[(x$95$m * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
x\_s \cdot \frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\_m\right)}}{x\_m \cdot \left(\sqrt{y} \cdot \mathsf{hypot}\left(1, z\_m\right)\right)}
\end{array}
Initial program 89.6%
associate-/l/89.6%
associate-*l*89.5%
*-commutative89.5%
sqr-neg89.5%
+-commutative89.5%
sqr-neg89.5%
fma-define89.5%
Simplified89.5%
associate-*r*91.6%
*-commutative91.6%
associate-/r*91.3%
*-commutative91.3%
associate-/l/91.2%
fma-undefine91.2%
+-commutative91.2%
associate-/r*89.6%
*-un-lft-identity89.6%
add-sqr-sqrt43.4%
times-frac43.4%
+-commutative43.4%
fma-undefine43.4%
*-commutative43.4%
sqrt-prod43.4%
fma-undefine43.4%
+-commutative43.4%
hypot-1-def43.4%
+-commutative43.4%
Applied egg-rr48.9%
associate-/l/48.9%
associate-*r/48.9%
*-rgt-identity48.9%
*-commutative48.9%
associate-/r*48.9%
*-commutative48.9%
Simplified48.9%
Final simplification48.9%
z_m = (fabs.f64 z) x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z_m) :precision binary64 (let* ((t_0 (* z_m (sqrt x_m))) (t_1 (* y (+ 1.0 (* z_m z_m))))) (* x_s (if (<= t_1 5e+307) (/ (/ 1.0 x_m) t_1) (/ (/ (/ 1.0 y) t_0) t_0)))))
z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double t_0 = z_m * sqrt(x_m);
double t_1 = y * (1.0 + (z_m * z_m));
double tmp;
if (t_1 <= 5e+307) {
tmp = (1.0 / x_m) / t_1;
} else {
tmp = ((1.0 / y) / t_0) / t_0;
}
return x_s * tmp;
}
z_m = abs(z)
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z_m * sqrt(x_m)
t_1 = y * (1.0d0 + (z_m * z_m))
if (t_1 <= 5d+307) then
tmp = (1.0d0 / x_m) / t_1
else
tmp = ((1.0d0 / y) / t_0) / t_0
end if
code = x_s * tmp
end function
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
double t_0 = z_m * Math.sqrt(x_m);
double t_1 = y * (1.0 + (z_m * z_m));
double tmp;
if (t_1 <= 5e+307) {
tmp = (1.0 / x_m) / t_1;
} else {
tmp = ((1.0 / y) / t_0) / t_0;
}
return x_s * tmp;
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): t_0 = z_m * math.sqrt(x_m) t_1 = y * (1.0 + (z_m * z_m)) tmp = 0 if t_1 <= 5e+307: tmp = (1.0 / x_m) / t_1 else: tmp = ((1.0 / y) / t_0) / t_0 return x_s * tmp
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) t_0 = Float64(z_m * sqrt(x_m)) t_1 = Float64(y * Float64(1.0 + Float64(z_m * z_m))) tmp = 0.0 if (t_1 <= 5e+307) tmp = Float64(Float64(1.0 / x_m) / t_1); else tmp = Float64(Float64(Float64(1.0 / y) / t_0) / t_0); end return Float64(x_s * tmp) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp_2 = code(x_s, x_m, y, z_m)
t_0 = z_m * sqrt(x_m);
t_1 = y * (1.0 + (z_m * z_m));
tmp = 0.0;
if (t_1 <= 5e+307)
tmp = (1.0 / x_m) / t_1;
else
tmp = ((1.0 / y) / t_0) / t_0;
end
tmp_2 = x_s * tmp;
end
z_m = N[Abs[z], $MachinePrecision]
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_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := Block[{t$95$0 = N[(z$95$m * N[Sqrt[x$95$m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(1.0 + N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$1, 5e+307], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(N[(1.0 / y), $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
\begin{array}{l}
t_0 := z\_m \cdot \sqrt{x\_m}\\
t_1 := y \cdot \left(1 + z\_m \cdot z\_m\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{y}}{t\_0}}{t\_0}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 5e307Initial program 94.3%
if 5e307 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) Initial program 61.4%
associate-/l/61.4%
associate-*l*74.1%
*-commutative74.1%
sqr-neg74.1%
+-commutative74.1%
sqr-neg74.1%
fma-define74.1%
Simplified74.1%
associate-*r*73.4%
*-commutative73.4%
*-commutative73.4%
add-sqr-sqrt70.8%
pow270.8%
sqrt-div48.8%
metadata-eval48.8%
sqrt-prod48.9%
fma-undefine48.9%
+-commutative48.9%
hypot-1-def54.3%
Applied egg-rr54.3%
Taylor expanded in z around inf 54.3%
metadata-eval54.3%
pow154.3%
metadata-eval54.3%
sqrt-pow148.9%
sqrt-prod48.8%
*-commutative48.8%
associate-*r*49.5%
sqrt-div71.5%
pow271.5%
add-sqr-sqrt74.1%
associate-/r*74.3%
add-sqr-sqrt49.6%
associate-/r*49.6%
*-commutative49.6%
sqrt-prod49.6%
sqrt-pow141.8%
metadata-eval41.8%
pow141.8%
Applied egg-rr70.0%
z_m = (fabs.f64 z)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
:precision binary64
(*
x_s
(if (<= (* z_m z_m) 4e+298)
(/ 1.0 (* y (* x_m (fma z_m z_m 1.0))))
(* (/ 1.0 (* y z_m)) (/ (/ 1.0 (hypot 1.0 z_m)) x_m)))))z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 4e+298) {
tmp = 1.0 / (y * (x_m * fma(z_m, z_m, 1.0)));
} else {
tmp = (1.0 / (y * z_m)) * ((1.0 / hypot(1.0, z_m)) / x_m);
}
return x_s * tmp;
}
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) tmp = 0.0 if (Float64(z_m * z_m) <= 4e+298) tmp = Float64(1.0 / Float64(y * Float64(x_m * fma(z_m, z_m, 1.0)))); else tmp = Float64(Float64(1.0 / Float64(y * z_m)) * Float64(Float64(1.0 / hypot(1.0, z_m)) / x_m)); end return Float64(x_s * tmp) end
z_m = N[Abs[z], $MachinePrecision]
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_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := N[(x$95$s * If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 4e+298], N[(1.0 / N[(y * N[(x$95$m * N[(z$95$m * z$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(y * z$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision]), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 4 \cdot 10^{+298}:\\
\;\;\;\;\frac{1}{y \cdot \left(x\_m \cdot \mathsf{fma}\left(z\_m, z\_m, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y \cdot z\_m} \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\_m\right)}}{x\_m}\\
\end{array}
\end{array}
if (*.f64 z z) < 3.9999999999999998e298Initial program 95.7%
associate-/l/95.7%
associate-*l*95.6%
*-commutative95.6%
sqr-neg95.6%
+-commutative95.6%
sqr-neg95.6%
fma-define95.6%
Simplified95.6%
if 3.9999999999999998e298 < (*.f64 z z) Initial program 70.9%
associate-/l/70.9%
associate-*l*70.9%
*-commutative70.9%
sqr-neg70.9%
+-commutative70.9%
sqr-neg70.9%
fma-define70.9%
Simplified70.9%
add-sqr-sqrt41.7%
pow241.7%
*-commutative41.7%
sqrt-prod41.7%
fma-undefine41.7%
+-commutative41.7%
hypot-1-def49.2%
Applied egg-rr49.2%
*-commutative49.2%
unpow249.2%
swap-sqr41.7%
pow241.7%
add-sqr-sqrt70.9%
associate-*l*70.3%
pow270.3%
hypot-undefine70.3%
metadata-eval70.3%
unpow270.3%
hypot-undefine70.3%
metadata-eval70.3%
unpow270.3%
add-sqr-sqrt70.3%
+-commutative70.3%
unpow270.3%
fma-undefine70.3%
*-commutative70.3%
Applied egg-rr97.9%
Taylor expanded in z around inf 81.2%
z_m = (fabs.f64 z)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
:precision binary64
(*
x_s
(if (<= (* z_m z_m) 1e+30)
(/ (/ 1.0 x_m) (* y (+ 1.0 (* z_m z_m))))
(/ (* (/ 1.0 z_m) (/ (/ 1.0 x_m) z_m)) y))))z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 1e+30) {
tmp = (1.0 / x_m) / (y * (1.0 + (z_m * z_m)));
} else {
tmp = ((1.0 / z_m) * ((1.0 / x_m) / z_m)) / y;
}
return x_s * tmp;
}
z_m = abs(z)
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((z_m * z_m) <= 1d+30) then
tmp = (1.0d0 / x_m) / (y * (1.0d0 + (z_m * z_m)))
else
tmp = ((1.0d0 / z_m) * ((1.0d0 / x_m) / z_m)) / y
end if
code = x_s * tmp
end function
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 1e+30) {
tmp = (1.0 / x_m) / (y * (1.0 + (z_m * z_m)));
} else {
tmp = ((1.0 / z_m) * ((1.0 / x_m) / z_m)) / y;
}
return x_s * tmp;
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): tmp = 0 if (z_m * z_m) <= 1e+30: tmp = (1.0 / x_m) / (y * (1.0 + (z_m * z_m))) else: tmp = ((1.0 / z_m) * ((1.0 / x_m) / z_m)) / y return x_s * tmp
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) tmp = 0.0 if (Float64(z_m * z_m) <= 1e+30) tmp = Float64(Float64(1.0 / x_m) / Float64(y * Float64(1.0 + Float64(z_m * z_m)))); else tmp = Float64(Float64(Float64(1.0 / z_m) * Float64(Float64(1.0 / x_m) / z_m)) / y); end return Float64(x_s * tmp) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp_2 = code(x_s, x_m, y, z_m)
tmp = 0.0;
if ((z_m * z_m) <= 1e+30)
tmp = (1.0 / x_m) / (y * (1.0 + (z_m * z_m)));
else
tmp = ((1.0 / z_m) * ((1.0 / x_m) / z_m)) / y;
end
tmp_2 = x_s * tmp;
end
z_m = N[Abs[z], $MachinePrecision]
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_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := N[(x$95$s * If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 1e+30], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(y * N[(1.0 + N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z$95$m), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 10^{+30}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y \cdot \left(1 + z\_m \cdot z\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z\_m} \cdot \frac{\frac{1}{x\_m}}{z\_m}}{y}\\
\end{array}
\end{array}
if (*.f64 z z) < 1e30Initial program 99.7%
if 1e30 < (*.f64 z z) Initial program 79.0%
associate-/l/79.0%
associate-*l*78.9%
*-commutative78.9%
sqr-neg78.9%
+-commutative78.9%
sqr-neg78.9%
fma-define78.9%
Simplified78.9%
associate-*r*83.0%
*-commutative83.0%
*-commutative83.0%
add-sqr-sqrt66.3%
pow266.3%
sqrt-div40.9%
metadata-eval40.9%
sqrt-prod40.9%
fma-undefine40.9%
+-commutative40.9%
hypot-1-def44.2%
Applied egg-rr44.2%
Taylor expanded in z around inf 44.2%
metadata-eval44.2%
pow144.2%
metadata-eval44.2%
sqrt-pow140.9%
sqrt-prod40.9%
*-commutative40.9%
associate-*r*37.4%
sqrt-div63.0%
pow263.0%
add-sqr-sqrt78.9%
*-commutative78.9%
associate-/r*79.1%
Applied egg-rr79.1%
associate-/r*79.5%
*-un-lft-identity79.5%
unpow279.5%
times-frac87.3%
Applied egg-rr87.3%
z_m = (fabs.f64 z)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
:precision binary64
(*
x_s
(if (<= (* z_m z_m) 4e-6)
(/ (/ 1.0 x_m) y)
(/ (* (/ 1.0 z_m) (/ (/ 1.0 x_m) z_m)) y))))z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 4e-6) {
tmp = (1.0 / x_m) / y;
} else {
tmp = ((1.0 / z_m) * ((1.0 / x_m) / z_m)) / y;
}
return x_s * tmp;
}
z_m = abs(z)
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((z_m * z_m) <= 4d-6) then
tmp = (1.0d0 / x_m) / y
else
tmp = ((1.0d0 / z_m) * ((1.0d0 / x_m) / z_m)) / y
end if
code = x_s * tmp
end function
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 4e-6) {
tmp = (1.0 / x_m) / y;
} else {
tmp = ((1.0 / z_m) * ((1.0 / x_m) / z_m)) / y;
}
return x_s * tmp;
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): tmp = 0 if (z_m * z_m) <= 4e-6: tmp = (1.0 / x_m) / y else: tmp = ((1.0 / z_m) * ((1.0 / x_m) / z_m)) / y return x_s * tmp
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) tmp = 0.0 if (Float64(z_m * z_m) <= 4e-6) tmp = Float64(Float64(1.0 / x_m) / y); else tmp = Float64(Float64(Float64(1.0 / z_m) * Float64(Float64(1.0 / x_m) / z_m)) / y); end return Float64(x_s * tmp) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp_2 = code(x_s, x_m, y, z_m)
tmp = 0.0;
if ((z_m * z_m) <= 4e-6)
tmp = (1.0 / x_m) / y;
else
tmp = ((1.0 / z_m) * ((1.0 / x_m) / z_m)) / y;
end
tmp_2 = x_s * tmp;
end
z_m = N[Abs[z], $MachinePrecision]
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_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := N[(x$95$s * If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 4e-6], N[(N[(1.0 / x$95$m), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(1.0 / z$95$m), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 4 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z\_m} \cdot \frac{\frac{1}{x\_m}}{z\_m}}{y}\\
\end{array}
\end{array}
if (*.f64 z z) < 3.99999999999999982e-6Initial program 99.7%
Taylor expanded in z around 0 99.3%
if 3.99999999999999982e-6 < (*.f64 z z) Initial program 79.9%
associate-/l/79.9%
associate-*l*79.8%
*-commutative79.8%
sqr-neg79.8%
+-commutative79.8%
sqr-neg79.8%
fma-define79.8%
Simplified79.8%
associate-*r*83.8%
*-commutative83.8%
*-commutative83.8%
add-sqr-sqrt67.8%
pow267.8%
sqrt-div43.6%
metadata-eval43.6%
sqrt-prod43.6%
fma-undefine43.6%
+-commutative43.6%
hypot-1-def46.8%
Applied egg-rr46.8%
Taylor expanded in z around inf 46.8%
metadata-eval46.8%
pow146.8%
metadata-eval46.8%
sqrt-pow143.6%
sqrt-prod43.6%
*-commutative43.6%
associate-*r*40.2%
sqrt-div64.6%
pow264.6%
add-sqr-sqrt79.8%
*-commutative79.8%
associate-/r*80.0%
Applied egg-rr80.0%
associate-/r*80.4%
*-un-lft-identity80.4%
unpow280.4%
times-frac87.9%
Applied egg-rr87.9%
z_m = (fabs.f64 z)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
:precision binary64
(*
x_s
(if (<= (* z_m z_m) 1.0)
(/ (/ 1.0 x_m) y)
(/ (/ 1.0 (* x_m (* z_m z_m))) y))))z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 1.0) {
tmp = (1.0 / x_m) / y;
} else {
tmp = (1.0 / (x_m * (z_m * z_m))) / y;
}
return x_s * tmp;
}
z_m = abs(z)
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((z_m * z_m) <= 1.0d0) then
tmp = (1.0d0 / x_m) / y
else
tmp = (1.0d0 / (x_m * (z_m * z_m))) / y
end if
code = x_s * tmp
end function
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 1.0) {
tmp = (1.0 / x_m) / y;
} else {
tmp = (1.0 / (x_m * (z_m * z_m))) / y;
}
return x_s * tmp;
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): tmp = 0 if (z_m * z_m) <= 1.0: tmp = (1.0 / x_m) / y else: tmp = (1.0 / (x_m * (z_m * z_m))) / y return x_s * tmp
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) tmp = 0.0 if (Float64(z_m * z_m) <= 1.0) tmp = Float64(Float64(1.0 / x_m) / y); else tmp = Float64(Float64(1.0 / Float64(x_m * Float64(z_m * z_m))) / y); end return Float64(x_s * tmp) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp_2 = code(x_s, x_m, y, z_m)
tmp = 0.0;
if ((z_m * z_m) <= 1.0)
tmp = (1.0 / x_m) / y;
else
tmp = (1.0 / (x_m * (z_m * z_m))) / y;
end
tmp_2 = x_s * tmp;
end
z_m = N[Abs[z], $MachinePrecision]
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_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := N[(x$95$s * If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 1.0], N[(N[(1.0 / x$95$m), $MachinePrecision] / y), $MachinePrecision], N[(N[(1.0 / N[(x$95$m * N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 1:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x\_m \cdot \left(z\_m \cdot z\_m\right)}}{y}\\
\end{array}
\end{array}
if (*.f64 z z) < 1Initial program 99.7%
Taylor expanded in z around 0 99.3%
if 1 < (*.f64 z z) Initial program 79.9%
associate-/l/79.9%
associate-*l*79.8%
*-commutative79.8%
sqr-neg79.8%
+-commutative79.8%
sqr-neg79.8%
fma-define79.8%
Simplified79.8%
associate-*r*83.8%
*-commutative83.8%
*-commutative83.8%
add-sqr-sqrt67.8%
pow267.8%
sqrt-div43.6%
metadata-eval43.6%
sqrt-prod43.6%
fma-undefine43.6%
+-commutative43.6%
hypot-1-def46.8%
Applied egg-rr46.8%
Taylor expanded in z around inf 46.8%
metadata-eval46.8%
pow146.8%
metadata-eval46.8%
sqrt-pow143.6%
sqrt-prod43.6%
*-commutative43.6%
associate-*r*40.2%
sqrt-div64.6%
pow264.6%
add-sqr-sqrt79.8%
*-commutative79.8%
associate-/r*80.0%
Applied egg-rr80.0%
unpow280.0%
Applied egg-rr80.0%
z_m = (fabs.f64 z)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
:precision binary64
(*
x_s
(if (<= (* z_m z_m) 1.0)
(/ (/ 1.0 x_m) y)
(/ 1.0 (* y (* x_m (* z_m z_m)))))))z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 1.0) {
tmp = (1.0 / x_m) / y;
} else {
tmp = 1.0 / (y * (x_m * (z_m * z_m)));
}
return x_s * tmp;
}
z_m = abs(z)
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((z_m * z_m) <= 1.0d0) then
tmp = (1.0d0 / x_m) / y
else
tmp = 1.0d0 / (y * (x_m * (z_m * z_m)))
end if
code = x_s * tmp
end function
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 1.0) {
tmp = (1.0 / x_m) / y;
} else {
tmp = 1.0 / (y * (x_m * (z_m * z_m)));
}
return x_s * tmp;
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): tmp = 0 if (z_m * z_m) <= 1.0: tmp = (1.0 / x_m) / y else: tmp = 1.0 / (y * (x_m * (z_m * z_m))) return x_s * tmp
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) tmp = 0.0 if (Float64(z_m * z_m) <= 1.0) tmp = Float64(Float64(1.0 / x_m) / y); else tmp = Float64(1.0 / Float64(y * Float64(x_m * Float64(z_m * z_m)))); end return Float64(x_s * tmp) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp_2 = code(x_s, x_m, y, z_m)
tmp = 0.0;
if ((z_m * z_m) <= 1.0)
tmp = (1.0 / x_m) / y;
else
tmp = 1.0 / (y * (x_m * (z_m * z_m)));
end
tmp_2 = x_s * tmp;
end
z_m = N[Abs[z], $MachinePrecision]
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_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := N[(x$95$s * If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 1.0], N[(N[(1.0 / x$95$m), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(y * N[(x$95$m * N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 1:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y \cdot \left(x\_m \cdot \left(z\_m \cdot z\_m\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 1Initial program 99.7%
Taylor expanded in z around 0 99.3%
if 1 < (*.f64 z z) Initial program 79.9%
associate-/l/79.9%
associate-*l*79.8%
*-commutative79.8%
sqr-neg79.8%
+-commutative79.8%
sqr-neg79.8%
fma-define79.8%
Simplified79.8%
Taylor expanded in z around inf 79.8%
unpow280.0%
Applied egg-rr79.8%
z_m = (fabs.f64 z) x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z_m) :precision binary64 (* x_s (/ 1.0 (* y x_m))))
z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
return x_s * (1.0 / (y * x_m));
}
z_m = abs(z)
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
code = x_s * (1.0d0 / (y * x_m))
end function
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
return x_s * (1.0 / (y * x_m));
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): return x_s * (1.0 / (y * x_m))
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) return Float64(x_s * Float64(1.0 / Float64(y * x_m))) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp = code(x_s, x_m, y, z_m)
tmp = x_s * (1.0 / (y * x_m));
end
z_m = N[Abs[z], $MachinePrecision]
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_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := N[(x$95$s * N[(1.0 / N[(y * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
x\_s \cdot \frac{1}{y \cdot x\_m}
\end{array}
Initial program 89.6%
associate-/l/89.6%
associate-*l*89.5%
*-commutative89.5%
sqr-neg89.5%
+-commutative89.5%
sqr-neg89.5%
fma-define89.5%
Simplified89.5%
Taylor expanded in z around 0 56.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 2024118
(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)))))