
(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 10 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)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z_m)
:precision binary64
(let* ((t_0 (* y_m (+ 1.0 (* z_m z_m)))))
(*
y_s
(if (<= t_0 5e+298)
(/ 1.0 (* x t_0))
(/ 1.0 (* (hypot 1.0 z_m) (* y_m (* z_m x))))))))z_m = fabs(z);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
double t_0 = y_m * (1.0 + (z_m * z_m));
double tmp;
if (t_0 <= 5e+298) {
tmp = 1.0 / (x * t_0);
} else {
tmp = 1.0 / (hypot(1.0, z_m) * (y_m * (z_m * x)));
}
return y_s * tmp;
}
z_m = Math.abs(z);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z_m) {
double t_0 = y_m * (1.0 + (z_m * z_m));
double tmp;
if (t_0 <= 5e+298) {
tmp = 1.0 / (x * t_0);
} else {
tmp = 1.0 / (Math.hypot(1.0, z_m) * (y_m * (z_m * x)));
}
return y_s * tmp;
}
z_m = math.fabs(z) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): t_0 = y_m * (1.0 + (z_m * z_m)) tmp = 0 if t_0 <= 5e+298: tmp = 1.0 / (x * t_0) else: tmp = 1.0 / (math.hypot(1.0, z_m) * (y_m * (z_m * x))) return y_s * tmp
z_m = abs(z) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) t_0 = Float64(y_m * Float64(1.0 + Float64(z_m * z_m))) tmp = 0.0 if (t_0 <= 5e+298) tmp = Float64(1.0 / Float64(x * t_0)); else tmp = Float64(1.0 / Float64(hypot(1.0, z_m) * Float64(y_m * Float64(z_m * x)))); end return Float64(y_s * tmp) end
z_m = abs(z); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z_m) t_0 = y_m * (1.0 + (z_m * z_m)); tmp = 0.0; if (t_0 <= 5e+298) tmp = 1.0 / (x * t_0); else tmp = 1.0 / (hypot(1.0, z_m) * (y_m * (z_m * x))); end tmp_2 = y_s * tmp; end
z_m = N[Abs[z], $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_, y$95$m_, z$95$m_] := Block[{t$95$0 = N[(y$95$m * N[(1.0 + N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, 5e+298], N[(1.0 / N[(x * t$95$0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision] * N[(y$95$m * N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := y_m \cdot \left(1 + z_m \cdot z_m\right)\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;t_0 \leq 5 \cdot 10^{+298}:\\
\;\;\;\;\frac{1}{x \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(1, z_m\right) \cdot \left(y_m \cdot \left(z_m \cdot x\right)\right)}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 5.0000000000000003e298Initial program 96.5%
associate-/l/96.5%
Simplified96.5%
if 5.0000000000000003e298 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 76.4%
associate-/l/76.4%
metadata-eval76.4%
associate-*r/76.4%
associate-/l/76.4%
associate-*r/76.4%
associate-/l*76.4%
associate-/r/76.4%
/-rgt-identity76.4%
associate-*l*83.4%
*-commutative83.4%
sqr-neg83.4%
+-commutative83.4%
sqr-neg83.4%
fma-def83.4%
Simplified83.4%
/-rgt-identity83.4%
fma-udef83.4%
+-commutative83.4%
*-commutative83.4%
associate-*l*76.4%
associate-/l*76.4%
add-sqr-sqrt76.4%
associate-/l*76.4%
*-commutative76.4%
sqrt-prod76.4%
hypot-1-def76.4%
*-commutative76.4%
sqrt-prod83.3%
hypot-1-def99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 85.6%
expm1-log1p-u42.2%
expm1-udef42.2%
Applied egg-rr42.2%
expm1-def42.2%
expm1-log1p85.6%
associate-*r*85.6%
*-commutative85.6%
associate-*r*85.6%
associate-*r*85.6%
rem-square-sqrt85.7%
*-commutative85.7%
Simplified85.7%
Final simplification94.8%
z_m = (fabs.f64 z) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x y_m z_m) :precision binary64 (let* ((t_0 (* (hypot 1.0 z_m) (sqrt y_m)))) (* y_s (/ 1.0 (/ t_0 (/ (/ 1.0 x) t_0))))))
z_m = fabs(z);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
double t_0 = hypot(1.0, z_m) * sqrt(y_m);
return y_s * (1.0 / (t_0 / ((1.0 / x) / t_0)));
}
z_m = Math.abs(z);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z_m) {
double t_0 = Math.hypot(1.0, z_m) * Math.sqrt(y_m);
return y_s * (1.0 / (t_0 / ((1.0 / x) / t_0)));
}
z_m = math.fabs(z) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): t_0 = math.hypot(1.0, z_m) * math.sqrt(y_m) return y_s * (1.0 / (t_0 / ((1.0 / x) / t_0)))
z_m = abs(z) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) t_0 = Float64(hypot(1.0, z_m) * sqrt(y_m)) return Float64(y_s * Float64(1.0 / Float64(t_0 / Float64(Float64(1.0 / x) / t_0)))) end
z_m = abs(z); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m, z_m) t_0 = hypot(1.0, z_m) * sqrt(y_m); tmp = y_s * (1.0 / (t_0 / ((1.0 / x) / t_0))); end
z_m = N[Abs[z], $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_, y$95$m_, z$95$m_] := Block[{t$95$0 = N[(N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision] * N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(1.0 / N[(t$95$0 / N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(1, z_m\right) \cdot \sqrt{y_m}\\
y_s \cdot \frac{1}{\frac{t_0}{\frac{\frac{1}{x}}{t_0}}}
\end{array}
\end{array}
Initial program 93.3%
associate-/l/93.3%
metadata-eval93.3%
associate-*r/93.3%
associate-/l/93.3%
associate-*r/93.3%
associate-/l*93.2%
associate-/r/93.3%
/-rgt-identity93.3%
associate-*l*92.6%
*-commutative92.6%
sqr-neg92.6%
+-commutative92.6%
sqr-neg92.6%
fma-def92.6%
Simplified92.6%
/-rgt-identity92.6%
fma-udef92.6%
+-commutative92.6%
*-commutative92.6%
associate-*l*93.3%
associate-/l*93.2%
add-sqr-sqrt53.0%
associate-/l*53.0%
*-commutative53.0%
sqrt-prod53.0%
hypot-1-def53.0%
*-commutative53.0%
sqrt-prod54.1%
hypot-1-def56.6%
Applied egg-rr56.6%
Final simplification56.6%
z_m = (fabs.f64 z) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x y_m z_m) :precision binary64 (* y_s (pow (/ (pow x -0.5) (* (hypot 1.0 z_m) (sqrt y_m))) 2.0)))
z_m = fabs(z);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
return y_s * pow((pow(x, -0.5) / (hypot(1.0, z_m) * sqrt(y_m))), 2.0);
}
z_m = Math.abs(z);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z_m) {
return y_s * Math.pow((Math.pow(x, -0.5) / (Math.hypot(1.0, z_m) * Math.sqrt(y_m))), 2.0);
}
z_m = math.fabs(z) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): return y_s * math.pow((math.pow(x, -0.5) / (math.hypot(1.0, z_m) * math.sqrt(y_m))), 2.0)
z_m = abs(z) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) return Float64(y_s * (Float64((x ^ -0.5) / Float64(hypot(1.0, z_m) * sqrt(y_m))) ^ 2.0)) end
z_m = abs(z); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m, z_m) tmp = y_s * (((x ^ -0.5) / (hypot(1.0, z_m) * sqrt(y_m))) ^ 2.0); end
z_m = N[Abs[z], $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_, y$95$m_, z$95$m_] := N[(y$95$s * N[Power[N[(N[Power[x, -0.5], $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision] * N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot {\left(\frac{{x}^{-0.5}}{\mathsf{hypot}\left(1, z_m\right) \cdot \sqrt{y_m}}\right)}^{2}
\end{array}
Initial program 93.3%
associate-/l/93.3%
metadata-eval93.3%
associate-*r/93.3%
associate-/l/93.3%
associate-*r/93.3%
associate-/l*93.2%
associate-/r/93.3%
/-rgt-identity93.3%
associate-*l*92.6%
*-commutative92.6%
sqr-neg92.6%
+-commutative92.6%
sqr-neg92.6%
fma-def92.6%
Simplified92.6%
fma-udef92.6%
+-commutative92.6%
*-commutative92.6%
associate-*l*93.3%
associate-/l/93.3%
add-sqr-sqrt61.4%
sqrt-div26.6%
inv-pow26.6%
sqrt-pow126.6%
metadata-eval26.6%
*-commutative26.6%
sqrt-prod26.6%
hypot-1-def26.6%
sqrt-div26.6%
inv-pow26.6%
sqrt-pow126.5%
metadata-eval26.5%
*-commutative26.5%
Applied egg-rr28.7%
unpow228.7%
Simplified28.7%
Final simplification28.7%
z_m = (fabs.f64 z) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x y_m z_m) :precision binary64 (* y_s (/ (pow (/ (pow x -0.5) (hypot 1.0 z_m)) 2.0) y_m)))
z_m = fabs(z);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
return y_s * (pow((pow(x, -0.5) / hypot(1.0, z_m)), 2.0) / y_m);
}
z_m = Math.abs(z);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z_m) {
return y_s * (Math.pow((Math.pow(x, -0.5) / Math.hypot(1.0, z_m)), 2.0) / y_m);
}
z_m = math.fabs(z) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): return y_s * (math.pow((math.pow(x, -0.5) / math.hypot(1.0, z_m)), 2.0) / y_m)
z_m = abs(z) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) return Float64(y_s * Float64((Float64((x ^ -0.5) / hypot(1.0, z_m)) ^ 2.0) / y_m)) end
z_m = abs(z); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m, z_m) tmp = y_s * ((((x ^ -0.5) / hypot(1.0, z_m)) ^ 2.0) / y_m); end
z_m = N[Abs[z], $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_, y$95$m_, z$95$m_] := N[(y$95$s * N[(N[Power[N[(N[Power[x, -0.5], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \frac{{\left(\frac{{x}^{-0.5}}{\mathsf{hypot}\left(1, z_m\right)}\right)}^{2}}{y_m}
\end{array}
Initial program 93.3%
associate-/l/93.3%
metadata-eval93.3%
associate-*r/93.3%
associate-/l/93.3%
associate-*r/93.3%
associate-/l*93.2%
associate-/r/93.3%
/-rgt-identity93.3%
associate-*l*92.6%
*-commutative92.6%
sqr-neg92.6%
+-commutative92.6%
sqr-neg92.6%
fma-def92.6%
Simplified92.6%
/-rgt-identity92.6%
fma-udef92.6%
+-commutative92.6%
*-commutative92.6%
associate-*l*93.3%
associate-/l*93.2%
associate-/l*92.5%
+-commutative92.5%
fma-udef92.5%
Applied egg-rr92.5%
clear-num92.5%
add-sqr-sqrt52.8%
*-un-lft-identity52.8%
times-frac52.8%
sqrt-div44.4%
inv-pow44.4%
sqrt-pow144.5%
metadata-eval44.5%
sqrt-div46.3%
inv-pow46.3%
sqrt-pow146.3%
metadata-eval46.3%
Applied egg-rr46.3%
/-rgt-identity46.3%
associate-*r/44.4%
unpow244.4%
fma-udef44.4%
unpow244.4%
+-commutative44.4%
unpow244.4%
hypot-1-def45.5%
Simplified45.5%
Final simplification45.5%
z_m = (fabs.f64 z)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z_m)
:precision binary64
(*
y_s
(if (<= (* z_m z_m) 5e+65)
(/ 1.0 (* x (fma (* z_m y_m) z_m y_m)))
(/ (* (/ 1.0 z_m) (/ (/ 1.0 x) z_m)) y_m))))z_m = fabs(z);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if ((z_m * z_m) <= 5e+65) {
tmp = 1.0 / (x * fma((z_m * y_m), z_m, y_m));
} else {
tmp = ((1.0 / z_m) * ((1.0 / x) / z_m)) / y_m;
}
return y_s * tmp;
}
z_m = abs(z) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) tmp = 0.0 if (Float64(z_m * z_m) <= 5e+65) tmp = Float64(1.0 / Float64(x * fma(Float64(z_m * y_m), z_m, y_m))); else tmp = Float64(Float64(Float64(1.0 / z_m) * Float64(Float64(1.0 / x) / z_m)) / y_m); end return Float64(y_s * tmp) end
z_m = N[Abs[z], $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_, y$95$m_, z$95$m_] := N[(y$95$s * If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 5e+65], N[(1.0 / N[(x * N[(N[(z$95$m * y$95$m), $MachinePrecision] * z$95$m + y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z$95$m), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \cdot z_m \leq 5 \cdot 10^{+65}:\\
\;\;\;\;\frac{1}{x \cdot \mathsf{fma}\left(z_m \cdot y_m, z_m, y_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z_m} \cdot \frac{\frac{1}{x}}{z_m}}{y_m}\\
\end{array}
\end{array}
if (*.f64 z z) < 4.99999999999999973e65Initial program 99.6%
associate-/l/99.7%
Simplified99.7%
+-commutative99.7%
distribute-lft-in99.7%
associate-*r*99.7%
*-rgt-identity99.7%
fma-def99.7%
Applied egg-rr99.7%
if 4.99999999999999973e65 < (*.f64 z z) Initial program 85.2%
associate-/l/85.0%
metadata-eval85.0%
associate-*r/85.0%
associate-/l/85.2%
associate-*r/85.2%
associate-/l*84.9%
associate-/r/85.0%
/-rgt-identity85.0%
associate-*l*83.4%
*-commutative83.4%
sqr-neg83.4%
+-commutative83.4%
sqr-neg83.4%
fma-def83.4%
Simplified83.4%
/-rgt-identity83.4%
fma-udef83.4%
+-commutative83.4%
*-commutative83.4%
associate-*l*85.0%
associate-/l*84.9%
associate-/l*83.3%
+-commutative83.3%
fma-udef83.3%
Applied egg-rr83.3%
clear-num83.3%
add-sqr-sqrt61.9%
*-un-lft-identity61.9%
times-frac61.9%
sqrt-div42.6%
inv-pow42.6%
sqrt-pow142.6%
metadata-eval42.6%
sqrt-div46.9%
inv-pow46.9%
sqrt-pow146.9%
metadata-eval46.9%
Applied egg-rr46.9%
/-rgt-identity46.9%
associate-*r/42.5%
unpow242.5%
fma-udef42.5%
unpow242.5%
+-commutative42.5%
unpow242.5%
hypot-1-def45.0%
Simplified45.0%
Taylor expanded in z around inf 83.3%
associate-/r*83.3%
Simplified83.3%
*-un-lft-identity83.3%
unpow283.3%
times-frac87.9%
Applied egg-rr87.9%
Final simplification94.6%
z_m = (fabs.f64 z)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z_m)
:precision binary64
(let* ((t_0 (* y_m (+ 1.0 (* z_m z_m)))))
(*
y_s
(if (<= t_0 1e+305)
(/ 1.0 (* x t_0))
(* (/ (/ 1.0 z_m) y_m) (/ (/ 1.0 z_m) x))))))z_m = fabs(z);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
double t_0 = y_m * (1.0 + (z_m * z_m));
double tmp;
if (t_0 <= 1e+305) {
tmp = 1.0 / (x * t_0);
} else {
tmp = ((1.0 / z_m) / y_m) * ((1.0 / z_m) / x);
}
return y_s * tmp;
}
z_m = abs(z)
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z_m)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8) :: t_0
real(8) :: tmp
t_0 = y_m * (1.0d0 + (z_m * z_m))
if (t_0 <= 1d+305) then
tmp = 1.0d0 / (x * t_0)
else
tmp = ((1.0d0 / z_m) / y_m) * ((1.0d0 / z_m) / x)
end if
code = y_s * tmp
end function
z_m = Math.abs(z);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z_m) {
double t_0 = y_m * (1.0 + (z_m * z_m));
double tmp;
if (t_0 <= 1e+305) {
tmp = 1.0 / (x * t_0);
} else {
tmp = ((1.0 / z_m) / y_m) * ((1.0 / z_m) / x);
}
return y_s * tmp;
}
z_m = math.fabs(z) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): t_0 = y_m * (1.0 + (z_m * z_m)) tmp = 0 if t_0 <= 1e+305: tmp = 1.0 / (x * t_0) else: tmp = ((1.0 / z_m) / y_m) * ((1.0 / z_m) / x) return y_s * tmp
z_m = abs(z) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) t_0 = Float64(y_m * Float64(1.0 + Float64(z_m * z_m))) tmp = 0.0 if (t_0 <= 1e+305) tmp = Float64(1.0 / Float64(x * t_0)); else tmp = Float64(Float64(Float64(1.0 / z_m) / y_m) * Float64(Float64(1.0 / z_m) / x)); end return Float64(y_s * tmp) end
z_m = abs(z); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z_m) t_0 = y_m * (1.0 + (z_m * z_m)); tmp = 0.0; if (t_0 <= 1e+305) tmp = 1.0 / (x * t_0); else tmp = ((1.0 / z_m) / y_m) * ((1.0 / z_m) / x); end tmp_2 = y_s * tmp; end
z_m = N[Abs[z], $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_, y$95$m_, z$95$m_] := Block[{t$95$0 = N[(y$95$m * N[(1.0 + N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, 1e+305], N[(1.0 / N[(x * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(1.0 / z$95$m), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := y_m \cdot \left(1 + z_m \cdot z_m\right)\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;t_0 \leq 10^{+305}:\\
\;\;\;\;\frac{1}{x \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z_m}}{y_m} \cdot \frac{\frac{1}{z_m}}{x}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 9.9999999999999994e304Initial program 96.5%
associate-/l/96.5%
Simplified96.5%
if 9.9999999999999994e304 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 76.4%
associate-/l/76.4%
metadata-eval76.4%
associate-*r/76.4%
associate-/l/76.4%
associate-*r/76.4%
associate-/l*76.4%
associate-/r/76.4%
/-rgt-identity76.4%
associate-*l*83.4%
*-commutative83.4%
sqr-neg83.4%
+-commutative83.4%
sqr-neg83.4%
fma-def83.4%
Simplified83.4%
Taylor expanded in z around inf 76.4%
associate-*r*83.1%
*-commutative83.1%
Simplified83.1%
expm1-log1p-u83.1%
expm1-udef76.1%
associate-/r*76.1%
pow-flip76.1%
metadata-eval76.1%
Applied egg-rr76.1%
expm1-def84.0%
expm1-log1p84.0%
Simplified84.0%
add-sqr-sqrt83.9%
*-commutative83.9%
times-frac81.9%
sqrt-pow178.7%
metadata-eval78.7%
unpow-178.7%
sqrt-pow195.2%
metadata-eval95.2%
unpow-195.2%
Applied egg-rr95.2%
Final simplification96.3%
z_m = (fabs.f64 z)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z_m)
:precision binary64
(*
y_s
(if (<= (* z_m z_m) 1.5e+69)
(/ 1.0 (* x (* y_m (+ 1.0 (* z_m z_m)))))
(/ (* (/ 1.0 z_m) (/ (/ 1.0 x) z_m)) y_m))))z_m = fabs(z);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if ((z_m * z_m) <= 1.5e+69) {
tmp = 1.0 / (x * (y_m * (1.0 + (z_m * z_m))));
} else {
tmp = ((1.0 / z_m) * ((1.0 / x) / z_m)) / y_m;
}
return y_s * tmp;
}
z_m = abs(z)
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z_m)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8) :: tmp
if ((z_m * z_m) <= 1.5d+69) then
tmp = 1.0d0 / (x * (y_m * (1.0d0 + (z_m * z_m))))
else
tmp = ((1.0d0 / z_m) * ((1.0d0 / x) / z_m)) / y_m
end if
code = y_s * tmp
end function
z_m = Math.abs(z);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if ((z_m * z_m) <= 1.5e+69) {
tmp = 1.0 / (x * (y_m * (1.0 + (z_m * z_m))));
} else {
tmp = ((1.0 / z_m) * ((1.0 / x) / z_m)) / y_m;
}
return y_s * tmp;
}
z_m = math.fabs(z) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): tmp = 0 if (z_m * z_m) <= 1.5e+69: tmp = 1.0 / (x * (y_m * (1.0 + (z_m * z_m)))) else: tmp = ((1.0 / z_m) * ((1.0 / x) / z_m)) / y_m return y_s * tmp
z_m = abs(z) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) tmp = 0.0 if (Float64(z_m * z_m) <= 1.5e+69) tmp = Float64(1.0 / Float64(x * Float64(y_m * Float64(1.0 + Float64(z_m * z_m))))); else tmp = Float64(Float64(Float64(1.0 / z_m) * Float64(Float64(1.0 / x) / z_m)) / y_m); end return Float64(y_s * tmp) end
z_m = abs(z); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z_m) tmp = 0.0; if ((z_m * z_m) <= 1.5e+69) tmp = 1.0 / (x * (y_m * (1.0 + (z_m * z_m)))); else tmp = ((1.0 / z_m) * ((1.0 / x) / z_m)) / y_m; end tmp_2 = y_s * tmp; end
z_m = N[Abs[z], $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_, y$95$m_, z$95$m_] := N[(y$95$s * If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 1.5e+69], N[(1.0 / N[(x * N[(y$95$m * N[(1.0 + N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z$95$m), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \cdot z_m \leq 1.5 \cdot 10^{+69}:\\
\;\;\;\;\frac{1}{x \cdot \left(y_m \cdot \left(1 + z_m \cdot z_m\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z_m} \cdot \frac{\frac{1}{x}}{z_m}}{y_m}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.49999999999999992e69Initial program 99.6%
associate-/l/99.7%
Simplified99.7%
if 1.49999999999999992e69 < (*.f64 z z) Initial program 85.1%
associate-/l/84.9%
metadata-eval84.9%
associate-*r/84.9%
associate-/l/85.1%
associate-*r/85.1%
associate-/l*84.8%
associate-/r/84.9%
/-rgt-identity84.9%
associate-*l*83.2%
*-commutative83.2%
sqr-neg83.2%
+-commutative83.2%
sqr-neg83.2%
fma-def83.2%
Simplified83.2%
/-rgt-identity83.2%
fma-udef83.2%
+-commutative83.2%
*-commutative83.2%
associate-*l*84.9%
associate-/l*84.8%
associate-/l*83.1%
+-commutative83.1%
fma-udef83.1%
Applied egg-rr83.1%
clear-num83.2%
add-sqr-sqrt62.4%
*-un-lft-identity62.4%
times-frac62.4%
sqrt-div43.0%
inv-pow43.0%
sqrt-pow143.0%
metadata-eval43.0%
sqrt-div47.4%
inv-pow47.4%
sqrt-pow147.3%
metadata-eval47.3%
Applied egg-rr47.3%
/-rgt-identity47.3%
associate-*r/42.9%
unpow242.9%
fma-udef42.9%
unpow242.9%
+-commutative42.9%
unpow242.9%
hypot-1-def45.5%
Simplified45.5%
Taylor expanded in z around inf 83.2%
associate-/r*83.2%
Simplified83.2%
*-un-lft-identity83.2%
unpow283.2%
times-frac87.8%
Applied egg-rr87.8%
Final simplification94.6%
z_m = (fabs.f64 z)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z_m)
:precision binary64
(*
y_s
(if (<= z_m 0.52)
(/ 1.0 (* y_m x))
(* (/ (/ 1.0 z_m) y_m) (/ (/ 1.0 z_m) x)))))z_m = fabs(z);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if (z_m <= 0.52) {
tmp = 1.0 / (y_m * x);
} else {
tmp = ((1.0 / z_m) / y_m) * ((1.0 / z_m) / x);
}
return y_s * tmp;
}
z_m = abs(z)
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z_m)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 0.52d0) then
tmp = 1.0d0 / (y_m * x)
else
tmp = ((1.0d0 / z_m) / y_m) * ((1.0d0 / z_m) / x)
end if
code = y_s * tmp
end function
z_m = Math.abs(z);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if (z_m <= 0.52) {
tmp = 1.0 / (y_m * x);
} else {
tmp = ((1.0 / z_m) / y_m) * ((1.0 / z_m) / x);
}
return y_s * tmp;
}
z_m = math.fabs(z) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): tmp = 0 if z_m <= 0.52: tmp = 1.0 / (y_m * x) else: tmp = ((1.0 / z_m) / y_m) * ((1.0 / z_m) / x) return y_s * tmp
z_m = abs(z) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) tmp = 0.0 if (z_m <= 0.52) tmp = Float64(1.0 / Float64(y_m * x)); else tmp = Float64(Float64(Float64(1.0 / z_m) / y_m) * Float64(Float64(1.0 / z_m) / x)); end return Float64(y_s * tmp) end
z_m = abs(z); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z_m) tmp = 0.0; if (z_m <= 0.52) tmp = 1.0 / (y_m * x); else tmp = ((1.0 / z_m) / y_m) * ((1.0 / z_m) / x); end tmp_2 = y_s * tmp; end
z_m = N[Abs[z], $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_, y$95$m_, z$95$m_] := N[(y$95$s * If[LessEqual[z$95$m, 0.52], N[(1.0 / N[(y$95$m * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(1.0 / z$95$m), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 0.52:\\
\;\;\;\;\frac{1}{y_m \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z_m}}{y_m} \cdot \frac{\frac{1}{z_m}}{x}\\
\end{array}
\end{array}
if z < 0.52000000000000002Initial program 94.8%
associate-/l/94.9%
metadata-eval94.9%
associate-*r/94.9%
associate-/l/94.8%
associate-*r/94.8%
associate-/l*94.8%
associate-/r/94.9%
/-rgt-identity94.9%
associate-*l*93.5%
*-commutative93.5%
sqr-neg93.5%
+-commutative93.5%
sqr-neg93.5%
fma-def93.5%
Simplified93.5%
Taylor expanded in z around 0 73.1%
if 0.52000000000000002 < z Initial program 88.5%
associate-/l/88.1%
metadata-eval88.1%
associate-*r/88.1%
associate-/l/88.5%
associate-*r/88.5%
associate-/l*88.1%
associate-/r/88.1%
/-rgt-identity88.1%
associate-*l*89.7%
*-commutative89.7%
sqr-neg89.7%
+-commutative89.7%
sqr-neg89.7%
fma-def89.7%
Simplified89.7%
Taylor expanded in z around inf 85.8%
associate-*r*85.7%
*-commutative85.7%
Simplified85.7%
expm1-log1p-u78.4%
expm1-udef51.4%
associate-/r*51.4%
pow-flip51.4%
metadata-eval51.4%
Applied egg-rr51.4%
expm1-def80.3%
expm1-log1p87.6%
Simplified87.6%
add-sqr-sqrt87.5%
*-commutative87.5%
times-frac87.2%
sqrt-pow187.3%
metadata-eval87.3%
unpow-187.3%
sqrt-pow190.6%
metadata-eval90.6%
unpow-190.6%
Applied egg-rr90.6%
Final simplification77.2%
z_m = (fabs.f64 z) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x y_m z_m) :precision binary64 (* y_s (if (<= z_m 0.52) (/ 1.0 (* y_m x)) (/ 1.0 (* x (* z_m y_m))))))
z_m = fabs(z);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if (z_m <= 0.52) {
tmp = 1.0 / (y_m * x);
} else {
tmp = 1.0 / (x * (z_m * y_m));
}
return y_s * tmp;
}
z_m = abs(z)
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z_m)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 0.52d0) then
tmp = 1.0d0 / (y_m * x)
else
tmp = 1.0d0 / (x * (z_m * y_m))
end if
code = y_s * tmp
end function
z_m = Math.abs(z);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if (z_m <= 0.52) {
tmp = 1.0 / (y_m * x);
} else {
tmp = 1.0 / (x * (z_m * y_m));
}
return y_s * tmp;
}
z_m = math.fabs(z) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): tmp = 0 if z_m <= 0.52: tmp = 1.0 / (y_m * x) else: tmp = 1.0 / (x * (z_m * y_m)) return y_s * tmp
z_m = abs(z) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) tmp = 0.0 if (z_m <= 0.52) tmp = Float64(1.0 / Float64(y_m * x)); else tmp = Float64(1.0 / Float64(x * Float64(z_m * y_m))); end return Float64(y_s * tmp) end
z_m = abs(z); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z_m) tmp = 0.0; if (z_m <= 0.52) tmp = 1.0 / (y_m * x); else tmp = 1.0 / (x * (z_m * y_m)); end tmp_2 = y_s * tmp; end
z_m = N[Abs[z], $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_, y$95$m_, z$95$m_] := N[(y$95$s * If[LessEqual[z$95$m, 0.52], N[(1.0 / N[(y$95$m * x), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x * N[(z$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 0.52:\\
\;\;\;\;\frac{1}{y_m \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(z_m \cdot y_m\right)}\\
\end{array}
\end{array}
if z < 0.52000000000000002Initial program 94.8%
associate-/l/94.9%
metadata-eval94.9%
associate-*r/94.9%
associate-/l/94.8%
associate-*r/94.8%
associate-/l*94.8%
associate-/r/94.9%
/-rgt-identity94.9%
associate-*l*93.5%
*-commutative93.5%
sqr-neg93.5%
+-commutative93.5%
sqr-neg93.5%
fma-def93.5%
Simplified93.5%
Taylor expanded in z around 0 73.1%
if 0.52000000000000002 < z Initial program 88.5%
associate-/l/88.1%
metadata-eval88.1%
associate-*r/88.1%
associate-/l/88.5%
associate-*r/88.5%
associate-/l*88.1%
associate-/r/88.1%
/-rgt-identity88.1%
associate-*l*89.7%
*-commutative89.7%
sqr-neg89.7%
+-commutative89.7%
sqr-neg89.7%
fma-def89.7%
Simplified89.7%
/-rgt-identity89.7%
fma-udef89.7%
+-commutative89.7%
*-commutative89.7%
associate-*l*88.1%
associate-/l*88.1%
add-sqr-sqrt53.3%
associate-/l*53.2%
*-commutative53.2%
sqrt-prod53.3%
hypot-1-def53.2%
*-commutative53.2%
sqrt-prod56.4%
hypot-1-def59.5%
Applied egg-rr59.5%
Taylor expanded in z around inf 58.2%
Taylor expanded in z around 0 37.9%
*-commutative37.9%
Simplified37.9%
Final simplification64.9%
z_m = (fabs.f64 z) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x y_m z_m) :precision binary64 (* y_s (/ 1.0 (* y_m x))))
z_m = fabs(z);
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z_m) {
return y_s * (1.0 / (y_m * x));
}
z_m = abs(z)
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z_m)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
code = y_s * (1.0d0 / (y_m * x))
end function
z_m = Math.abs(z);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z_m) {
return y_s * (1.0 / (y_m * x));
}
z_m = math.fabs(z) y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z_m): return y_s * (1.0 / (y_m * x))
z_m = abs(z) y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z_m) return Float64(y_s * Float64(1.0 / Float64(y_m * x))) end
z_m = abs(z); y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m, z_m) tmp = y_s * (1.0 / (y_m * x)); end
z_m = N[Abs[z], $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_, y$95$m_, z$95$m_] := N[(y$95$s * N[(1.0 / N[(y$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \frac{1}{y_m \cdot x}
\end{array}
Initial program 93.3%
associate-/l/93.3%
metadata-eval93.3%
associate-*r/93.3%
associate-/l/93.3%
associate-*r/93.3%
associate-/l*93.2%
associate-/r/93.3%
/-rgt-identity93.3%
associate-*l*92.6%
*-commutative92.6%
sqr-neg92.6%
+-commutative92.6%
sqr-neg92.6%
fma-def92.6%
Simplified92.6%
Taylor expanded in z around 0 59.5%
Final simplification59.5%
(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 2024021
(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)))))