
(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 #s(literal 1 binary64) y)
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
(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+301)
(/ (/ 1.0 x) t_0)
(/ (/ (sqrt (/ 1.0 y_m)) z_m) (* (* (hypot 1.0 z_m) (sqrt y_m)) x))))))z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z_m);
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+301) {
tmp = (1.0 / x) / t_0;
} else {
tmp = (sqrt((1.0 / y_m)) / z_m) / ((hypot(1.0, z_m) * sqrt(y_m)) * x);
}
return y_s * tmp;
}
z_m = Math.abs(z);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z_m;
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+301) {
tmp = (1.0 / x) / t_0;
} else {
tmp = (Math.sqrt((1.0 / y_m)) / z_m) / ((Math.hypot(1.0, z_m) * Math.sqrt(y_m)) * x);
}
return y_s * tmp;
}
z_m = math.fabs(z) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z_m] = sort([x, y_m, z_m]) 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+301: tmp = (1.0 / x) / t_0 else: tmp = (math.sqrt((1.0 / y_m)) / z_m) / ((math.hypot(1.0, z_m) * math.sqrt(y_m)) * x) return y_s * tmp
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z_m = sort([x, y_m, z_m]) 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+301) tmp = Float64(Float64(1.0 / x) / t_0); else tmp = Float64(Float64(sqrt(Float64(1.0 / y_m)) / z_m) / Float64(Float64(hypot(1.0, z_m) * sqrt(y_m)) * x)); end return Float64(y_s * tmp) end
z_m = abs(z);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z_m = num2cell(sort([x, y_m, z_m])){:}
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+301)
tmp = (1.0 / x) / t_0;
else
tmp = (sqrt((1.0 / y_m)) / z_m) / ((hypot(1.0, z_m) * sqrt(y_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]
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
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+301], N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / y$95$m), $MachinePrecision]], $MachinePrecision] / z$95$m), $MachinePrecision] / N[(N[(N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision] * N[Sqrt[y$95$m], $MachinePrecision]), $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)
\\
[x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\
\\
\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^{+301}:\\
\;\;\;\;\frac{\frac{1}{x}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\sqrt{\frac{1}{y\_m}}}{z\_m}}{\left(\mathsf{hypot}\left(1, z\_m\right) \cdot \sqrt{y\_m}\right) \cdot x}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 5.0000000000000004e301Initial program 94.3%
if 5.0000000000000004e301 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) Initial program 78.8%
associate-/l/78.8%
associate-*l*85.9%
*-commutative85.9%
sqr-neg85.9%
+-commutative85.9%
sqr-neg85.9%
fma-define85.9%
Simplified85.9%
associate-*r*85.9%
*-commutative85.9%
associate-/r*87.8%
*-commutative87.8%
associate-/l/87.9%
fma-undefine87.9%
+-commutative87.9%
associate-/r*78.8%
*-un-lft-identity78.8%
add-sqr-sqrt78.8%
times-frac78.8%
+-commutative78.8%
fma-undefine78.8%
*-commutative78.8%
sqrt-prod78.8%
fma-undefine78.8%
+-commutative78.8%
hypot-1-def78.8%
+-commutative78.8%
Applied egg-rr99.8%
associate-/l/99.8%
associate-*r/99.8%
*-rgt-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 90.6%
associate-*r/90.6%
*-rgt-identity90.6%
Simplified90.6%
Final simplification93.8%
z_m = (fabs.f64 z) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function. (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) (* t_0 x)))))
z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z_m);
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) / (t_0 * x));
}
z_m = Math.abs(z);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z_m;
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) / (t_0 * x));
}
z_m = math.fabs(z) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z_m] = sort([x, y_m, z_m]) 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) / (t_0 * x))
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z_m = sort([x, y_m, z_m]) 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(Float64(1.0 / t_0) / Float64(t_0 * x))) end
z_m = abs(z);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z_m = num2cell(sort([x, y_m, z_m])){:}
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) / (t_0 * 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]
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
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[(N[(1.0 / t$95$0), $MachinePrecision] / N[(t$95$0 * 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)
\\
[x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(1, z\_m\right) \cdot \sqrt{y\_m}\\
y\_s \cdot \frac{\frac{1}{t\_0}}{t\_0 \cdot x}
\end{array}
\end{array}
Initial program 92.0%
associate-/l/91.7%
associate-*l*92.1%
*-commutative92.1%
sqr-neg92.1%
+-commutative92.1%
sqr-neg92.1%
fma-define92.1%
Simplified92.1%
associate-*r*91.9%
*-commutative91.9%
associate-/r*92.0%
*-commutative92.0%
associate-/l/92.3%
fma-undefine92.3%
+-commutative92.3%
associate-/r*92.0%
*-un-lft-identity92.0%
add-sqr-sqrt44.9%
times-frac44.9%
+-commutative44.9%
fma-undefine44.9%
*-commutative44.9%
sqrt-prod44.9%
fma-undefine44.9%
+-commutative44.9%
hypot-1-def44.9%
+-commutative44.9%
Applied egg-rr48.1%
associate-/l/48.1%
associate-*r/48.2%
*-rgt-identity48.2%
*-commutative48.2%
Simplified48.2%
Final simplification48.2%
z_m = (fabs.f64 z)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
(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 2e+305)
(/ (/ 1.0 x) t_0)
(/ (/ 1.0 (* (hypot 1.0 z_m) (sqrt y_m))) (* (sqrt y_m) (* z_m x)))))))z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z_m);
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 <= 2e+305) {
tmp = (1.0 / x) / t_0;
} else {
tmp = (1.0 / (hypot(1.0, z_m) * sqrt(y_m))) / (sqrt(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);
assert x < y_m && y_m < z_m;
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 <= 2e+305) {
tmp = (1.0 / x) / t_0;
} else {
tmp = (1.0 / (Math.hypot(1.0, z_m) * Math.sqrt(y_m))) / (Math.sqrt(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) [x, y_m, z_m] = sort([x, y_m, z_m]) def code(y_s, x, y_m, z_m): t_0 = y_m * (1.0 + (z_m * z_m)) tmp = 0 if t_0 <= 2e+305: tmp = (1.0 / x) / t_0 else: tmp = (1.0 / (math.hypot(1.0, z_m) * math.sqrt(y_m))) / (math.sqrt(y_m) * (z_m * x)) return y_s * tmp
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z_m = sort([x, y_m, z_m]) 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 <= 2e+305) tmp = Float64(Float64(1.0 / x) / t_0); else tmp = Float64(Float64(1.0 / Float64(hypot(1.0, z_m) * sqrt(y_m))) / Float64(sqrt(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);
x, y_m, z_m = num2cell(sort([x, y_m, z_m])){:}
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 <= 2e+305)
tmp = (1.0 / x) / t_0;
else
tmp = (1.0 / (hypot(1.0, z_m) * sqrt(y_m))) / (sqrt(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]
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
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, 2e+305], N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision] * N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[y$95$m], $MachinePrecision] * N[(z$95$m * x), $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)
\\
[x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\
\\
\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 2 \cdot 10^{+305}:\\
\;\;\;\;\frac{\frac{1}{x}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\mathsf{hypot}\left(1, z\_m\right) \cdot \sqrt{y\_m}}}{\sqrt{y\_m} \cdot \left(z\_m \cdot x\right)}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 1.9999999999999999e305Initial program 94.3%
if 1.9999999999999999e305 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) Initial program 78.8%
associate-/l/78.8%
associate-*l*85.9%
*-commutative85.9%
sqr-neg85.9%
+-commutative85.9%
sqr-neg85.9%
fma-define85.9%
Simplified85.9%
associate-*r*85.9%
*-commutative85.9%
associate-/r*87.8%
*-commutative87.8%
associate-/l/87.9%
fma-undefine87.9%
+-commutative87.9%
associate-/r*78.8%
*-un-lft-identity78.8%
add-sqr-sqrt78.8%
times-frac78.8%
+-commutative78.8%
fma-undefine78.8%
*-commutative78.8%
sqrt-prod78.8%
fma-undefine78.8%
+-commutative78.8%
hypot-1-def78.8%
+-commutative78.8%
Applied egg-rr99.8%
associate-/l/99.8%
associate-*r/99.8%
*-rgt-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 88.1%
Final simplification93.4%
z_m = (fabs.f64 z)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z_m)
:precision binary64
(*
y_s
(if (<= (* z_m z_m) 1e+242)
(* (/ 1.0 y_m) (/ (/ 1.0 x) (fma z_m z_m 1.0)))
(/ 1.0 (* (* z_m x) (* z_m y_m))))))z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z_m);
double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if ((z_m * z_m) <= 1e+242) {
tmp = (1.0 / y_m) * ((1.0 / x) / fma(z_m, z_m, 1.0));
} else {
tmp = 1.0 / ((z_m * x) * (z_m * y_m));
}
return y_s * tmp;
}
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z_m = sort([x, y_m, z_m]) function code(y_s, x, y_m, z_m) tmp = 0.0 if (Float64(z_m * z_m) <= 1e+242) tmp = Float64(Float64(1.0 / y_m) * Float64(Float64(1.0 / x) / fma(z_m, z_m, 1.0))); else tmp = Float64(1.0 / Float64(Float64(z_m * x) * Float64(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]
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
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], 1e+242], N[(N[(1.0 / y$95$m), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / N[(z$95$m * z$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(z$95$m * x), $MachinePrecision] * 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)
\\
[x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 10^{+242}:\\
\;\;\;\;\frac{1}{y\_m} \cdot \frac{\frac{1}{x}}{\mathsf{fma}\left(z\_m, z\_m, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(z\_m \cdot x\right) \cdot \left(z\_m \cdot y\_m\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000005e242Initial program 96.9%
associate-/l/96.5%
associate-*l*96.5%
*-commutative96.5%
sqr-neg96.5%
+-commutative96.5%
sqr-neg96.5%
fma-define96.5%
Simplified96.5%
associate-*r*97.8%
*-commutative97.8%
associate-/r*98.2%
*-commutative98.2%
associate-/l/98.6%
associate-/r*96.9%
*-un-lft-identity96.9%
times-frac97.7%
Applied egg-rr97.7%
if 1.00000000000000005e242 < (*.f64 z z) Initial program 80.9%
associate-/l/80.9%
associate-*l*82.1%
*-commutative82.1%
sqr-neg82.1%
+-commutative82.1%
sqr-neg82.1%
fma-define82.1%
Simplified82.1%
Taylor expanded in z around inf 80.9%
associate-/r*80.9%
associate-/r*78.2%
associate-/l/78.1%
associate-/r*78.2%
Simplified78.2%
div-inv78.2%
inv-pow78.2%
metadata-eval78.2%
pow-prod-up43.6%
unpow243.6%
times-frac52.1%
pow-prod-up97.6%
metadata-eval97.6%
inv-pow97.6%
Applied egg-rr97.6%
clear-num97.6%
clear-num97.5%
frac-times97.6%
metadata-eval97.6%
div-inv97.6%
clear-num97.6%
/-rgt-identity97.6%
div-inv97.6%
clear-num97.7%
/-rgt-identity97.7%
*-commutative97.7%
Applied egg-rr97.7%
Final simplification97.7%
z_m = (fabs.f64 z)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
(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 2e+305) (/ (/ 1.0 x) t_0) (/ (/ 1.0 y_m) (* z_m (* z_m x)))))))z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z_m);
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 <= 2e+305) {
tmp = (1.0 / x) / t_0;
} else {
tmp = (1.0 / y_m) / (z_m * (z_m * x));
}
return y_s * tmp;
}
z_m = abs(z)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
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 <= 2d+305) then
tmp = (1.0d0 / x) / t_0
else
tmp = (1.0d0 / y_m) / (z_m * (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);
assert x < y_m && y_m < z_m;
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 <= 2e+305) {
tmp = (1.0 / x) / t_0;
} else {
tmp = (1.0 / y_m) / (z_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) [x, y_m, z_m] = sort([x, y_m, z_m]) def code(y_s, x, y_m, z_m): t_0 = y_m * (1.0 + (z_m * z_m)) tmp = 0 if t_0 <= 2e+305: tmp = (1.0 / x) / t_0 else: tmp = (1.0 / y_m) / (z_m * (z_m * x)) return y_s * tmp
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z_m = sort([x, y_m, z_m]) 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 <= 2e+305) tmp = Float64(Float64(1.0 / x) / t_0); else tmp = Float64(Float64(1.0 / y_m) / Float64(z_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);
x, y_m, z_m = num2cell(sort([x, y_m, z_m])){:}
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 <= 2e+305)
tmp = (1.0 / x) / t_0;
else
tmp = (1.0 / y_m) / (z_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]
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
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, 2e+305], N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(1.0 / y$95$m), $MachinePrecision] / N[(z$95$m * N[(z$95$m * x), $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)
\\
[x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\
\\
\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 2 \cdot 10^{+305}:\\
\;\;\;\;\frac{\frac{1}{x}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{z\_m \cdot \left(z\_m \cdot x\right)}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 1.9999999999999999e305Initial program 94.3%
if 1.9999999999999999e305 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) Initial program 78.8%
associate-/l/78.8%
associate-*l*85.9%
*-commutative85.9%
sqr-neg85.9%
+-commutative85.9%
sqr-neg85.9%
fma-define85.9%
Simplified85.9%
Taylor expanded in z around inf 78.8%
associate-/r*78.8%
associate-/r*87.9%
associate-/l/87.8%
associate-/r*87.9%
Simplified87.9%
div-inv87.9%
inv-pow87.9%
metadata-eval87.9%
pow-prod-up46.3%
unpow246.3%
times-frac51.3%
pow-prod-up90.8%
metadata-eval90.8%
inv-pow90.8%
Applied egg-rr90.8%
*-commutative90.8%
clear-num90.7%
frac-times87.9%
*-un-lft-identity87.9%
div-inv87.9%
clear-num87.9%
/-rgt-identity87.9%
*-commutative87.9%
Applied egg-rr87.9%
Final simplification93.4%
z_m = (fabs.f64 z) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z_m) :precision binary64 (* y_s (if (<= z_m 1.0) (/ (/ 1.0 y_m) x) (/ (/ 1.0 y_m) (* z_m (* z_m x))))))
z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z_m);
double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if (z_m <= 1.0) {
tmp = (1.0 / y_m) / x;
} else {
tmp = (1.0 / y_m) / (z_m * (z_m * x));
}
return y_s * tmp;
}
z_m = abs(z)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
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 <= 1.0d0) then
tmp = (1.0d0 / y_m) / x
else
tmp = (1.0d0 / y_m) / (z_m * (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);
assert x < y_m && y_m < z_m;
public static double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if (z_m <= 1.0) {
tmp = (1.0 / y_m) / x;
} else {
tmp = (1.0 / y_m) / (z_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) [x, y_m, z_m] = sort([x, y_m, z_m]) def code(y_s, x, y_m, z_m): tmp = 0 if z_m <= 1.0: tmp = (1.0 / y_m) / x else: tmp = (1.0 / y_m) / (z_m * (z_m * x)) return y_s * tmp
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z_m = sort([x, y_m, z_m]) function code(y_s, x, y_m, z_m) tmp = 0.0 if (z_m <= 1.0) tmp = Float64(Float64(1.0 / y_m) / x); else tmp = Float64(Float64(1.0 / y_m) / Float64(z_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);
x, y_m, z_m = num2cell(sort([x, y_m, z_m])){:}
function tmp_2 = code(y_s, x, y_m, z_m)
tmp = 0.0;
if (z_m <= 1.0)
tmp = (1.0 / y_m) / x;
else
tmp = (1.0 / y_m) / (z_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]
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z$95$m_] := N[(y$95$s * If[LessEqual[z$95$m, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x), $MachinePrecision], N[(N[(1.0 / y$95$m), $MachinePrecision] / N[(z$95$m * N[(z$95$m * x), $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)
\\
[x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 1:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{z\_m \cdot \left(z\_m \cdot x\right)}\\
\end{array}
\end{array}
if z < 1Initial program 95.2%
associate-/l/94.8%
associate-*l*94.9%
*-commutative94.9%
sqr-neg94.9%
+-commutative94.9%
sqr-neg94.9%
fma-define94.9%
Simplified94.9%
Taylor expanded in z around 0 73.1%
*-commutative73.1%
associate-/r*73.5%
Simplified73.5%
if 1 < z Initial program 83.4%
associate-/l/83.3%
associate-*l*84.7%
*-commutative84.7%
sqr-neg84.7%
+-commutative84.7%
sqr-neg84.7%
fma-define84.7%
Simplified84.7%
Taylor expanded in z around inf 81.5%
associate-/r*81.5%
associate-/r*84.5%
associate-/l/84.4%
associate-/r*84.5%
Simplified84.5%
div-inv84.5%
inv-pow84.5%
metadata-eval84.5%
pow-prod-up45.2%
unpow245.2%
times-frac45.2%
pow-prod-up90.0%
metadata-eval90.0%
inv-pow90.0%
Applied egg-rr90.0%
*-commutative90.0%
clear-num90.0%
frac-times88.8%
*-un-lft-identity88.8%
div-inv88.8%
clear-num88.8%
/-rgt-identity88.8%
*-commutative88.8%
Applied egg-rr88.8%
Final simplification77.7%
z_m = (fabs.f64 z) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z_m) :precision binary64 (* y_s (if (<= z_m 1.0) (/ (/ 1.0 y_m) x) (/ 1.0 (* (* z_m x) (* z_m y_m))))))
z_m = fabs(z);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z_m);
double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if (z_m <= 1.0) {
tmp = (1.0 / y_m) / x;
} else {
tmp = 1.0 / ((z_m * x) * (z_m * y_m));
}
return y_s * tmp;
}
z_m = abs(z)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
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 <= 1.0d0) then
tmp = (1.0d0 / y_m) / x
else
tmp = 1.0d0 / ((z_m * 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);
assert x < y_m && y_m < z_m;
public static double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if (z_m <= 1.0) {
tmp = (1.0 / y_m) / x;
} else {
tmp = 1.0 / ((z_m * 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) [x, y_m, z_m] = sort([x, y_m, z_m]) def code(y_s, x, y_m, z_m): tmp = 0 if z_m <= 1.0: tmp = (1.0 / y_m) / x else: tmp = 1.0 / ((z_m * x) * (z_m * y_m)) return y_s * tmp
z_m = abs(z) y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z_m = sort([x, y_m, z_m]) function code(y_s, x, y_m, z_m) tmp = 0.0 if (z_m <= 1.0) tmp = Float64(Float64(1.0 / y_m) / x); else tmp = Float64(1.0 / Float64(Float64(z_m * 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);
x, y_m, z_m = num2cell(sort([x, y_m, z_m])){:}
function tmp_2 = code(y_s, x, y_m, z_m)
tmp = 0.0;
if (z_m <= 1.0)
tmp = (1.0 / y_m) / x;
else
tmp = 1.0 / ((z_m * 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]
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z$95$m_] := N[(y$95$s * If[LessEqual[z$95$m, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x), $MachinePrecision], N[(1.0 / N[(N[(z$95$m * x), $MachinePrecision] * 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)
\\
[x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 1:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(z\_m \cdot x\right) \cdot \left(z\_m \cdot y\_m\right)}\\
\end{array}
\end{array}
if z < 1Initial program 95.2%
associate-/l/94.8%
associate-*l*94.9%
*-commutative94.9%
sqr-neg94.9%
+-commutative94.9%
sqr-neg94.9%
fma-define94.9%
Simplified94.9%
Taylor expanded in z around 0 73.1%
*-commutative73.1%
associate-/r*73.5%
Simplified73.5%
if 1 < z Initial program 83.4%
associate-/l/83.3%
associate-*l*84.7%
*-commutative84.7%
sqr-neg84.7%
+-commutative84.7%
sqr-neg84.7%
fma-define84.7%
Simplified84.7%
Taylor expanded in z around inf 81.5%
associate-/r*81.5%
associate-/r*84.5%
associate-/l/84.4%
associate-/r*84.5%
Simplified84.5%
div-inv84.5%
inv-pow84.5%
metadata-eval84.5%
pow-prod-up45.2%
unpow245.2%
times-frac45.2%
pow-prod-up90.0%
metadata-eval90.0%
inv-pow90.0%
Applied egg-rr90.0%
clear-num90.0%
clear-num90.0%
frac-times89.5%
metadata-eval89.5%
div-inv89.5%
clear-num89.6%
/-rgt-identity89.6%
div-inv89.6%
clear-num89.6%
/-rgt-identity89.6%
*-commutative89.6%
Applied egg-rr89.6%
Final simplification77.9%
z_m = (fabs.f64 z) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z_m) :precision binary64 (* y_s (if (<= z_m 1.0) (/ (/ 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);
assert(x < y_m && y_m < z_m);
double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if (z_m <= 1.0) {
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)
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
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 <= 1.0d0) 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);
assert x < y_m && y_m < z_m;
public static double code(double y_s, double x, double y_m, double z_m) {
double tmp;
if (z_m <= 1.0) {
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) [x, y_m, z_m] = sort([x, y_m, z_m]) def code(y_s, x, y_m, z_m): tmp = 0 if z_m <= 1.0: 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) x, y_m, z_m = sort([x, y_m, z_m]) function code(y_s, x, y_m, z_m) tmp = 0.0 if (z_m <= 1.0) tmp = Float64(Float64(1.0 / 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);
x, y_m, z_m = num2cell(sort([x, y_m, z_m])){:}
function tmp_2 = code(y_s, x, y_m, z_m)
tmp = 0.0;
if (z_m <= 1.0)
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]
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z$95$m_] := N[(y$95$s * If[LessEqual[z$95$m, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x), $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)
\\
[x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 1:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(z\_m \cdot y\_m\right)}\\
\end{array}
\end{array}
if z < 1Initial program 95.2%
associate-/l/94.8%
associate-*l*94.9%
*-commutative94.9%
sqr-neg94.9%
+-commutative94.9%
sqr-neg94.9%
fma-define94.9%
Simplified94.9%
Taylor expanded in z around 0 73.1%
*-commutative73.1%
associate-/r*73.5%
Simplified73.5%
if 1 < z Initial program 83.4%
associate-/l/83.3%
associate-*l*84.7%
*-commutative84.7%
sqr-neg84.7%
+-commutative84.7%
sqr-neg84.7%
fma-define84.7%
Simplified84.7%
associate-*r*86.7%
*-commutative86.7%
associate-/r*86.3%
*-commutative86.3%
associate-/l/86.4%
fma-undefine86.4%
+-commutative86.4%
associate-/r*83.4%
*-un-lft-identity83.4%
add-sqr-sqrt36.0%
times-frac36.1%
+-commutative36.1%
fma-undefine36.1%
*-commutative36.1%
sqrt-prod36.1%
fma-undefine36.1%
+-commutative36.1%
hypot-1-def36.1%
+-commutative36.1%
Applied egg-rr42.6%
associate-/l/42.6%
associate-*r/42.6%
*-rgt-identity42.6%
*-commutative42.6%
Simplified42.6%
Taylor expanded in z around 0 18.8%
Taylor expanded in z around inf 41.4%
Final simplification64.7%
z_m = (fabs.f64 z) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function. (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);
assert(x < y_m && y_m < z_m);
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)
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
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);
assert x < y_m && y_m < z_m;
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) [x, y_m, z_m] = sort([x, y_m, z_m]) 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) x, y_m, z_m = sort([x, y_m, z_m]) function code(y_s, x, y_m, z_m) return Float64(y_s * Float64(Float64(1.0 / y_m) / x)) end
z_m = abs(z);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z_m = num2cell(sort([x, y_m, z_m])){:}
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]
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z$95$m_] := N[(y$95$s * N[(N[(1.0 / y$95$m), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\
\\
y\_s \cdot \frac{\frac{1}{y\_m}}{x}
\end{array}
Initial program 92.0%
associate-/l/91.7%
associate-*l*92.1%
*-commutative92.1%
sqr-neg92.1%
+-commutative92.1%
sqr-neg92.1%
fma-define92.1%
Simplified92.1%
Taylor expanded in z around 0 59.3%
*-commutative59.3%
associate-/r*59.3%
Simplified59.3%
z_m = (fabs.f64 z) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function. (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);
assert(x < y_m && y_m < z_m);
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)
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
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);
assert x < y_m && y_m < z_m;
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) [x, y_m, z_m] = sort([x, y_m, z_m]) 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) x, y_m, z_m = sort([x, y_m, z_m]) 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);
x, y_m, z_m = num2cell(sort([x, y_m, z_m])){:}
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]
NOTE: x, y_m, and z_m should be sorted in increasing order before calling this function.
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)
\\
[x, y_m, z_m] = \mathsf{sort}([x, y_m, z_m])\\
\\
y\_s \cdot \frac{1}{y\_m \cdot x}
\end{array}
Initial program 92.0%
associate-/l/91.7%
associate-*l*92.1%
*-commutative92.1%
sqr-neg92.1%
+-commutative92.1%
sqr-neg92.1%
fma-define92.1%
Simplified92.1%
Taylor expanded in z around 0 59.3%
(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 2024084
(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)))))