
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (pow (/ (pow x_m -0.5) (* (hypot 1.0 z) (sqrt y_m))) 2.0))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * pow((pow(x_m, -0.5) / (hypot(1.0, z) * sqrt(y_m))), 2.0));
}
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * Math.pow((Math.pow(x_m, -0.5) / (Math.hypot(1.0, z) * Math.sqrt(y_m))), 2.0));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * math.pow((math.pow(x_m, -0.5) / (math.hypot(1.0, z) * math.sqrt(y_m))), 2.0))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * (Float64((x_m ^ -0.5) / Float64(hypot(1.0, z) * sqrt(y_m))) ^ 2.0))) end
x_m = abs(x); x_s = sign(x) * abs(1.0); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp = code(y_s, x_s, x_m, y_m, z) tmp = y_s * (x_s * (((x_m ^ -0.5) / (hypot(1.0, z) * sqrt(y_m))) ^ 2.0)); end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[Power[N[(N[Power[x$95$m, -0.5], $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot {\left(\frac{{x\_m}^{-0.5}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y\_m}}\right)}^{2}\right)
\end{array}
Initial program 89.8%
associate-/l/89.7%
metadata-eval89.7%
associate-*r/89.7%
associate-/l/89.8%
associate-*r/89.8%
associate-/l*89.3%
associate-/r/89.7%
/-rgt-identity89.7%
associate-*l*90.4%
*-commutative90.4%
sqr-neg90.4%
+-commutative90.4%
sqr-neg90.4%
fma-def90.4%
Simplified90.4%
fma-udef90.4%
+-commutative90.4%
*-commutative90.4%
associate-*l*89.7%
associate-/l/89.8%
add-sqr-sqrt58.2%
sqrt-div19.3%
inv-pow19.3%
sqrt-pow119.3%
metadata-eval19.3%
*-commutative19.3%
sqrt-prod19.3%
hypot-1-def19.3%
sqrt-div19.3%
inv-pow19.3%
sqrt-pow119.2%
metadata-eval19.2%
*-commutative19.2%
Applied egg-rr22.1%
unpow222.1%
Simplified22.1%
Final simplification22.1%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ (/ (/ (/ 1.0 x_m) (hypot 1.0 z)) (hypot 1.0 z)) y_m))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((((1.0 / x_m) / hypot(1.0, z)) / hypot(1.0, z)) / y_m));
}
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((((1.0 / x_m) / Math.hypot(1.0, z)) / Math.hypot(1.0, z)) / y_m));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * ((((1.0 / x_m) / math.hypot(1.0, z)) / math.hypot(1.0, z)) / y_m))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(Float64(Float64(Float64(1.0 / x_m) / hypot(1.0, z)) / hypot(1.0, z)) / y_m))) end
x_m = abs(x); x_s = sign(x) * abs(1.0); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp = code(y_s, x_s, x_m, y_m, z) tmp = y_s * (x_s * ((((1.0 / x_m) / hypot(1.0, z)) / hypot(1.0, z)) / y_m)); end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \frac{\frac{\frac{\frac{1}{x\_m}}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right)}}{y\_m}\right)
\end{array}
Initial program 89.8%
associate-/l/89.7%
metadata-eval89.7%
associate-*r/89.7%
associate-/l/89.8%
associate-*r/89.8%
associate-/l*89.3%
associate-/r/89.7%
/-rgt-identity89.7%
associate-*l*90.4%
*-commutative90.4%
sqr-neg90.4%
+-commutative90.4%
sqr-neg90.4%
fma-def90.4%
Simplified90.4%
fma-udef90.4%
+-commutative90.4%
*-commutative90.4%
associate-*l*89.7%
associate-/l/89.8%
add-sqr-sqrt58.2%
sqrt-div19.3%
inv-pow19.3%
sqrt-pow119.3%
metadata-eval19.3%
*-commutative19.3%
sqrt-prod19.3%
hypot-1-def19.3%
sqrt-div19.3%
inv-pow19.3%
sqrt-pow119.2%
metadata-eval19.2%
*-commutative19.2%
Applied egg-rr22.1%
unpow222.1%
Simplified22.1%
unpow222.1%
associate-/r*22.1%
associate-/r*22.1%
frac-times20.6%
add-sqr-sqrt48.0%
Applied egg-rr48.0%
associate-*r/48.0%
associate-*l/48.0%
pow-sqr94.5%
metadata-eval94.5%
unpow-194.5%
Simplified94.5%
Final simplification94.5%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 1e+15)
(/ (/ 1.0 x_m) (* y_m (+ 1.0 (* z z))))
(if (<= (* z z) 5e+305)
(/ 1.0 (* y_m (* x_m (pow z 2.0))))
(/ (* (/ 1.0 z) (/ (/ 1.0 y_m) z)) x_m))))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 1e+15) {
tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)));
} else if ((z * z) <= 5e+305) {
tmp = 1.0 / (y_m * (x_m * pow(z, 2.0)));
} else {
tmp = ((1.0 / z) * ((1.0 / y_m) / z)) / x_m;
}
return y_s * (x_s * tmp);
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 1d+15) then
tmp = (1.0d0 / x_m) / (y_m * (1.0d0 + (z * z)))
else if ((z * z) <= 5d+305) then
tmp = 1.0d0 / (y_m * (x_m * (z ** 2.0d0)))
else
tmp = ((1.0d0 / z) * ((1.0d0 / y_m) / z)) / x_m
end if
code = y_s * (x_s * tmp)
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 1e+15) {
tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)));
} else if ((z * z) <= 5e+305) {
tmp = 1.0 / (y_m * (x_m * Math.pow(z, 2.0)));
} else {
tmp = ((1.0 / z) * ((1.0 / y_m) / z)) / x_m;
}
return y_s * (x_s * tmp);
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if (z * z) <= 1e+15: tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z))) elif (z * z) <= 5e+305: tmp = 1.0 / (y_m * (x_m * math.pow(z, 2.0))) else: tmp = ((1.0 / z) * ((1.0 / y_m) / z)) / x_m return y_s * (x_s * tmp)
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 1e+15) tmp = Float64(Float64(1.0 / x_m) / Float64(y_m * Float64(1.0 + Float64(z * z)))); elseif (Float64(z * z) <= 5e+305) tmp = Float64(1.0 / Float64(y_m * Float64(x_m * (z ^ 2.0)))); else tmp = Float64(Float64(Float64(1.0 / z) * Float64(Float64(1.0 / y_m) / z)) / x_m); end return Float64(y_s * Float64(x_s * tmp)) end
x_m = abs(x); x_s = sign(x) * abs(1.0); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_s, x_m, y_m, z) tmp = 0.0; if ((z * z) <= 1e+15) tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z))); elseif ((z * z) <= 5e+305) tmp = 1.0 / (y_m * (x_m * (z ^ 2.0))); else tmp = ((1.0 / z) * ((1.0 / y_m) / z)) / x_m; end tmp_2 = y_s * (x_s * tmp); end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 1e+15], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(y$95$m * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+305], N[(1.0 / N[(y$95$m * N[(x$95$m * N[Power[z, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / y$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / x$95$m), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+15}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y\_m \cdot \left(1 + z \cdot z\right)}\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+305}:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x\_m \cdot {z}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{y\_m}}{z}}{x\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 1e15Initial program 99.0%
if 1e15 < (*.f64 z z) < 5.00000000000000009e305Initial program 88.1%
associate-/l/88.1%
metadata-eval88.1%
associate-*r/88.1%
associate-/l/88.1%
associate-*r/88.1%
associate-/l*88.1%
associate-/r/88.1%
/-rgt-identity88.1%
associate-*l*91.1%
*-commutative91.1%
sqr-neg91.1%
+-commutative91.1%
sqr-neg91.1%
fma-def91.1%
Simplified91.1%
Taylor expanded in z around inf 91.1%
if 5.00000000000000009e305 < (*.f64 z z) Initial program 72.0%
distribute-rgt-in72.0%
*-un-lft-identity72.0%
flip-+1.6%
pow21.6%
*-commutative1.6%
pow21.6%
*-commutative1.6%
pow21.6%
*-commutative1.6%
pow21.6%
Applied egg-rr1.6%
unpow21.6%
associate-*l*1.6%
distribute-lft-out--1.6%
*-commutative1.6%
associate-*r*1.6%
pow-sqr1.6%
metadata-eval1.6%
*-commutative1.6%
Simplified1.6%
div-inv1.6%
*-commutative1.6%
Applied egg-rr1.6%
associate-*l/1.6%
*-lft-identity1.6%
associate-/r/1.6%
associate-/r*1.6%
*-commutative1.6%
cancel-sign-sub-inv1.6%
*-lft-identity1.6%
mul-1-neg1.6%
distribute-rgt-in1.6%
mul-1-neg1.6%
sub-neg1.6%
Simplified1.6%
Taylor expanded in z around inf 72.0%
associate-/r*72.0%
*-un-lft-identity72.0%
unpow272.0%
times-frac85.3%
Applied egg-rr85.3%
Final simplification93.8%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* y_m (+ 1.0 (* z z))) 1e+305)
(/ (/ 1.0 (* x_m (+ 1.0 (pow z 2.0)))) y_m)
(/ (/ (/ 1.0 (* x_m z)) (hypot 1.0 z)) y_m)))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((y_m * (1.0 + (z * z))) <= 1e+305) {
tmp = (1.0 / (x_m * (1.0 + pow(z, 2.0)))) / y_m;
} else {
tmp = ((1.0 / (x_m * z)) / hypot(1.0, z)) / y_m;
}
return y_s * (x_s * tmp);
}
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((y_m * (1.0 + (z * z))) <= 1e+305) {
tmp = (1.0 / (x_m * (1.0 + Math.pow(z, 2.0)))) / y_m;
} else {
tmp = ((1.0 / (x_m * z)) / Math.hypot(1.0, z)) / y_m;
}
return y_s * (x_s * tmp);
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if (y_m * (1.0 + (z * z))) <= 1e+305: tmp = (1.0 / (x_m * (1.0 + math.pow(z, 2.0)))) / y_m else: tmp = ((1.0 / (x_m * z)) / math.hypot(1.0, z)) / y_m return y_s * (x_s * tmp)
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(y_m * Float64(1.0 + Float64(z * z))) <= 1e+305) tmp = Float64(Float64(1.0 / Float64(x_m * Float64(1.0 + (z ^ 2.0)))) / y_m); else tmp = Float64(Float64(Float64(1.0 / Float64(x_m * z)) / hypot(1.0, z)) / y_m); end return Float64(y_s * Float64(x_s * tmp)) end
x_m = abs(x); x_s = sign(x) * abs(1.0); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_s, x_m, y_m, z) tmp = 0.0; if ((y_m * (1.0 + (z * z))) <= 1e+305) tmp = (1.0 / (x_m * (1.0 + (z ^ 2.0)))) / y_m; else tmp = ((1.0 / (x_m * z)) / hypot(1.0, z)) / y_m; end tmp_2 = y_s * (x_s * tmp); end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(y$95$m * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+305], N[(N[(1.0 / N[(x$95$m * N[(1.0 + N[Power[z, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(N[(1.0 / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \cdot \left(1 + z \cdot z\right) \leq 10^{+305}:\\
\;\;\;\;\frac{\frac{1}{x\_m \cdot \left(1 + {z}^{2}\right)}}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{x\_m \cdot z}}{\mathsf{hypot}\left(1, z\right)}}{y\_m}\\
\end{array}\right)
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 9.9999999999999994e304Initial program 93.6%
associate-/l/93.4%
metadata-eval93.4%
associate-*r/93.4%
associate-/l/93.6%
associate-*r/93.6%
associate-/l*92.9%
associate-/r/93.4%
/-rgt-identity93.4%
associate-*l*92.5%
*-commutative92.5%
sqr-neg92.5%
+-commutative92.5%
sqr-neg92.5%
fma-def92.5%
Simplified92.5%
fma-udef92.5%
+-commutative92.5%
*-commutative92.5%
associate-*l*93.4%
associate-/l/93.6%
add-sqr-sqrt55.9%
sqrt-div15.3%
inv-pow15.3%
sqrt-pow115.3%
metadata-eval15.3%
*-commutative15.3%
sqrt-prod15.3%
hypot-1-def15.3%
sqrt-div15.3%
inv-pow15.3%
sqrt-pow115.2%
metadata-eval15.2%
*-commutative15.2%
Applied egg-rr15.2%
unpow215.2%
Simplified15.2%
unpow215.2%
associate-/r*15.2%
associate-/r*15.2%
frac-times14.3%
add-sqr-sqrt46.9%
Applied egg-rr46.9%
associate-*r/46.9%
associate-*l/46.9%
pow-sqr95.5%
metadata-eval95.5%
unpow-195.5%
Simplified95.5%
Taylor expanded in x around 0 92.7%
if 9.9999999999999994e304 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 70.3%
associate-/l/70.3%
metadata-eval70.3%
associate-*r/70.3%
associate-/l/70.3%
associate-*r/70.3%
associate-/l*70.3%
associate-/r/70.3%
/-rgt-identity70.3%
associate-*l*79.2%
*-commutative79.2%
sqr-neg79.2%
+-commutative79.2%
sqr-neg79.2%
fma-def79.2%
Simplified79.2%
fma-udef79.2%
+-commutative79.2%
*-commutative79.2%
associate-*l*70.3%
associate-/l/70.3%
add-sqr-sqrt70.3%
sqrt-div40.3%
inv-pow40.3%
sqrt-pow140.3%
metadata-eval40.3%
*-commutative40.3%
sqrt-prod40.3%
hypot-1-def40.3%
sqrt-div40.3%
inv-pow40.3%
sqrt-pow140.3%
metadata-eval40.3%
*-commutative40.3%
Applied egg-rr58.3%
unpow258.3%
Simplified58.3%
unpow258.3%
associate-/r*58.3%
associate-/r*58.3%
frac-times53.7%
add-sqr-sqrt53.7%
Applied egg-rr53.7%
associate-*r/53.7%
associate-*l/53.7%
pow-sqr89.3%
metadata-eval89.3%
unpow-189.3%
Simplified89.3%
Taylor expanded in z around inf 79.1%
Final simplification90.5%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 2e+29)
(* (/ 1.0 (* x_m y_m)) (/ 1.0 (fma z z 1.0)))
(/ (/ (/ 1.0 (* x_m z)) (hypot 1.0 z)) y_m)))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 2e+29) {
tmp = (1.0 / (x_m * y_m)) * (1.0 / fma(z, z, 1.0));
} else {
tmp = ((1.0 / (x_m * z)) / hypot(1.0, z)) / y_m;
}
return y_s * (x_s * tmp);
}
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 2e+29) tmp = Float64(Float64(1.0 / Float64(x_m * y_m)) * Float64(1.0 / fma(z, z, 1.0))); else tmp = Float64(Float64(Float64(1.0 / Float64(x_m * z)) / hypot(1.0, z)) / y_m); end return Float64(y_s * Float64(x_s * tmp)) end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 2e+29], N[(N[(1.0 / N[(x$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+29}:\\
\;\;\;\;\frac{1}{x\_m \cdot y\_m} \cdot \frac{1}{\mathsf{fma}\left(z, z, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{x\_m \cdot z}}{\mathsf{hypot}\left(1, z\right)}}{y\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 1.99999999999999983e29Initial program 99.0%
associate-/l/98.7%
metadata-eval98.7%
associate-*r/98.7%
associate-/l/99.0%
associate-*r/99.0%
associate-/l*97.9%
associate-/r/98.7%
/-rgt-identity98.7%
associate-*l*98.7%
*-commutative98.7%
sqr-neg98.7%
+-commutative98.7%
sqr-neg98.7%
fma-def98.7%
Simplified98.7%
fma-udef98.7%
+-commutative98.7%
*-commutative98.7%
associate-*l*98.7%
associate-/l/99.0%
*-commutative99.0%
*-un-lft-identity99.0%
times-frac99.0%
+-commutative99.0%
fma-udef99.0%
associate-/l/99.2%
*-commutative99.2%
Applied egg-rr99.2%
if 1.99999999999999983e29 < (*.f64 z z) Initial program 79.2%
associate-/l/79.2%
metadata-eval79.2%
associate-*r/79.2%
associate-/l/79.2%
associate-*r/79.2%
associate-/l*79.1%
associate-/r/79.2%
/-rgt-identity79.2%
associate-*l*80.6%
*-commutative80.6%
sqr-neg80.6%
+-commutative80.6%
sqr-neg80.6%
fma-def80.6%
Simplified80.6%
fma-udef80.6%
+-commutative80.6%
*-commutative80.6%
associate-*l*79.2%
associate-/l/79.2%
add-sqr-sqrt64.7%
sqrt-div22.5%
inv-pow22.5%
sqrt-pow122.4%
metadata-eval22.4%
*-commutative22.4%
sqrt-prod22.4%
hypot-1-def22.4%
sqrt-div22.4%
inv-pow22.4%
sqrt-pow122.4%
metadata-eval22.4%
*-commutative22.4%
Applied egg-rr28.7%
unpow228.7%
Simplified28.7%
unpow228.7%
associate-/r*28.7%
associate-/r*28.7%
frac-times25.5%
add-sqr-sqrt47.7%
Applied egg-rr47.7%
associate-*r/47.7%
associate-*l/47.6%
pow-sqr89.3%
metadata-eval89.3%
unpow-189.3%
Simplified89.3%
Taylor expanded in z around inf 70.5%
Final simplification86.0%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 5e+305)
(/ (/ 1.0 (* x_m (+ 1.0 (pow z 2.0)))) y_m)
(/ (* (/ 1.0 z) (/ (/ 1.0 y_m) z)) x_m)))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e+305) {
tmp = (1.0 / (x_m * (1.0 + pow(z, 2.0)))) / y_m;
} else {
tmp = ((1.0 / z) * ((1.0 / y_m) / z)) / x_m;
}
return y_s * (x_s * tmp);
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 5d+305) then
tmp = (1.0d0 / (x_m * (1.0d0 + (z ** 2.0d0)))) / y_m
else
tmp = ((1.0d0 / z) * ((1.0d0 / y_m) / z)) / x_m
end if
code = y_s * (x_s * tmp)
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e+305) {
tmp = (1.0 / (x_m * (1.0 + Math.pow(z, 2.0)))) / y_m;
} else {
tmp = ((1.0 / z) * ((1.0 / y_m) / z)) / x_m;
}
return y_s * (x_s * tmp);
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if (z * z) <= 5e+305: tmp = (1.0 / (x_m * (1.0 + math.pow(z, 2.0)))) / y_m else: tmp = ((1.0 / z) * ((1.0 / y_m) / z)) / x_m return y_s * (x_s * tmp)
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e+305) tmp = Float64(Float64(1.0 / Float64(x_m * Float64(1.0 + (z ^ 2.0)))) / y_m); else tmp = Float64(Float64(Float64(1.0 / z) * Float64(Float64(1.0 / y_m) / z)) / x_m); end return Float64(y_s * Float64(x_s * tmp)) end
x_m = abs(x); x_s = sign(x) * abs(1.0); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x_s, x_m, y_m, z) tmp = 0.0; if ((z * z) <= 5e+305) tmp = (1.0 / (x_m * (1.0 + (z ^ 2.0)))) / y_m; else tmp = ((1.0 / z) * ((1.0 / y_m) / z)) / x_m; end tmp_2 = y_s * (x_s * tmp); end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e+305], N[(N[(1.0 / N[(x$95$m * N[(1.0 + N[Power[z, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / y$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / x$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+305}:\\
\;\;\;\;\frac{\frac{1}{x\_m \cdot \left(1 + {z}^{2}\right)}}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{y\_m}}{z}}{x\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 5.00000000000000009e305Initial program 95.8%
associate-/l/95.6%
metadata-eval95.6%
associate-*r/95.6%
associate-/l/95.8%
associate-*r/95.8%
associate-/l*95.0%
associate-/r/95.6%
/-rgt-identity95.6%
associate-*l*96.5%
*-commutative96.5%
sqr-neg96.5%
+-commutative96.5%
sqr-neg96.5%
fma-def96.5%
Simplified96.5%
fma-udef96.5%
+-commutative96.5%
*-commutative96.5%
associate-*l*95.6%
associate-/l/95.8%
add-sqr-sqrt53.6%
sqrt-div19.8%
inv-pow19.8%
sqrt-pow119.8%
metadata-eval19.8%
*-commutative19.8%
sqrt-prod19.8%
hypot-1-def19.8%
sqrt-div19.8%
inv-pow19.8%
sqrt-pow119.8%
metadata-eval19.8%
*-commutative19.8%
Applied egg-rr20.7%
unpow220.7%
Simplified20.7%
unpow220.7%
associate-/r*20.7%
associate-/r*20.7%
frac-times19.7%
add-sqr-sqrt47.7%
Applied egg-rr47.7%
associate-*r/47.7%
associate-*l/47.7%
pow-sqr96.9%
metadata-eval96.9%
unpow-196.9%
Simplified96.9%
Taylor expanded in x around 0 96.7%
if 5.00000000000000009e305 < (*.f64 z z) Initial program 72.0%
distribute-rgt-in72.0%
*-un-lft-identity72.0%
flip-+1.6%
pow21.6%
*-commutative1.6%
pow21.6%
*-commutative1.6%
pow21.6%
*-commutative1.6%
pow21.6%
Applied egg-rr1.6%
unpow21.6%
associate-*l*1.6%
distribute-lft-out--1.6%
*-commutative1.6%
associate-*r*1.6%
pow-sqr1.6%
metadata-eval1.6%
*-commutative1.6%
Simplified1.6%
div-inv1.6%
*-commutative1.6%
Applied egg-rr1.6%
associate-*l/1.6%
*-lft-identity1.6%
associate-/r/1.6%
associate-/r*1.6%
*-commutative1.6%
cancel-sign-sub-inv1.6%
*-lft-identity1.6%
mul-1-neg1.6%
distribute-rgt-in1.6%
mul-1-neg1.6%
sub-neg1.6%
Simplified1.6%
Taylor expanded in z around inf 72.0%
associate-/r*72.0%
*-un-lft-identity72.0%
unpow272.0%
times-frac85.3%
Applied egg-rr85.3%
Final simplification93.8%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 2e+29)
(/ (/ 1.0 (* x_m y_m)) (fma z z 1.0))
(/ (/ (/ 1.0 (* x_m z)) (hypot 1.0 z)) y_m)))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 2e+29) {
tmp = (1.0 / (x_m * y_m)) / fma(z, z, 1.0);
} else {
tmp = ((1.0 / (x_m * z)) / hypot(1.0, z)) / y_m;
}
return y_s * (x_s * tmp);
}
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 2e+29) tmp = Float64(Float64(1.0 / Float64(x_m * y_m)) / fma(z, z, 1.0)); else tmp = Float64(Float64(Float64(1.0 / Float64(x_m * z)) / hypot(1.0, z)) / y_m); end return Float64(y_s * Float64(x_s * tmp)) end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 2e+29], N[(N[(1.0 / N[(x$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] / N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(x$95$m * z), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+29}:\\
\;\;\;\;\frac{\frac{1}{x\_m \cdot y\_m}}{\mathsf{fma}\left(z, z, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{x\_m \cdot z}}{\mathsf{hypot}\left(1, z\right)}}{y\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 1.99999999999999983e29Initial program 99.0%
associate-/l/98.7%
Simplified98.7%
+-commutative98.7%
distribute-lft-in98.7%
associate-*r*98.7%
*-rgt-identity98.7%
fma-def98.7%
Applied egg-rr98.7%
Taylor expanded in y around 0 98.7%
associate-*r*98.7%
+-commutative98.7%
unpow298.7%
fma-udef98.7%
associate-/r*99.2%
associate-/r*99.0%
Simplified99.0%
*-un-lft-identity99.0%
associate-/l/99.2%
*-commutative99.2%
Applied egg-rr99.2%
if 1.99999999999999983e29 < (*.f64 z z) Initial program 79.2%
associate-/l/79.2%
metadata-eval79.2%
associate-*r/79.2%
associate-/l/79.2%
associate-*r/79.2%
associate-/l*79.1%
associate-/r/79.2%
/-rgt-identity79.2%
associate-*l*80.6%
*-commutative80.6%
sqr-neg80.6%
+-commutative80.6%
sqr-neg80.6%
fma-def80.6%
Simplified80.6%
fma-udef80.6%
+-commutative80.6%
*-commutative80.6%
associate-*l*79.2%
associate-/l/79.2%
add-sqr-sqrt64.7%
sqrt-div22.5%
inv-pow22.5%
sqrt-pow122.4%
metadata-eval22.4%
*-commutative22.4%
sqrt-prod22.4%
hypot-1-def22.4%
sqrt-div22.4%
inv-pow22.4%
sqrt-pow122.4%
metadata-eval22.4%
*-commutative22.4%
Applied egg-rr28.7%
unpow228.7%
Simplified28.7%
unpow228.7%
associate-/r*28.7%
associate-/r*28.7%
frac-times25.5%
add-sqr-sqrt47.7%
Applied egg-rr47.7%
associate-*r/47.7%
associate-*l/47.6%
pow-sqr89.3%
metadata-eval89.3%
unpow-189.3%
Simplified89.3%
Taylor expanded in z around inf 70.5%
Final simplification86.0%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 5e+305)
(/ 1.0 (* y_m (* x_m (fma z z 1.0))))
(/ (* (/ 1.0 z) (/ (/ 1.0 y_m) z)) x_m)))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e+305) {
tmp = 1.0 / (y_m * (x_m * fma(z, z, 1.0)));
} else {
tmp = ((1.0 / z) * ((1.0 / y_m) / z)) / x_m;
}
return y_s * (x_s * tmp);
}
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e+305) tmp = Float64(1.0 / Float64(y_m * Float64(x_m * fma(z, z, 1.0)))); else tmp = Float64(Float64(Float64(1.0 / z) * Float64(Float64(1.0 / y_m) / z)) / x_m); end return Float64(y_s * Float64(x_s * tmp)) end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e+305], N[(1.0 / N[(y$95$m * N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / y$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / x$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+305}:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x\_m \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{y\_m}}{z}}{x\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 5.00000000000000009e305Initial program 95.8%
associate-/l/95.6%
metadata-eval95.6%
associate-*r/95.6%
associate-/l/95.8%
associate-*r/95.8%
associate-/l*95.0%
associate-/r/95.6%
/-rgt-identity95.6%
associate-*l*96.5%
*-commutative96.5%
sqr-neg96.5%
+-commutative96.5%
sqr-neg96.5%
fma-def96.5%
Simplified96.5%
if 5.00000000000000009e305 < (*.f64 z z) Initial program 72.0%
distribute-rgt-in72.0%
*-un-lft-identity72.0%
flip-+1.6%
pow21.6%
*-commutative1.6%
pow21.6%
*-commutative1.6%
pow21.6%
*-commutative1.6%
pow21.6%
Applied egg-rr1.6%
unpow21.6%
associate-*l*1.6%
distribute-lft-out--1.6%
*-commutative1.6%
associate-*r*1.6%
pow-sqr1.6%
metadata-eval1.6%
*-commutative1.6%
Simplified1.6%
div-inv1.6%
*-commutative1.6%
Applied egg-rr1.6%
associate-*l/1.6%
*-lft-identity1.6%
associate-/r/1.6%
associate-/r*1.6%
*-commutative1.6%
cancel-sign-sub-inv1.6%
*-lft-identity1.6%
mul-1-neg1.6%
distribute-rgt-in1.6%
mul-1-neg1.6%
sub-neg1.6%
Simplified1.6%
Taylor expanded in z around inf 72.0%
associate-/r*72.0%
*-un-lft-identity72.0%
unpow272.0%
times-frac85.3%
Applied egg-rr85.3%
Final simplification93.7%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ 1.0 (* x_m (* y_m (+ 1.0 (* z z))))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (1.0 / (x_m * (y_m * (1.0 + (z * z))))));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (x_s * (1.0d0 / (x_m * (y_m * (1.0d0 + (z * z))))))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (1.0 / (x_m * (y_m * (1.0 + (z * z))))));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * (1.0 / (x_m * (y_m * (1.0 + (z * z))))))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(1.0 / Float64(x_m * Float64(y_m * Float64(1.0 + Float64(z * z))))))) end
x_m = abs(x); x_s = sign(x) * abs(1.0); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp = code(y_s, x_s, x_m, y_m, z) tmp = y_s * (x_s * (1.0 / (x_m * (y_m * (1.0 + (z * z)))))); end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(1.0 / N[(x$95$m * N[(y$95$m * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \frac{1}{x\_m \cdot \left(y\_m \cdot \left(1 + z \cdot z\right)\right)}\right)
\end{array}
Initial program 89.8%
associate-/l/89.7%
Simplified89.7%
Final simplification89.7%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ 1.0 (* x_m (+ y_m (* z (* z y_m))))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (1.0 / (x_m * (y_m + (z * (z * y_m))))));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (x_s * (1.0d0 / (x_m * (y_m + (z * (z * y_m))))))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (1.0 / (x_m * (y_m + (z * (z * y_m))))));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * (1.0 / (x_m * (y_m + (z * (z * y_m))))))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(1.0 / Float64(x_m * Float64(y_m + Float64(z * Float64(z * y_m))))))) end
x_m = abs(x); x_s = sign(x) * abs(1.0); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp = code(y_s, x_s, x_m, y_m, z) tmp = y_s * (x_s * (1.0 / (x_m * (y_m + (z * (z * y_m)))))); end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(1.0 / N[(x$95$m * N[(y$95$m + N[(z * N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \frac{1}{x\_m \cdot \left(y\_m + z \cdot \left(z \cdot y\_m\right)\right)}\right)
\end{array}
Initial program 89.8%
associate-/l/89.7%
Simplified89.7%
+-commutative89.7%
distribute-lft-in89.7%
associate-*r*93.0%
*-rgt-identity93.0%
fma-def93.0%
Applied egg-rr93.0%
fma-udef93.0%
*-commutative93.0%
Applied egg-rr93.0%
Final simplification93.0%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ 1.0 (* x_m y_m)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (1.0 / (x_m * y_m)));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (x_s * (1.0d0 / (x_m * y_m)))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (1.0 / (x_m * y_m)));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * (1.0 / (x_m * y_m)))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(1.0 / Float64(x_m * y_m)))) end
x_m = abs(x); x_s = sign(x) * abs(1.0); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp = code(y_s, x_s, x_m, y_m, z) tmp = y_s * (x_s * (1.0 / (x_m * y_m))); end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(1.0 / N[(x$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \frac{1}{x\_m \cdot y\_m}\right)
\end{array}
Initial program 89.8%
associate-/l/89.7%
metadata-eval89.7%
associate-*r/89.7%
associate-/l/89.8%
associate-*r/89.8%
associate-/l*89.3%
associate-/r/89.7%
/-rgt-identity89.7%
associate-*l*90.4%
*-commutative90.4%
sqr-neg90.4%
+-commutative90.4%
sqr-neg90.4%
fma-def90.4%
Simplified90.4%
Taylor expanded in z around 0 57.8%
Final simplification57.8%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ (/ 1.0 y_m) x_m))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((1.0 / y_m) / x_m));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (x_s * ((1.0d0 / y_m) / x_m))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((1.0 / y_m) / x_m));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * ((1.0 / y_m) / x_m))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(Float64(1.0 / y_m) / x_m))) end
x_m = abs(x); x_s = sign(x) * abs(1.0); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp = code(y_s, x_s, x_m, y_m, z) tmp = y_s * (x_s * ((1.0 / y_m) / x_m)); end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x\_s \cdot \frac{\frac{1}{y\_m}}{x\_m}\right)
\end{array}
Initial program 89.8%
distribute-rgt-in89.8%
*-un-lft-identity89.8%
flip-+49.2%
pow249.2%
*-commutative49.2%
pow249.2%
*-commutative49.2%
pow249.2%
*-commutative49.2%
pow249.2%
Applied egg-rr49.2%
unpow249.2%
associate-*l*48.4%
distribute-lft-out--50.3%
*-commutative50.3%
associate-*r*46.9%
pow-sqr46.9%
metadata-eval46.9%
*-commutative46.9%
Simplified46.9%
div-inv46.9%
*-commutative46.9%
Applied egg-rr46.9%
associate-*l/46.9%
*-lft-identity46.9%
associate-/r/46.7%
associate-/r*46.9%
*-commutative46.9%
cancel-sign-sub-inv46.9%
*-lft-identity46.9%
mul-1-neg46.9%
distribute-rgt-in46.9%
mul-1-neg46.9%
sub-neg46.9%
Simplified46.9%
Taylor expanded in z around 0 57.8%
Final simplification57.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 2024027
(FPCore (x y z)
:name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< (* y (+ 1.0 (* z z))) (- INFINITY)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x)) (if (< (* y (+ 1.0 (* z z))) 8.680743250567252e+305) (/ (/ 1.0 x) (* (+ 1.0 (* z z)) y)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x))))
(/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))