
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(let* ((t_0 (* z (sqrt y_m))))
(*
y_s
(*
x_s
(if (<= (* z z) 2e+293)
(/ (/ 1.0 y_m) (* x_m (fma z z 1.0)))
(/ (/ 1.0 (* x_m t_0)) t_0))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double t_0 = z * sqrt(y_m);
double tmp;
if ((z * z) <= 2e+293) {
tmp = (1.0 / y_m) / (x_m * fma(z, z, 1.0));
} else {
tmp = (1.0 / (x_m * t_0)) / t_0;
}
return y_s * (x_s * tmp);
}
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) t_0 = Float64(z * sqrt(y_m)) tmp = 0.0 if (Float64(z * z) <= 2e+293) tmp = Float64(Float64(1.0 / y_m) / Float64(x_m * fma(z, z, 1.0))); else tmp = Float64(Float64(1.0 / Float64(x_m * t_0)) / t_0); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(z * N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 2e+293], N[(N[(1.0 / y$95$m), $MachinePrecision] / N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(x$95$m * t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := z \cdot \sqrt{y\_m}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+293}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x\_m \cdot t\_0}}{t\_0}\\
\end{array}\right)
\end{array}
\end{array}
if (*.f64 z z) < 1.9999999999999998e293Initial program 98.1%
remove-double-neg98.1%
distribute-lft-neg-out98.1%
distribute-rgt-neg-in98.1%
associate-/r*97.6%
associate-/l/97.4%
associate-/l/98.3%
distribute-lft-neg-out98.3%
distribute-rgt-neg-in98.3%
distribute-lft-neg-in98.3%
remove-double-neg98.3%
sqr-neg98.3%
+-commutative98.3%
sqr-neg98.3%
fma-define98.3%
*-commutative98.3%
Simplified98.3%
*-commutative98.3%
associate-*r*97.6%
*-commutative97.6%
fma-undefine97.6%
+-commutative97.6%
associate-/l/98.1%
*-un-lft-identity98.1%
add-sqr-sqrt46.9%
times-frac47.0%
+-commutative47.0%
fma-undefine47.0%
*-commutative47.0%
sqrt-prod47.0%
fma-undefine47.0%
+-commutative47.0%
hypot-1-def47.0%
+-commutative47.0%
Applied egg-rr47.5%
Taylor expanded in y around 0 97.6%
associate-/r*98.1%
associate-/r*97.6%
associate-/l/97.4%
associate-/r*97.6%
associate-/l/95.8%
+-commutative95.8%
unpow295.8%
fma-define95.8%
Simplified95.8%
if 1.9999999999999998e293 < (*.f64 z z) Initial program 75.1%
remove-double-neg75.1%
distribute-lft-neg-out75.1%
distribute-rgt-neg-in75.1%
associate-/r*74.7%
associate-/l/74.6%
associate-/l/74.6%
distribute-lft-neg-out74.6%
distribute-rgt-neg-in74.6%
distribute-lft-neg-in74.6%
remove-double-neg74.6%
sqr-neg74.6%
+-commutative74.6%
sqr-neg74.6%
fma-define74.6%
*-commutative74.6%
Simplified74.6%
Taylor expanded in z around inf 74.6%
*-un-lft-identity74.6%
associate-/r*74.6%
pow-flip75.7%
metadata-eval75.7%
*-commutative75.7%
Applied egg-rr75.7%
*-lft-identity75.7%
*-commutative75.7%
Simplified75.7%
div-inv75.7%
metadata-eval75.7%
pow-flip74.6%
associate-/r*74.7%
times-frac75.1%
*-commutative75.1%
add-sqr-sqrt40.8%
times-frac40.8%
*-commutative40.8%
sqrt-prod40.8%
sqrt-pow140.8%
metadata-eval40.8%
pow140.8%
*-commutative40.8%
sqrt-prod40.8%
sqrt-pow151.2%
metadata-eval51.2%
pow151.2%
Applied egg-rr51.2%
associate-*l/51.2%
*-lft-identity51.2%
associate-/l/51.2%
Simplified51.2%
Final simplification82.9%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (let* ((t_0 (* (hypot 1.0 z) (sqrt y_m)))) (* y_s (* x_s (/ (/ 1.0 t_0) (* t_0 x_m))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double t_0 = hypot(1.0, z) * sqrt(y_m);
return y_s * (x_s * ((1.0 / t_0) / (t_0 * x_m)));
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double t_0 = Math.hypot(1.0, z) * Math.sqrt(y_m);
return y_s * (x_s * ((1.0 / t_0) / (t_0 * x_m)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): t_0 = math.hypot(1.0, z) * math.sqrt(y_m) return y_s * (x_s * ((1.0 / t_0) / (t_0 * x_m)))
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) t_0 = Float64(hypot(1.0, z) * sqrt(y_m)) return Float64(y_s * Float64(x_s * Float64(Float64(1.0 / t_0) / Float64(t_0 * x_m)))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
t_0 = hypot(1.0, z) * sqrt(y_m);
tmp = y_s * (x_s * ((1.0 / t_0) / (t_0 * x_m)));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * N[(N[(1.0 / t$95$0), $MachinePrecision] / N[(t$95$0 * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(1, z\right) \cdot \sqrt{y\_m}\\
y\_s \cdot \left(x\_s \cdot \frac{\frac{1}{t\_0}}{t\_0 \cdot x\_m}\right)
\end{array}
\end{array}
Initial program 91.5%
remove-double-neg91.5%
distribute-lft-neg-out91.5%
distribute-rgt-neg-in91.5%
associate-/r*91.0%
associate-/l/90.8%
associate-/l/91.4%
distribute-lft-neg-out91.4%
distribute-rgt-neg-in91.4%
distribute-lft-neg-in91.4%
remove-double-neg91.4%
sqr-neg91.4%
+-commutative91.4%
sqr-neg91.4%
fma-define91.5%
*-commutative91.5%
Simplified91.5%
*-commutative91.5%
associate-*r*91.1%
*-commutative91.1%
fma-undefine91.1%
+-commutative91.1%
associate-/l/91.5%
*-un-lft-identity91.5%
add-sqr-sqrt45.2%
times-frac45.2%
+-commutative45.2%
fma-undefine45.2%
*-commutative45.2%
sqrt-prod45.2%
fma-undefine45.2%
+-commutative45.2%
hypot-1-def45.2%
+-commutative45.2%
Applied egg-rr48.5%
associate-/l/48.5%
associate-*r/48.5%
*-rgt-identity48.5%
*-commutative48.5%
Simplified48.5%
Final simplification48.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ (* (/ (/ 1.0 x_m) (hypot 1.0 z)) (/ 1.0 (hypot 1.0 z))) y_m))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((((1.0 / x_m) / hypot(1.0, z)) * (1.0 / hypot(1.0, z))) / y_m));
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((((1.0 / x_m) / Math.hypot(1.0, z)) * (1.0 / Math.hypot(1.0, z))) / y_m));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * ((((1.0 / x_m) / math.hypot(1.0, z)) * (1.0 / math.hypot(1.0, z))) / y_m))
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(Float64(Float64(Float64(1.0 / x_m) / hypot(1.0, z)) * Float64(1.0 / hypot(1.0, z))) / y_m))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
tmp = y_s * (x_s * ((((1.0 / x_m) / hypot(1.0, z)) * (1.0 / hypot(1.0, z))) / y_m));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \frac{\frac{\frac{1}{x\_m}}{\mathsf{hypot}\left(1, z\right)} \cdot \frac{1}{\mathsf{hypot}\left(1, z\right)}}{y\_m}\right)
\end{array}
Initial program 91.5%
remove-double-neg91.5%
distribute-lft-neg-out91.5%
distribute-rgt-neg-in91.5%
associate-/r*91.0%
associate-/l/90.8%
associate-/l/91.4%
distribute-lft-neg-out91.4%
distribute-rgt-neg-in91.4%
distribute-lft-neg-in91.4%
remove-double-neg91.4%
sqr-neg91.4%
+-commutative91.4%
sqr-neg91.4%
fma-define91.5%
*-commutative91.5%
Simplified91.5%
*-commutative91.5%
associate-*r*91.1%
*-commutative91.1%
fma-undefine91.1%
+-commutative91.1%
associate-/l/91.5%
*-un-lft-identity91.5%
add-sqr-sqrt45.2%
times-frac45.2%
+-commutative45.2%
fma-undefine45.2%
*-commutative45.2%
sqrt-prod45.2%
fma-undefine45.2%
+-commutative45.2%
hypot-1-def45.2%
+-commutative45.2%
Applied egg-rr48.5%
*-commutative48.5%
associate-/r*47.8%
associate-/r*47.8%
frac-times46.3%
add-sqr-sqrt94.5%
Applied egg-rr94.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 5e+277)
(/ (/ 1.0 y_m) (* x_m (fma z z 1.0)))
(/ (* (/ (/ 1.0 x_m) (hypot 1.0 z)) (/ 1.0 z)) y_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e+277) {
tmp = (1.0 / y_m) / (x_m * fma(z, z, 1.0));
} else {
tmp = (((1.0 / x_m) / hypot(1.0, z)) * (1.0 / z)) / y_m;
}
return y_s * (x_s * tmp);
}
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e+277) tmp = Float64(Float64(1.0 / y_m) / Float64(x_m * fma(z, z, 1.0))); else tmp = Float64(Float64(Float64(Float64(1.0 / x_m) / hypot(1.0, z)) * Float64(1.0 / z)) / y_m); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e+277], N[(N[(1.0 / y$95$m), $MachinePrecision] / N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+277}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{x\_m}}{\mathsf{hypot}\left(1, z\right)} \cdot \frac{1}{z}}{y\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 4.99999999999999982e277Initial program 98.6%
remove-double-neg98.6%
distribute-lft-neg-out98.6%
distribute-rgt-neg-in98.6%
associate-/r*97.6%
associate-/l/97.3%
associate-/l/98.3%
distribute-lft-neg-out98.3%
distribute-rgt-neg-in98.3%
distribute-lft-neg-in98.3%
remove-double-neg98.3%
sqr-neg98.3%
+-commutative98.3%
sqr-neg98.3%
fma-define98.3%
*-commutative98.3%
Simplified98.3%
*-commutative98.3%
associate-*r*98.1%
*-commutative98.1%
fma-undefine98.1%
+-commutative98.1%
associate-/l/98.6%
*-un-lft-identity98.6%
add-sqr-sqrt47.7%
times-frac47.7%
+-commutative47.7%
fma-undefine47.7%
*-commutative47.7%
sqrt-prod47.7%
fma-undefine47.7%
+-commutative47.7%
hypot-1-def47.7%
+-commutative47.7%
Applied egg-rr48.3%
Taylor expanded in y around 0 98.1%
associate-/r*98.6%
associate-/r*97.6%
associate-/l/97.3%
associate-/r*97.6%
associate-/l/96.3%
+-commutative96.3%
unpow296.3%
fma-define96.3%
Simplified96.3%
if 4.99999999999999982e277 < (*.f64 z z) Initial program 74.9%
remove-double-neg74.9%
distribute-lft-neg-out74.9%
distribute-rgt-neg-in74.9%
associate-/r*75.6%
associate-/l/75.6%
associate-/l/75.6%
distribute-lft-neg-out75.6%
distribute-rgt-neg-in75.6%
distribute-lft-neg-in75.6%
remove-double-neg75.6%
sqr-neg75.6%
+-commutative75.6%
sqr-neg75.6%
fma-define75.6%
*-commutative75.6%
Simplified75.6%
*-commutative75.6%
associate-*r*74.9%
*-commutative74.9%
fma-undefine74.9%
+-commutative74.9%
associate-/l/74.9%
*-un-lft-identity74.9%
add-sqr-sqrt39.2%
times-frac39.2%
+-commutative39.2%
fma-undefine39.2%
*-commutative39.2%
sqrt-prod39.2%
fma-undefine39.2%
+-commutative39.2%
hypot-1-def39.2%
+-commutative39.2%
Applied egg-rr49.2%
*-commutative49.2%
associate-/r*49.2%
associate-/r*49.3%
frac-times45.4%
add-sqr-sqrt90.7%
Applied egg-rr90.7%
Taylor expanded in z around inf 81.8%
Final simplification91.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 5e+296)
(/ (/ 1.0 y_m) (* x_m (fma z z 1.0)))
(* (/ (/ 1.0 x_m) z) (/ (/ 1.0 y_m) z))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e+296) {
tmp = (1.0 / y_m) / (x_m * fma(z, z, 1.0));
} else {
tmp = ((1.0 / x_m) / z) * ((1.0 / y_m) / z);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e+296) tmp = Float64(Float64(1.0 / y_m) / Float64(x_m * fma(z, z, 1.0))); else tmp = Float64(Float64(Float64(1.0 / x_m) / z) * Float64(Float64(1.0 / y_m) / z)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e+296], N[(N[(1.0 / y$95$m), $MachinePrecision] / N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision] * N[(N[(1.0 / y$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+296}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{z} \cdot \frac{\frac{1}{y\_m}}{z}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 5.0000000000000001e296Initial program 98.1%
remove-double-neg98.1%
distribute-lft-neg-out98.1%
distribute-rgt-neg-in98.1%
associate-/r*97.6%
associate-/l/97.4%
associate-/l/98.3%
distribute-lft-neg-out98.3%
distribute-rgt-neg-in98.3%
distribute-lft-neg-in98.3%
remove-double-neg98.3%
sqr-neg98.3%
+-commutative98.3%
sqr-neg98.3%
fma-define98.3%
*-commutative98.3%
Simplified98.3%
*-commutative98.3%
associate-*r*97.6%
*-commutative97.6%
fma-undefine97.6%
+-commutative97.6%
associate-/l/98.1%
*-un-lft-identity98.1%
add-sqr-sqrt47.0%
times-frac47.0%
+-commutative47.0%
fma-undefine47.0%
*-commutative47.0%
sqrt-prod47.0%
fma-undefine47.0%
+-commutative47.0%
hypot-1-def47.0%
+-commutative47.0%
Applied egg-rr47.5%
Taylor expanded in y around 0 97.6%
associate-/r*98.1%
associate-/r*97.6%
associate-/l/97.4%
associate-/r*97.6%
associate-/l/95.4%
+-commutative95.4%
unpow295.4%
fma-define95.4%
Simplified95.4%
if 5.0000000000000001e296 < (*.f64 z z) Initial program 74.5%
remove-double-neg74.5%
distribute-lft-neg-out74.5%
distribute-rgt-neg-in74.5%
associate-/r*74.0%
associate-/l/74.0%
associate-/l/74.0%
distribute-lft-neg-out74.0%
distribute-rgt-neg-in74.0%
distribute-lft-neg-in74.0%
remove-double-neg74.0%
sqr-neg74.0%
+-commutative74.0%
sqr-neg74.0%
fma-define74.0%
*-commutative74.0%
Simplified74.0%
Taylor expanded in z around inf 74.0%
*-un-lft-identity74.0%
associate-/r*74.0%
pow-flip75.1%
metadata-eval75.1%
*-commutative75.1%
Applied egg-rr75.1%
*-lft-identity75.1%
*-commutative75.1%
Simplified75.1%
div-inv75.1%
metadata-eval75.1%
pow-flip74.0%
associate-/r*74.0%
times-frac74.5%
*-un-lft-identity74.5%
associate-/l/74.0%
div-inv74.0%
unpow274.0%
times-frac98.5%
Applied egg-rr98.5%
Final simplification96.3%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (* z z) 5e+296)
(/ 1.0 (* (fma z z 1.0) (* y_m x_m)))
(* (/ (/ 1.0 x_m) z) (/ (/ 1.0 y_m) z))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z * z) <= 5e+296) {
tmp = 1.0 / (fma(z, z, 1.0) * (y_m * x_m));
} else {
tmp = ((1.0 / x_m) / z) * ((1.0 / y_m) / z);
}
return y_s * (x_s * tmp);
}
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(z * z) <= 5e+296) tmp = Float64(1.0 / Float64(fma(z, z, 1.0) * Float64(y_m * x_m))); else tmp = Float64(Float64(Float64(1.0 / x_m) / z) * Float64(Float64(1.0 / y_m) / z)); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 5e+296], N[(1.0 / N[(N[(z * z + 1.0), $MachinePrecision] * N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision] * N[(N[(1.0 / y$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+296}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(y\_m \cdot x\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{z} \cdot \frac{\frac{1}{y\_m}}{z}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 5.0000000000000001e296Initial program 98.1%
remove-double-neg98.1%
distribute-lft-neg-out98.1%
distribute-rgt-neg-in98.1%
associate-/r*97.6%
associate-/l/97.4%
associate-/l/98.3%
distribute-lft-neg-out98.3%
distribute-rgt-neg-in98.3%
distribute-lft-neg-in98.3%
remove-double-neg98.3%
sqr-neg98.3%
+-commutative98.3%
sqr-neg98.3%
fma-define98.3%
*-commutative98.3%
Simplified98.3%
if 5.0000000000000001e296 < (*.f64 z z) Initial program 74.5%
remove-double-neg74.5%
distribute-lft-neg-out74.5%
distribute-rgt-neg-in74.5%
associate-/r*74.0%
associate-/l/74.0%
associate-/l/74.0%
distribute-lft-neg-out74.0%
distribute-rgt-neg-in74.0%
distribute-lft-neg-in74.0%
remove-double-neg74.0%
sqr-neg74.0%
+-commutative74.0%
sqr-neg74.0%
fma-define74.0%
*-commutative74.0%
Simplified74.0%
Taylor expanded in z around inf 74.0%
*-un-lft-identity74.0%
associate-/r*74.0%
pow-flip75.1%
metadata-eval75.1%
*-commutative75.1%
Applied egg-rr75.1%
*-lft-identity75.1%
*-commutative75.1%
Simplified75.1%
div-inv75.1%
metadata-eval75.1%
pow-flip74.0%
associate-/r*74.0%
times-frac74.5%
*-un-lft-identity74.5%
associate-/l/74.0%
div-inv74.0%
unpow274.0%
times-frac98.5%
Applied egg-rr98.5%
Final simplification98.3%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= z 4.2e+26)
(/ (/ 1.0 x_m) (* y_m (+ 1.0 (* z z))))
(if (<= z 2.1e+178)
(* (/ 1.0 z) (/ (/ 1.0 (* y_m x_m)) z))
(* (/ 1.0 z) (/ 1.0 (* x_m (* z y_m)))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 4.2e+26) {
tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)));
} else if (z <= 2.1e+178) {
tmp = (1.0 / z) * ((1.0 / (y_m * x_m)) / z);
} else {
tmp = (1.0 / z) * (1.0 / (x_m * (z * y_m)));
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 4.2d+26) then
tmp = (1.0d0 / x_m) / (y_m * (1.0d0 + (z * z)))
else if (z <= 2.1d+178) then
tmp = (1.0d0 / z) * ((1.0d0 / (y_m * x_m)) / z)
else
tmp = (1.0d0 / z) * (1.0d0 / (x_m * (z * y_m)))
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 4.2e+26) {
tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)));
} else if (z <= 2.1e+178) {
tmp = (1.0 / z) * ((1.0 / (y_m * x_m)) / z);
} else {
tmp = (1.0 / z) * (1.0 / (x_m * (z * y_m)));
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if z <= 4.2e+26: tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z))) elif z <= 2.1e+178: tmp = (1.0 / z) * ((1.0 / (y_m * x_m)) / z) else: tmp = (1.0 / z) * (1.0 / (x_m * (z * y_m))) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (z <= 4.2e+26) tmp = Float64(Float64(1.0 / x_m) / Float64(y_m * Float64(1.0 + Float64(z * z)))); elseif (z <= 2.1e+178) tmp = Float64(Float64(1.0 / z) * Float64(Float64(1.0 / Float64(y_m * x_m)) / z)); else tmp = Float64(Float64(1.0 / z) * Float64(1.0 / Float64(x_m * Float64(z * y_m)))); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (z <= 4.2e+26)
tmp = (1.0 / x_m) / (y_m * (1.0 + (z * z)));
elseif (z <= 2.1e+178)
tmp = (1.0 / z) * ((1.0 / (y_m * x_m)) / z);
else
tmp = (1.0 / z) * (1.0 / (x_m * (z * y_m)));
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 4.2e+26], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(y$95$m * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.1e+178], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(1.0 / N[(x$95$m * N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 4.2 \cdot 10^{+26}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y\_m \cdot \left(1 + z \cdot z\right)}\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+178}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{\frac{1}{y\_m \cdot x\_m}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{1}{x\_m \cdot \left(z \cdot y\_m\right)}\\
\end{array}\right)
\end{array}
if z < 4.2000000000000002e26Initial program 93.2%
if 4.2000000000000002e26 < z < 2.0999999999999999e178Initial program 91.5%
remove-double-neg91.5%
distribute-lft-neg-out91.5%
distribute-rgt-neg-in91.5%
associate-/r*95.6%
associate-/l/95.6%
associate-/l/95.6%
distribute-lft-neg-out95.6%
distribute-rgt-neg-in95.6%
distribute-lft-neg-in95.6%
remove-double-neg95.6%
sqr-neg95.6%
+-commutative95.6%
sqr-neg95.6%
fma-define95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in z around inf 95.6%
*-un-lft-identity95.6%
associate-/r*95.6%
pow-flip95.8%
metadata-eval95.8%
*-commutative95.8%
Applied egg-rr95.8%
*-lft-identity95.8%
*-commutative95.8%
Simplified95.8%
div-inv95.8%
metadata-eval95.8%
pow-flip95.6%
associate-/r*95.6%
times-frac91.5%
*-un-lft-identity91.5%
associate-/l/95.6%
associate-/r*95.6%
*-un-lft-identity95.6%
unpow295.6%
times-frac99.9%
*-commutative99.9%
Applied egg-rr99.9%
if 2.0999999999999999e178 < z Initial program 82.7%
remove-double-neg82.7%
distribute-lft-neg-out82.7%
distribute-rgt-neg-in82.7%
associate-/r*82.2%
associate-/l/82.2%
associate-/l/82.2%
distribute-lft-neg-out82.2%
distribute-rgt-neg-in82.2%
distribute-lft-neg-in82.2%
remove-double-neg82.2%
sqr-neg82.2%
+-commutative82.2%
sqr-neg82.2%
fma-define82.2%
*-commutative82.2%
Simplified82.2%
Taylor expanded in z around inf 82.2%
*-un-lft-identity82.2%
associate-/r*82.2%
pow-flip82.2%
metadata-eval82.2%
*-commutative82.2%
Applied egg-rr82.2%
*-lft-identity82.2%
*-commutative82.2%
Simplified82.2%
div-inv82.2%
metadata-eval82.2%
pow-flip82.2%
associate-/r*82.2%
times-frac82.7%
*-un-lft-identity82.7%
associate-/l/82.2%
associate-/r*82.2%
*-un-lft-identity82.2%
unpow282.2%
times-frac85.0%
*-commutative85.0%
Applied egg-rr85.0%
Taylor expanded in y around 0 99.9%
Final simplification94.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= z 1.0)
(/ (/ 1.0 y_m) x_m)
(if (<= z 1.7e+178)
(/ (/ 1.0 z) (* z (* y_m x_m)))
(* (/ 1.0 z) (/ 1.0 (* x_m (* z y_m)))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else if (z <= 1.7e+178) {
tmp = (1.0 / z) / (z * (y_m * x_m));
} else {
tmp = (1.0 / z) * (1.0 / (x_m * (z * y_m)));
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.0d0) then
tmp = (1.0d0 / y_m) / x_m
else if (z <= 1.7d+178) then
tmp = (1.0d0 / z) / (z * (y_m * x_m))
else
tmp = (1.0d0 / z) * (1.0d0 / (x_m * (z * y_m)))
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else if (z <= 1.7e+178) {
tmp = (1.0 / z) / (z * (y_m * x_m));
} else {
tmp = (1.0 / z) * (1.0 / (x_m * (z * y_m)));
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y_m) / x_m elif z <= 1.7e+178: tmp = (1.0 / z) / (z * (y_m * x_m)) else: tmp = (1.0 / z) * (1.0 / (x_m * (z * y_m))) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y_m) / x_m); elseif (z <= 1.7e+178) tmp = Float64(Float64(1.0 / z) / Float64(z * Float64(y_m * x_m))); else tmp = Float64(Float64(1.0 / z) * Float64(1.0 / Float64(x_m * Float64(z * y_m)))); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (z <= 1.0)
tmp = (1.0 / y_m) / x_m;
elseif (z <= 1.7e+178)
tmp = (1.0 / z) / (z * (y_m * x_m));
else
tmp = (1.0 / z) * (1.0 / (x_m * (z * y_m)));
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], If[LessEqual[z, 1.7e+178], N[(N[(1.0 / z), $MachinePrecision] / N[(z * N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(1.0 / N[(x$95$m * N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+178}:\\
\;\;\;\;\frac{\frac{1}{z}}{z \cdot \left(y\_m \cdot x\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{1}{x\_m \cdot \left(z \cdot y\_m\right)}\\
\end{array}\right)
\end{array}
if z < 1Initial program 92.9%
remove-double-neg92.9%
distribute-lft-neg-out92.9%
distribute-rgt-neg-in92.9%
associate-/r*92.4%
associate-/l/92.1%
associate-/l/92.7%
distribute-lft-neg-out92.7%
distribute-rgt-neg-in92.7%
distribute-lft-neg-in92.7%
remove-double-neg92.7%
sqr-neg92.7%
+-commutative92.7%
sqr-neg92.7%
fma-define92.7%
*-commutative92.7%
Simplified92.7%
Taylor expanded in z around 0 73.5%
*-commutative73.5%
associate-/r*73.7%
Simplified73.7%
if 1 < z < 1.7000000000000001e178Initial program 93.6%
remove-double-neg93.6%
distribute-lft-neg-out93.6%
distribute-rgt-neg-in93.6%
associate-/r*93.8%
associate-/l/93.8%
associate-/l/95.9%
distribute-lft-neg-out95.9%
distribute-rgt-neg-in95.9%
distribute-lft-neg-in95.9%
remove-double-neg95.9%
sqr-neg95.9%
+-commutative95.9%
sqr-neg95.9%
fma-define95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in z around inf 93.3%
*-un-lft-identity93.3%
associate-/r*93.3%
pow-flip93.6%
metadata-eval93.6%
*-commutative93.6%
Applied egg-rr93.6%
*-lft-identity93.6%
*-commutative93.6%
Simplified93.6%
div-inv91.6%
metadata-eval91.6%
pow-flip91.3%
associate-/r*91.3%
times-frac91.1%
*-un-lft-identity91.1%
associate-/l/91.2%
associate-/r*91.2%
*-un-lft-identity91.2%
unpow291.2%
times-frac94.3%
*-commutative94.3%
Applied egg-rr94.3%
clear-num94.2%
un-div-inv94.3%
div-inv94.2%
clear-num96.3%
/-rgt-identity96.3%
*-commutative96.3%
Applied egg-rr96.3%
if 1.7000000000000001e178 < z Initial program 82.7%
remove-double-neg82.7%
distribute-lft-neg-out82.7%
distribute-rgt-neg-in82.7%
associate-/r*82.2%
associate-/l/82.2%
associate-/l/82.2%
distribute-lft-neg-out82.2%
distribute-rgt-neg-in82.2%
distribute-lft-neg-in82.2%
remove-double-neg82.2%
sqr-neg82.2%
+-commutative82.2%
sqr-neg82.2%
fma-define82.2%
*-commutative82.2%
Simplified82.2%
Taylor expanded in z around inf 82.2%
*-un-lft-identity82.2%
associate-/r*82.2%
pow-flip82.2%
metadata-eval82.2%
*-commutative82.2%
Applied egg-rr82.2%
*-lft-identity82.2%
*-commutative82.2%
Simplified82.2%
div-inv82.2%
metadata-eval82.2%
pow-flip82.2%
associate-/r*82.2%
times-frac82.7%
*-un-lft-identity82.7%
associate-/l/82.2%
associate-/r*82.2%
*-un-lft-identity82.2%
unpow282.2%
times-frac85.0%
*-commutative85.0%
Applied egg-rr85.0%
Taylor expanded in y around 0 99.9%
Final simplification80.4%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= z 1.0) (/ (/ 1.0 y_m) x_m) (/ (/ 1.0 z) (* z (* y_m x_m)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / z) / (z * (y_m * x_m));
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.0d0) then
tmp = (1.0d0 / y_m) / x_m
else
tmp = (1.0d0 / z) / (z * (y_m * x_m))
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / z) / (z * (y_m * x_m));
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y_m) / x_m else: tmp = (1.0 / z) / (z * (y_m * x_m)) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y_m) / x_m); else tmp = Float64(Float64(1.0 / z) / Float64(z * Float64(y_m * x_m))); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (z <= 1.0)
tmp = (1.0 / y_m) / x_m;
else
tmp = (1.0 / z) / (z * (y_m * x_m));
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] / N[(z * N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{z \cdot \left(y\_m \cdot x\_m\right)}\\
\end{array}\right)
\end{array}
if z < 1Initial program 92.9%
remove-double-neg92.9%
distribute-lft-neg-out92.9%
distribute-rgt-neg-in92.9%
associate-/r*92.4%
associate-/l/92.1%
associate-/l/92.7%
distribute-lft-neg-out92.7%
distribute-rgt-neg-in92.7%
distribute-lft-neg-in92.7%
remove-double-neg92.7%
sqr-neg92.7%
+-commutative92.7%
sqr-neg92.7%
fma-define92.7%
*-commutative92.7%
Simplified92.7%
Taylor expanded in z around 0 73.5%
*-commutative73.5%
associate-/r*73.7%
Simplified73.7%
if 1 < z Initial program 87.5%
remove-double-neg87.5%
distribute-lft-neg-out87.5%
distribute-rgt-neg-in87.5%
associate-/r*87.3%
associate-/l/87.3%
associate-/l/88.2%
distribute-lft-neg-out88.2%
distribute-rgt-neg-in88.2%
distribute-lft-neg-in88.2%
remove-double-neg88.2%
sqr-neg88.2%
+-commutative88.2%
sqr-neg88.2%
fma-define88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in z around inf 87.1%
*-un-lft-identity87.1%
associate-/r*87.1%
pow-flip87.2%
metadata-eval87.2%
*-commutative87.2%
Applied egg-rr87.2%
*-lft-identity87.2%
*-commutative87.2%
Simplified87.2%
div-inv86.3%
metadata-eval86.3%
pow-flip86.2%
associate-/r*86.2%
times-frac86.4%
*-un-lft-identity86.4%
associate-/l/86.2%
associate-/r*86.2%
*-un-lft-identity86.2%
unpow286.2%
times-frac89.1%
*-commutative89.1%
Applied egg-rr89.1%
clear-num89.1%
un-div-inv89.2%
div-inv89.1%
clear-num90.0%
/-rgt-identity90.0%
*-commutative90.0%
Applied egg-rr90.0%
Final simplification78.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= z 1.0) (/ (/ 1.0 y_m) x_m) (/ 1.0 (* z (* z (* y_m x_m))))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = 1.0 / (z * (z * (y_m * x_m)));
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.0d0) then
tmp = (1.0d0 / y_m) / x_m
else
tmp = 1.0d0 / (z * (z * (y_m * x_m)))
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = 1.0 / (z * (z * (y_m * x_m)));
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y_m) / x_m else: tmp = 1.0 / (z * (z * (y_m * x_m))) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y_m) / x_m); else tmp = Float64(1.0 / Float64(z * Float64(z * Float64(y_m * x_m)))); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (z <= 1.0)
tmp = (1.0 / y_m) / x_m;
else
tmp = 1.0 / (z * (z * (y_m * x_m)));
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(1.0 / N[(z * N[(z * N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z \cdot \left(z \cdot \left(y\_m \cdot x\_m\right)\right)}\\
\end{array}\right)
\end{array}
if z < 1Initial program 92.9%
remove-double-neg92.9%
distribute-lft-neg-out92.9%
distribute-rgt-neg-in92.9%
associate-/r*92.4%
associate-/l/92.1%
associate-/l/92.7%
distribute-lft-neg-out92.7%
distribute-rgt-neg-in92.7%
distribute-lft-neg-in92.7%
remove-double-neg92.7%
sqr-neg92.7%
+-commutative92.7%
sqr-neg92.7%
fma-define92.7%
*-commutative92.7%
Simplified92.7%
Taylor expanded in z around 0 73.5%
*-commutative73.5%
associate-/r*73.7%
Simplified73.7%
if 1 < z Initial program 87.5%
remove-double-neg87.5%
distribute-lft-neg-out87.5%
distribute-rgt-neg-in87.5%
associate-/r*87.3%
associate-/l/87.3%
associate-/l/88.2%
distribute-lft-neg-out88.2%
distribute-rgt-neg-in88.2%
distribute-lft-neg-in88.2%
remove-double-neg88.2%
sqr-neg88.2%
+-commutative88.2%
sqr-neg88.2%
fma-define88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in z around inf 87.1%
*-un-lft-identity87.1%
associate-/r*87.1%
pow-flip87.2%
metadata-eval87.2%
*-commutative87.2%
Applied egg-rr87.2%
*-lft-identity87.2%
*-commutative87.2%
Simplified87.2%
div-inv86.3%
metadata-eval86.3%
pow-flip86.2%
associate-/r*86.2%
times-frac86.4%
*-un-lft-identity86.4%
associate-/l/86.2%
associate-/r*86.2%
*-un-lft-identity86.2%
unpow286.2%
times-frac89.1%
*-commutative89.1%
Applied egg-rr89.1%
*-commutative89.1%
clear-num89.1%
frac-times89.1%
metadata-eval89.1%
div-inv89.1%
clear-num90.0%
/-rgt-identity90.0%
*-commutative90.0%
Applied egg-rr90.0%
Final simplification78.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= z 1.0) (/ (/ 1.0 y_m) x_m) (/ 1.0 (* (* z z) (* y_m x_m)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = 1.0 / ((z * z) * (y_m * x_m));
}
return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.0d0) then
tmp = (1.0d0 / y_m) / x_m
else
tmp = 1.0d0 / ((z * z) * (y_m * x_m))
end if
code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = 1.0 / ((z * z) * (y_m * x_m));
}
return y_s * (x_s * tmp);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y_m) / x_m else: tmp = 1.0 / ((z * z) * (y_m * x_m)) return y_s * (x_s * tmp)
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y_m) / x_m); else tmp = Float64(1.0 / Float64(Float64(z * z) * Float64(y_m * x_m))); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (z <= 1.0)
tmp = (1.0 / y_m) / x_m;
else
tmp = 1.0 / ((z * z) * (y_m * x_m));
end
tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(1.0 / N[(N[(z * z), $MachinePrecision] * N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(z \cdot z\right) \cdot \left(y\_m \cdot x\_m\right)}\\
\end{array}\right)
\end{array}
if z < 1Initial program 92.9%
remove-double-neg92.9%
distribute-lft-neg-out92.9%
distribute-rgt-neg-in92.9%
associate-/r*92.4%
associate-/l/92.1%
associate-/l/92.7%
distribute-lft-neg-out92.7%
distribute-rgt-neg-in92.7%
distribute-lft-neg-in92.7%
remove-double-neg92.7%
sqr-neg92.7%
+-commutative92.7%
sqr-neg92.7%
fma-define92.7%
*-commutative92.7%
Simplified92.7%
Taylor expanded in z around 0 73.5%
*-commutative73.5%
associate-/r*73.7%
Simplified73.7%
if 1 < z Initial program 87.5%
remove-double-neg87.5%
distribute-lft-neg-out87.5%
distribute-rgt-neg-in87.5%
associate-/r*87.3%
associate-/l/87.3%
associate-/l/88.2%
distribute-lft-neg-out88.2%
distribute-rgt-neg-in88.2%
distribute-lft-neg-in88.2%
remove-double-neg88.2%
sqr-neg88.2%
+-commutative88.2%
sqr-neg88.2%
fma-define88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in z around inf 87.1%
unpow287.1%
Applied egg-rr87.1%
Final simplification77.4%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ (/ 1.0 y_m) x_m))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((1.0 / y_m) / x_m));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (x_s * ((1.0d0 / y_m) / x_m))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((1.0 / y_m) / x_m));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * ((1.0 / y_m) / x_m))
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(Float64(1.0 / y_m) / x_m))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
tmp = y_s * (x_s * ((1.0 / y_m) / x_m));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \frac{\frac{1}{y\_m}}{x\_m}\right)
\end{array}
Initial program 91.5%
remove-double-neg91.5%
distribute-lft-neg-out91.5%
distribute-rgt-neg-in91.5%
associate-/r*91.0%
associate-/l/90.8%
associate-/l/91.4%
distribute-lft-neg-out91.4%
distribute-rgt-neg-in91.4%
distribute-lft-neg-in91.4%
remove-double-neg91.4%
sqr-neg91.4%
+-commutative91.4%
sqr-neg91.4%
fma-define91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in z around 0 58.8%
*-commutative58.8%
associate-/r*58.9%
Simplified58.9%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ (/ 1.0 x_m) y_m))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((1.0 / x_m) / y_m));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (x_s * ((1.0d0 / x_m) / y_m))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((1.0 / x_m) / y_m));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * ((1.0 / x_m) / y_m))
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(Float64(1.0 / x_m) / y_m))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
tmp = y_s * (x_s * ((1.0 / x_m) / y_m));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(1.0 / x$95$m), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \frac{\frac{1}{x\_m}}{y\_m}\right)
\end{array}
Initial program 91.5%
Taylor expanded in z around 0 58.9%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ 1.0 (* y_m x_m)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (1.0 / (y_m * x_m)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (x_s * (1.0d0 / (y_m * x_m)))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (1.0 / (y_m * x_m)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * (1.0 / (y_m * x_m)))
x\_m = abs(x) x\_s = copysign(1.0, x) y\_m = abs(y) y\_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(1.0 / Float64(y_m * x_m)))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
tmp = y_s * (x_s * (1.0 / (y_m * x_m)));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(1.0 / N[(y$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \frac{1}{y\_m \cdot x\_m}\right)
\end{array}
Initial program 91.5%
remove-double-neg91.5%
distribute-lft-neg-out91.5%
distribute-rgt-neg-in91.5%
associate-/r*91.0%
associate-/l/90.8%
associate-/l/91.4%
distribute-lft-neg-out91.4%
distribute-rgt-neg-in91.4%
distribute-lft-neg-in91.4%
remove-double-neg91.4%
sqr-neg91.4%
+-commutative91.4%
sqr-neg91.4%
fma-define91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in z around 0 58.8%
Final simplification58.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 2024160
(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)))))