
(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)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
:precision binary64
(let* ((t_0 (* y (+ 1.0 (* z_m z_m)))))
(*
x_s
(if (<= t_0 5e+307)
(/ (/ 1.0 x_m) t_0)
(/ (/ (sqrt (/ 1.0 y)) z_m) (* x_m (* (sqrt y) (hypot 1.0 z_m))))))))z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double t_0 = y * (1.0 + (z_m * z_m));
double tmp;
if (t_0 <= 5e+307) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = (sqrt((1.0 / y)) / z_m) / (x_m * (sqrt(y) * hypot(1.0, z_m)));
}
return x_s * tmp;
}
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
double t_0 = y * (1.0 + (z_m * z_m));
double tmp;
if (t_0 <= 5e+307) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = (Math.sqrt((1.0 / y)) / z_m) / (x_m * (Math.sqrt(y) * Math.hypot(1.0, z_m)));
}
return x_s * tmp;
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): t_0 = y * (1.0 + (z_m * z_m)) tmp = 0 if t_0 <= 5e+307: tmp = (1.0 / x_m) / t_0 else: tmp = (math.sqrt((1.0 / y)) / z_m) / (x_m * (math.sqrt(y) * math.hypot(1.0, z_m))) return x_s * tmp
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) t_0 = Float64(y * Float64(1.0 + Float64(z_m * z_m))) tmp = 0.0 if (t_0 <= 5e+307) tmp = Float64(Float64(1.0 / x_m) / t_0); else tmp = Float64(Float64(sqrt(Float64(1.0 / y)) / z_m) / Float64(x_m * Float64(sqrt(y) * hypot(1.0, z_m)))); end return Float64(x_s * tmp) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp_2 = code(x_s, x_m, y, z_m)
t_0 = y * (1.0 + (z_m * z_m));
tmp = 0.0;
if (t_0 <= 5e+307)
tmp = (1.0 / x_m) / t_0;
else
tmp = (sqrt((1.0 / y)) / z_m) / (x_m * (sqrt(y) * hypot(1.0, z_m)));
end
tmp_2 = x_s * tmp;
end
z_m = N[Abs[z], $MachinePrecision]
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := Block[{t$95$0 = N[(y * N[(1.0 + N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, 5e+307], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] / z$95$m), $MachinePrecision] / N[(x$95$m * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + z\_m \cdot z\_m\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\sqrt{\frac{1}{y}}}{z\_m}}{x\_m \cdot \left(\sqrt{y} \cdot \mathsf{hypot}\left(1, z\_m\right)\right)}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 5e307Initial program 94.3%
if 5e307 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) Initial program 61.4%
associate-/l/61.4%
associate-*l*74.1%
*-commutative74.1%
sqr-neg74.1%
+-commutative74.1%
sqr-neg74.1%
fma-define74.1%
Simplified74.1%
associate-*r*73.4%
*-commutative73.4%
associate-/r*73.3%
*-commutative73.3%
associate-/l/73.2%
fma-undefine73.2%
+-commutative73.2%
associate-/r*61.4%
*-un-lft-identity61.4%
add-sqr-sqrt61.4%
times-frac61.4%
+-commutative61.4%
fma-undefine61.4%
*-commutative61.4%
sqrt-prod61.4%
fma-undefine61.4%
+-commutative61.4%
hypot-1-def61.4%
+-commutative61.4%
Applied egg-rr99.5%
associate-/l/99.5%
associate-*r/99.5%
*-rgt-identity99.5%
*-commutative99.5%
associate-/r*99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in z around inf 81.5%
associate-*r/81.6%
*-rgt-identity81.6%
Simplified81.6%
Final simplification92.5%
z_m = (fabs.f64 z) x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z_m) :precision binary64 (* x_s (/ (/ (/ 1.0 (sqrt y)) (hypot 1.0 z_m)) (* x_m (* (sqrt y) (hypot 1.0 z_m))))))
z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
return x_s * (((1.0 / sqrt(y)) / hypot(1.0, z_m)) / (x_m * (sqrt(y) * hypot(1.0, z_m))));
}
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
return x_s * (((1.0 / Math.sqrt(y)) / Math.hypot(1.0, z_m)) / (x_m * (Math.sqrt(y) * Math.hypot(1.0, z_m))));
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): return x_s * (((1.0 / math.sqrt(y)) / math.hypot(1.0, z_m)) / (x_m * (math.sqrt(y) * math.hypot(1.0, z_m))))
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) return Float64(x_s * Float64(Float64(Float64(1.0 / sqrt(y)) / hypot(1.0, z_m)) / Float64(x_m * Float64(sqrt(y) * hypot(1.0, z_m))))) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp = code(x_s, x_m, y, z_m)
tmp = x_s * (((1.0 / sqrt(y)) / hypot(1.0, z_m)) / (x_m * (sqrt(y) * hypot(1.0, z_m))));
end
z_m = N[Abs[z], $MachinePrecision]
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := N[(x$95$s * N[(N[(N[(1.0 / N[Sqrt[y], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision]), $MachinePrecision] / N[(x$95$m * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
x\_s \cdot \frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\_m\right)}}{x\_m \cdot \left(\sqrt{y} \cdot \mathsf{hypot}\left(1, z\_m\right)\right)}
\end{array}
Initial program 89.6%
associate-/l/89.6%
associate-*l*89.5%
*-commutative89.5%
sqr-neg89.5%
+-commutative89.5%
sqr-neg89.5%
fma-define89.5%
Simplified89.5%
associate-*r*91.6%
*-commutative91.6%
associate-/r*91.3%
*-commutative91.3%
associate-/l/91.2%
fma-undefine91.2%
+-commutative91.2%
associate-/r*89.6%
*-un-lft-identity89.6%
add-sqr-sqrt43.4%
times-frac43.4%
+-commutative43.4%
fma-undefine43.4%
*-commutative43.4%
sqrt-prod43.4%
fma-undefine43.4%
+-commutative43.4%
hypot-1-def43.4%
+-commutative43.4%
Applied egg-rr48.9%
associate-/l/48.9%
associate-*r/48.9%
*-rgt-identity48.9%
*-commutative48.9%
associate-/r*48.9%
*-commutative48.9%
Simplified48.9%
Final simplification48.9%
z_m = (fabs.f64 z)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
:precision binary64
(let* ((t_0 (* y (+ 1.0 (* z_m z_m)))))
(*
x_s
(if (<= t_0 5e+307)
(/ (/ 1.0 x_m) t_0)
(/ (/ (/ 1.0 (* z_m x_m)) (sqrt y)) (* (sqrt y) z_m))))))z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double t_0 = y * (1.0 + (z_m * z_m));
double tmp;
if (t_0 <= 5e+307) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = ((1.0 / (z_m * x_m)) / sqrt(y)) / (sqrt(y) * z_m);
}
return x_s * tmp;
}
z_m = abs(z)
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: t_0
real(8) :: tmp
t_0 = y * (1.0d0 + (z_m * z_m))
if (t_0 <= 5d+307) then
tmp = (1.0d0 / x_m) / t_0
else
tmp = ((1.0d0 / (z_m * x_m)) / sqrt(y)) / (sqrt(y) * z_m)
end if
code = x_s * tmp
end function
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
double t_0 = y * (1.0 + (z_m * z_m));
double tmp;
if (t_0 <= 5e+307) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = ((1.0 / (z_m * x_m)) / Math.sqrt(y)) / (Math.sqrt(y) * z_m);
}
return x_s * tmp;
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): t_0 = y * (1.0 + (z_m * z_m)) tmp = 0 if t_0 <= 5e+307: tmp = (1.0 / x_m) / t_0 else: tmp = ((1.0 / (z_m * x_m)) / math.sqrt(y)) / (math.sqrt(y) * z_m) return x_s * tmp
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) t_0 = Float64(y * Float64(1.0 + Float64(z_m * z_m))) tmp = 0.0 if (t_0 <= 5e+307) tmp = Float64(Float64(1.0 / x_m) / t_0); else tmp = Float64(Float64(Float64(1.0 / Float64(z_m * x_m)) / sqrt(y)) / Float64(sqrt(y) * z_m)); end return Float64(x_s * tmp) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp_2 = code(x_s, x_m, y, z_m)
t_0 = y * (1.0 + (z_m * z_m));
tmp = 0.0;
if (t_0 <= 5e+307)
tmp = (1.0 / x_m) / t_0;
else
tmp = ((1.0 / (z_m * x_m)) / sqrt(y)) / (sqrt(y) * z_m);
end
tmp_2 = x_s * tmp;
end
z_m = N[Abs[z], $MachinePrecision]
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := Block[{t$95$0 = N[(y * N[(1.0 + N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, 5e+307], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[(1.0 / N[(z$95$m * x$95$m), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[y], $MachinePrecision] * z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + z\_m \cdot z\_m\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{z\_m \cdot x\_m}}{\sqrt{y}}}{\sqrt{y} \cdot z\_m}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 5e307Initial program 94.3%
if 5e307 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) Initial program 61.4%
associate-/l/61.4%
associate-*l*74.1%
*-commutative74.1%
sqr-neg74.1%
+-commutative74.1%
sqr-neg74.1%
fma-define74.1%
Simplified74.1%
associate-*r*73.4%
*-commutative73.4%
associate-/r*73.3%
*-commutative73.3%
associate-/l/73.2%
fma-undefine73.2%
+-commutative73.2%
associate-/r*61.4%
*-un-lft-identity61.4%
add-sqr-sqrt61.4%
times-frac61.4%
+-commutative61.4%
fma-undefine61.4%
*-commutative61.4%
sqrt-prod61.4%
fma-undefine61.4%
+-commutative61.4%
hypot-1-def61.4%
+-commutative61.4%
Applied egg-rr99.5%
associate-/l/99.5%
associate-*r/99.5%
*-rgt-identity99.5%
*-commutative99.5%
associate-/r*99.5%
*-commutative99.5%
Simplified99.5%
Applied egg-rr72.4%
*-lft-identity72.4%
*-commutative72.4%
Simplified72.4%
Taylor expanded in z around inf 72.4%
sqr-pow72.4%
associate-/l*99.4%
metadata-eval99.4%
unpow-199.4%
*-commutative99.4%
metadata-eval99.4%
unpow-199.4%
*-commutative99.4%
Applied egg-rr99.4%
associate-*l/99.5%
associate-*r/99.5%
associate-*l/99.5%
associate-*r/99.6%
*-rgt-identity99.6%
associate-/r*99.6%
associate-/l/99.5%
Simplified99.5%
Final simplification95.1%
z_m = (fabs.f64 z)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
:precision binary64
(*
x_s
(if (<= (* z_m z_m) 4e+303)
(/ 1.0 (* y (* x_m (fma z_m z_m 1.0))))
(* (/ (/ 1.0 y) z_m) (/ (/ 1.0 x_m) z_m)))))z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 4e+303) {
tmp = 1.0 / (y * (x_m * fma(z_m, z_m, 1.0)));
} else {
tmp = ((1.0 / y) / z_m) * ((1.0 / x_m) / z_m);
}
return x_s * tmp;
}
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) tmp = 0.0 if (Float64(z_m * z_m) <= 4e+303) tmp = Float64(1.0 / Float64(y * Float64(x_m * fma(z_m, z_m, 1.0)))); else tmp = Float64(Float64(Float64(1.0 / y) / z_m) * Float64(Float64(1.0 / x_m) / z_m)); end return Float64(x_s * tmp) end
z_m = N[Abs[z], $MachinePrecision]
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := N[(x$95$s * If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 4e+303], N[(1.0 / N[(y * N[(x$95$m * N[(z$95$m * z$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / y), $MachinePrecision] / z$95$m), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 4 \cdot 10^{+303}:\\
\;\;\;\;\frac{1}{y \cdot \left(x\_m \cdot \mathsf{fma}\left(z\_m, z\_m, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{z\_m} \cdot \frac{\frac{1}{x\_m}}{z\_m}\\
\end{array}
\end{array}
if (*.f64 z z) < 4e303Initial program 95.7%
associate-/l/95.7%
associate-*l*95.7%
*-commutative95.7%
sqr-neg95.7%
+-commutative95.7%
sqr-neg95.7%
fma-define95.7%
Simplified95.7%
if 4e303 < (*.f64 z z) Initial program 70.0%
associate-/l/70.0%
associate-*l*70.0%
*-commutative70.0%
sqr-neg70.0%
+-commutative70.0%
sqr-neg70.0%
fma-define70.0%
Simplified70.0%
associate-*r*69.3%
*-commutative69.3%
associate-/r*69.1%
*-commutative69.1%
associate-/l/69.1%
fma-undefine69.1%
+-commutative69.1%
associate-/r*70.0%
*-un-lft-identity70.0%
add-sqr-sqrt28.7%
times-frac28.7%
+-commutative28.7%
fma-undefine28.7%
*-commutative28.7%
sqrt-prod28.7%
fma-undefine28.7%
+-commutative28.7%
hypot-1-def28.7%
+-commutative28.7%
Applied egg-rr44.1%
associate-/l/44.1%
associate-*r/44.1%
*-rgt-identity44.1%
*-commutative44.1%
associate-/r*44.1%
*-commutative44.1%
Simplified44.1%
Taylor expanded in z around inf 70.0%
associate-*r*69.3%
associate-/r*69.1%
*-commutative69.1%
associate-/r*69.1%
associate-/l/70.0%
*-commutative70.0%
Simplified70.0%
associate-/r*69.1%
div-inv69.1%
unpow269.1%
times-frac97.8%
Applied egg-rr97.8%
z_m = (fabs.f64 z)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
:precision binary64
(let* ((t_0 (* y (+ 1.0 (* z_m z_m)))))
(*
x_s
(if (<= t_0 5e+307)
(/ (/ 1.0 x_m) t_0)
(* (/ (/ 1.0 y) z_m) (/ (/ 1.0 x_m) z_m))))))z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double t_0 = y * (1.0 + (z_m * z_m));
double tmp;
if (t_0 <= 5e+307) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = ((1.0 / y) / z_m) * ((1.0 / x_m) / z_m);
}
return x_s * tmp;
}
z_m = abs(z)
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: t_0
real(8) :: tmp
t_0 = y * (1.0d0 + (z_m * z_m))
if (t_0 <= 5d+307) then
tmp = (1.0d0 / x_m) / t_0
else
tmp = ((1.0d0 / y) / z_m) * ((1.0d0 / x_m) / z_m)
end if
code = x_s * tmp
end function
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
double t_0 = y * (1.0 + (z_m * z_m));
double tmp;
if (t_0 <= 5e+307) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = ((1.0 / y) / z_m) * ((1.0 / x_m) / z_m);
}
return x_s * tmp;
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): t_0 = y * (1.0 + (z_m * z_m)) tmp = 0 if t_0 <= 5e+307: tmp = (1.0 / x_m) / t_0 else: tmp = ((1.0 / y) / z_m) * ((1.0 / x_m) / z_m) return x_s * tmp
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) t_0 = Float64(y * Float64(1.0 + Float64(z_m * z_m))) tmp = 0.0 if (t_0 <= 5e+307) tmp = Float64(Float64(1.0 / x_m) / t_0); else tmp = Float64(Float64(Float64(1.0 / y) / z_m) * Float64(Float64(1.0 / x_m) / z_m)); end return Float64(x_s * tmp) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp_2 = code(x_s, x_m, y, z_m)
t_0 = y * (1.0 + (z_m * z_m));
tmp = 0.0;
if (t_0 <= 5e+307)
tmp = (1.0 / x_m) / t_0;
else
tmp = ((1.0 / y) / z_m) * ((1.0 / x_m) / z_m);
end
tmp_2 = x_s * tmp;
end
z_m = N[Abs[z], $MachinePrecision]
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := Block[{t$95$0 = N[(y * N[(1.0 + N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, 5e+307], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[(1.0 / y), $MachinePrecision] / z$95$m), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + z\_m \cdot z\_m\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{z\_m} \cdot \frac{\frac{1}{x\_m}}{z\_m}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 5e307Initial program 94.3%
if 5e307 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) Initial program 61.4%
associate-/l/61.4%
associate-*l*74.1%
*-commutative74.1%
sqr-neg74.1%
+-commutative74.1%
sqr-neg74.1%
fma-define74.1%
Simplified74.1%
associate-*r*73.4%
*-commutative73.4%
associate-/r*73.3%
*-commutative73.3%
associate-/l/73.2%
fma-undefine73.2%
+-commutative73.2%
associate-/r*61.4%
*-un-lft-identity61.4%
add-sqr-sqrt61.4%
times-frac61.4%
+-commutative61.4%
fma-undefine61.4%
*-commutative61.4%
sqrt-prod61.4%
fma-undefine61.4%
+-commutative61.4%
hypot-1-def61.4%
+-commutative61.4%
Applied egg-rr99.5%
associate-/l/99.5%
associate-*r/99.5%
*-rgt-identity99.5%
*-commutative99.5%
associate-/r*99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in z around inf 61.4%
associate-*r*73.4%
associate-/r*73.3%
*-commutative73.3%
associate-/r*73.3%
associate-/l/74.3%
*-commutative74.3%
Simplified74.3%
associate-/r*73.3%
div-inv73.2%
unpow273.2%
times-frac99.0%
Applied egg-rr99.0%
z_m = (fabs.f64 z)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
:precision binary64
(*
x_s
(if (<= (* z_m z_m) 4e-6)
(/ (/ 1.0 x_m) y)
(* (/ (/ 1.0 y) z_m) (/ (/ 1.0 x_m) z_m)))))z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 4e-6) {
tmp = (1.0 / x_m) / y;
} else {
tmp = ((1.0 / y) / z_m) * ((1.0 / x_m) / z_m);
}
return x_s * tmp;
}
z_m = abs(z)
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((z_m * z_m) <= 4d-6) then
tmp = (1.0d0 / x_m) / y
else
tmp = ((1.0d0 / y) / z_m) * ((1.0d0 / x_m) / z_m)
end if
code = x_s * tmp
end function
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 4e-6) {
tmp = (1.0 / x_m) / y;
} else {
tmp = ((1.0 / y) / z_m) * ((1.0 / x_m) / z_m);
}
return x_s * tmp;
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): tmp = 0 if (z_m * z_m) <= 4e-6: tmp = (1.0 / x_m) / y else: tmp = ((1.0 / y) / z_m) * ((1.0 / x_m) / z_m) return x_s * tmp
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) tmp = 0.0 if (Float64(z_m * z_m) <= 4e-6) tmp = Float64(Float64(1.0 / x_m) / y); else tmp = Float64(Float64(Float64(1.0 / y) / z_m) * Float64(Float64(1.0 / x_m) / z_m)); end return Float64(x_s * tmp) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp_2 = code(x_s, x_m, y, z_m)
tmp = 0.0;
if ((z_m * z_m) <= 4e-6)
tmp = (1.0 / x_m) / y;
else
tmp = ((1.0 / y) / z_m) * ((1.0 / x_m) / z_m);
end
tmp_2 = x_s * tmp;
end
z_m = N[Abs[z], $MachinePrecision]
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := N[(x$95$s * If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 4e-6], N[(N[(1.0 / x$95$m), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(1.0 / y), $MachinePrecision] / z$95$m), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 4 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{z\_m} \cdot \frac{\frac{1}{x\_m}}{z\_m}\\
\end{array}
\end{array}
if (*.f64 z z) < 3.99999999999999982e-6Initial program 99.7%
Taylor expanded in z around 0 99.3%
if 3.99999999999999982e-6 < (*.f64 z z) Initial program 79.9%
associate-/l/79.9%
associate-*l*79.8%
*-commutative79.8%
sqr-neg79.8%
+-commutative79.8%
sqr-neg79.8%
fma-define79.8%
Simplified79.8%
associate-*r*83.8%
*-commutative83.8%
associate-/r*83.3%
*-commutative83.3%
associate-/l/83.2%
fma-undefine83.2%
+-commutative83.2%
associate-/r*79.9%
*-un-lft-identity79.9%
add-sqr-sqrt37.0%
times-frac37.0%
+-commutative37.0%
fma-undefine37.0%
*-commutative37.0%
sqrt-prod37.0%
fma-undefine37.0%
+-commutative37.0%
hypot-1-def37.0%
+-commutative37.0%
Applied egg-rr47.8%
associate-/l/47.8%
associate-*r/47.8%
*-rgt-identity47.8%
*-commutative47.8%
associate-/r*47.8%
*-commutative47.8%
Simplified47.8%
Taylor expanded in z around inf 79.9%
associate-*r*83.8%
associate-/r*83.3%
*-commutative83.3%
associate-/r*83.2%
associate-/l/80.0%
*-commutative80.0%
Simplified80.0%
associate-/r*83.2%
div-inv83.2%
unpow283.2%
times-frac96.3%
Applied egg-rr96.3%
z_m = (fabs.f64 z)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
:precision binary64
(*
x_s
(if (<= (* z_m z_m) 4e-6)
(/ (/ 1.0 x_m) y)
(/ (/ (/ (/ 1.0 y) x_m) z_m) z_m))))z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 4e-6) {
tmp = (1.0 / x_m) / y;
} else {
tmp = (((1.0 / y) / x_m) / z_m) / z_m;
}
return x_s * tmp;
}
z_m = abs(z)
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((z_m * z_m) <= 4d-6) then
tmp = (1.0d0 / x_m) / y
else
tmp = (((1.0d0 / y) / x_m) / z_m) / z_m
end if
code = x_s * tmp
end function
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 4e-6) {
tmp = (1.0 / x_m) / y;
} else {
tmp = (((1.0 / y) / x_m) / z_m) / z_m;
}
return x_s * tmp;
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): tmp = 0 if (z_m * z_m) <= 4e-6: tmp = (1.0 / x_m) / y else: tmp = (((1.0 / y) / x_m) / z_m) / z_m return x_s * tmp
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) tmp = 0.0 if (Float64(z_m * z_m) <= 4e-6) tmp = Float64(Float64(1.0 / x_m) / y); else tmp = Float64(Float64(Float64(Float64(1.0 / y) / x_m) / z_m) / z_m); end return Float64(x_s * tmp) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp_2 = code(x_s, x_m, y, z_m)
tmp = 0.0;
if ((z_m * z_m) <= 4e-6)
tmp = (1.0 / x_m) / y;
else
tmp = (((1.0 / y) / x_m) / z_m) / z_m;
end
tmp_2 = x_s * tmp;
end
z_m = N[Abs[z], $MachinePrecision]
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := N[(x$95$s * If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 4e-6], N[(N[(1.0 / x$95$m), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(N[(1.0 / y), $MachinePrecision] / x$95$m), $MachinePrecision] / z$95$m), $MachinePrecision] / z$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 4 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\frac{1}{y}}{x\_m}}{z\_m}}{z\_m}\\
\end{array}
\end{array}
if (*.f64 z z) < 3.99999999999999982e-6Initial program 99.7%
Taylor expanded in z around 0 99.3%
if 3.99999999999999982e-6 < (*.f64 z z) Initial program 79.9%
associate-/l/79.9%
associate-*l*79.8%
*-commutative79.8%
sqr-neg79.8%
+-commutative79.8%
sqr-neg79.8%
fma-define79.8%
Simplified79.8%
Taylor expanded in z around inf 79.8%
add-sqr-sqrt64.6%
pow264.6%
sqrt-div40.2%
metadata-eval40.2%
associate-*r*43.6%
*-commutative43.6%
sqrt-prod43.6%
*-commutative43.6%
sqrt-pow146.8%
metadata-eval46.8%
pow146.8%
Applied egg-rr46.8%
unpow246.8%
frac-times46.7%
metadata-eval46.7%
*-commutative46.7%
*-commutative46.7%
swap-sqr43.5%
unpow243.5%
add-sqr-sqrt83.8%
*-commutative83.8%
associate-/l/83.3%
associate-/l/83.2%
unpow283.2%
associate-/r*88.6%
Applied egg-rr88.6%
z_m = (fabs.f64 z)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
:precision binary64
(*
x_s
(if (<= (* z_m z_m) 1.0)
(/ (/ 1.0 x_m) y)
(/ (/ 1.0 y) (* x_m (* z_m z_m))))))z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 1.0) {
tmp = (1.0 / x_m) / y;
} else {
tmp = (1.0 / y) / (x_m * (z_m * z_m));
}
return x_s * tmp;
}
z_m = abs(z)
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((z_m * z_m) <= 1.0d0) then
tmp = (1.0d0 / x_m) / y
else
tmp = (1.0d0 / y) / (x_m * (z_m * z_m))
end if
code = x_s * tmp
end function
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 1.0) {
tmp = (1.0 / x_m) / y;
} else {
tmp = (1.0 / y) / (x_m * (z_m * z_m));
}
return x_s * tmp;
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): tmp = 0 if (z_m * z_m) <= 1.0: tmp = (1.0 / x_m) / y else: tmp = (1.0 / y) / (x_m * (z_m * z_m)) return x_s * tmp
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) tmp = 0.0 if (Float64(z_m * z_m) <= 1.0) tmp = Float64(Float64(1.0 / x_m) / y); else tmp = Float64(Float64(1.0 / y) / Float64(x_m * Float64(z_m * z_m))); end return Float64(x_s * tmp) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp_2 = code(x_s, x_m, y, z_m)
tmp = 0.0;
if ((z_m * z_m) <= 1.0)
tmp = (1.0 / x_m) / y;
else
tmp = (1.0 / y) / (x_m * (z_m * z_m));
end
tmp_2 = x_s * tmp;
end
z_m = N[Abs[z], $MachinePrecision]
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := N[(x$95$s * If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 1.0], N[(N[(1.0 / x$95$m), $MachinePrecision] / y), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] / N[(x$95$m * N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 1:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{x\_m \cdot \left(z\_m \cdot z\_m\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 1Initial program 99.7%
Taylor expanded in z around 0 99.3%
if 1 < (*.f64 z z) Initial program 79.9%
associate-/l/79.9%
associate-*l*79.8%
*-commutative79.8%
sqr-neg79.8%
+-commutative79.8%
sqr-neg79.8%
fma-define79.8%
Simplified79.8%
associate-*r*83.8%
*-commutative83.8%
associate-/r*83.3%
*-commutative83.3%
associate-/l/83.2%
fma-undefine83.2%
+-commutative83.2%
associate-/r*79.9%
*-un-lft-identity79.9%
add-sqr-sqrt37.0%
times-frac37.0%
+-commutative37.0%
fma-undefine37.0%
*-commutative37.0%
sqrt-prod37.0%
fma-undefine37.0%
+-commutative37.0%
hypot-1-def37.0%
+-commutative37.0%
Applied egg-rr47.8%
associate-/l/47.8%
associate-*r/47.8%
*-rgt-identity47.8%
*-commutative47.8%
associate-/r*47.8%
*-commutative47.8%
Simplified47.8%
Taylor expanded in z around inf 79.9%
associate-*r*83.8%
associate-/r*83.3%
*-commutative83.3%
associate-/r*83.2%
associate-/l/80.0%
*-commutative80.0%
Simplified80.0%
unpow280.0%
Applied egg-rr80.0%
z_m = (fabs.f64 z)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
:precision binary64
(*
x_s
(if (<= (* z_m z_m) 1.0)
(/ (/ 1.0 x_m) y)
(/ 1.0 (* y (* x_m (* z_m z_m)))))))z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 1.0) {
tmp = (1.0 / x_m) / y;
} else {
tmp = 1.0 / (y * (x_m * (z_m * z_m)));
}
return x_s * tmp;
}
z_m = abs(z)
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if ((z_m * z_m) <= 1.0d0) then
tmp = (1.0d0 / x_m) / y
else
tmp = 1.0d0 / (y * (x_m * (z_m * z_m)))
end if
code = x_s * tmp
end function
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
double tmp;
if ((z_m * z_m) <= 1.0) {
tmp = (1.0 / x_m) / y;
} else {
tmp = 1.0 / (y * (x_m * (z_m * z_m)));
}
return x_s * tmp;
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): tmp = 0 if (z_m * z_m) <= 1.0: tmp = (1.0 / x_m) / y else: tmp = 1.0 / (y * (x_m * (z_m * z_m))) return x_s * tmp
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) tmp = 0.0 if (Float64(z_m * z_m) <= 1.0) tmp = Float64(Float64(1.0 / x_m) / y); else tmp = Float64(1.0 / Float64(y * Float64(x_m * Float64(z_m * z_m)))); end return Float64(x_s * tmp) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp_2 = code(x_s, x_m, y, z_m)
tmp = 0.0;
if ((z_m * z_m) <= 1.0)
tmp = (1.0 / x_m) / y;
else
tmp = 1.0 / (y * (x_m * (z_m * z_m)));
end
tmp_2 = x_s * tmp;
end
z_m = N[Abs[z], $MachinePrecision]
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := N[(x$95$s * If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 1.0], N[(N[(1.0 / x$95$m), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(y * N[(x$95$m * N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 1:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y \cdot \left(x\_m \cdot \left(z\_m \cdot z\_m\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 1Initial program 99.7%
Taylor expanded in z around 0 99.3%
if 1 < (*.f64 z z) Initial program 79.9%
associate-/l/79.9%
associate-*l*79.8%
*-commutative79.8%
sqr-neg79.8%
+-commutative79.8%
sqr-neg79.8%
fma-define79.8%
Simplified79.8%
Taylor expanded in z around inf 79.8%
unpow280.0%
Applied egg-rr79.8%
z_m = (fabs.f64 z) x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z_m) :precision binary64 (* x_s (/ 1.0 (* y x_m))))
z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
return x_s * (1.0 / (y * x_m));
}
z_m = abs(z)
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
code = x_s * (1.0d0 / (y * x_m))
end function
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
return x_s * (1.0 / (y * x_m));
}
z_m = math.fabs(z) x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z_m] = sort([x_m, y, z_m]) def code(x_s, x_m, y, z_m): return x_s * (1.0 / (y * x_m))
z_m = abs(z) x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z_m = sort([x_m, y, z_m]) function code(x_s, x_m, y, z_m) return Float64(x_s * Float64(1.0 / Float64(y * x_m))) end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp = code(x_s, x_m, y, z_m)
tmp = x_s * (1.0 / (y * x_m));
end
z_m = N[Abs[z], $MachinePrecision]
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := N[(x$95$s * N[(1.0 / N[(y * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
x\_s \cdot \frac{1}{y \cdot x\_m}
\end{array}
Initial program 89.6%
associate-/l/89.6%
associate-*l*89.5%
*-commutative89.5%
sqr-neg89.5%
+-commutative89.5%
sqr-neg89.5%
fma-define89.5%
Simplified89.5%
Taylor expanded in z around 0 56.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* z z))) (t_1 (* y t_0)) (t_2 (/ (/ 1.0 y) (* t_0 x))))
(if (< t_1 (- INFINITY))
t_2
(if (< t_1 8.680743250567252e+305) (/ (/ 1.0 x) (* t_0 y)) t_2))))
double code(double x, double y, double z) {
double t_0 = 1.0 + (z * z);
double t_1 = y * t_0;
double t_2 = (1.0 / y) / (t_0 * x);
double tmp;
if (t_1 < -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 < 8.680743250567252e+305) {
tmp = (1.0 / x) / (t_0 * y);
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = 1.0 + (z * z);
double t_1 = y * t_0;
double t_2 = (1.0 / y) / (t_0 * x);
double tmp;
if (t_1 < -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if (t_1 < 8.680743250567252e+305) {
tmp = (1.0 / x) / (t_0 * y);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + (z * z) t_1 = y * t_0 t_2 = (1.0 / y) / (t_0 * x) tmp = 0 if t_1 < -math.inf: tmp = t_2 elif t_1 < 8.680743250567252e+305: tmp = (1.0 / x) / (t_0 * y) else: tmp = t_2 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(z * z)) t_1 = Float64(y * t_0) t_2 = Float64(Float64(1.0 / y) / Float64(t_0 * x)) tmp = 0.0 if (t_1 < Float64(-Inf)) tmp = t_2; elseif (t_1 < 8.680743250567252e+305) tmp = Float64(Float64(1.0 / x) / Float64(t_0 * y)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + (z * z); t_1 = y * t_0; t_2 = (1.0 / y) / (t_0 * x); tmp = 0.0; if (t_1 < -Inf) tmp = t_2; elseif (t_1 < 8.680743250567252e+305) tmp = (1.0 / x) / (t_0 * y); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 / y), $MachinePrecision] / N[(t$95$0 * x), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$1, (-Infinity)], t$95$2, If[Less[t$95$1, 8.680743250567252e+305], N[(N[(1.0 / x), $MachinePrecision] / N[(t$95$0 * y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + z \cdot z\\
t_1 := y \cdot t\_0\\
t_2 := \frac{\frac{1}{y}}{t\_0 \cdot x}\\
\mathbf{if}\;t\_1 < -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 < 8.680743250567252 \cdot 10^{+305}:\\
\;\;\;\;\frac{\frac{1}{x}}{t\_0 \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024118
(FPCore (x y z)
:name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (if (< (* y (+ 1 (* z z))) -inf.0) (/ (/ 1 y) (* (+ 1 (* z z)) x)) (if (< (* y (+ 1 (* z z))) 868074325056725200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (/ 1 x) (* (+ 1 (* z z)) y)) (/ (/ 1 y) (* (+ 1 (* z z)) x)))))
(/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))