
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
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 (hypot 1.0 z)) (sqrt y_m))
(/ (/ 1.0 x_m) (* (hypot 1.0 z) (sqrt 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 / hypot(1.0, z)) / sqrt(y_m)) * ((1.0 / x_m) / (hypot(1.0, z) * sqrt(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 / Math.hypot(1.0, z)) / Math.sqrt(y_m)) * ((1.0 / x_m) / (Math.hypot(1.0, z) * Math.sqrt(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 / math.hypot(1.0, z)) / math.sqrt(y_m)) * ((1.0 / x_m) / (math.hypot(1.0, z) * math.sqrt(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(1.0 / hypot(1.0, z)) / sqrt(y_m)) * Float64(Float64(1.0 / x_m) / Float64(hypot(1.0, z) * sqrt(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 / hypot(1.0, z)) / sqrt(y_m)) * ((1.0 / x_m) / (hypot(1.0, z) * sqrt(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[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[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 \left(\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{\sqrt{y\_m}} \cdot \frac{\frac{1}{x\_m}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y\_m}}\right)\right)
\end{array}
Initial program 87.3%
associate-/l/87.2%
remove-double-neg87.2%
distribute-rgt-neg-out87.2%
distribute-rgt-neg-out87.2%
remove-double-neg87.2%
associate-*l*90.8%
*-commutative90.8%
sqr-neg90.8%
+-commutative90.8%
sqr-neg90.8%
fma-define90.8%
Simplified90.8%
associate-*r*88.5%
*-commutative88.5%
associate-/r*88.5%
*-commutative88.5%
associate-/l/88.5%
fma-undefine88.5%
+-commutative88.5%
associate-/r*87.3%
*-un-lft-identity87.3%
add-sqr-sqrt44.7%
times-frac44.7%
+-commutative44.7%
fma-undefine44.7%
*-commutative44.7%
sqrt-prod44.7%
fma-undefine44.7%
+-commutative44.7%
hypot-1-def44.7%
+-commutative44.7%
Applied egg-rr50.8%
associate-/r*50.8%
Simplified50.8%
Final simplification50.8%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 1 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) (* x_m 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 = hypot(1.0, z) * sqrt(y_m);
return y_s * (x_s * ((1.0 / t_0) / (x_m * t_0)));
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
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) / (x_m * t_0)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [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) / (x_m * t_0)))
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(x_m * t_0)))) 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) / (x_m * t_0)));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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[(x$95$m * t$95$0), $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}}{x\_m \cdot t\_0}\right)
\end{array}
\end{array}
Initial program 87.3%
associate-/l/87.2%
remove-double-neg87.2%
distribute-rgt-neg-out87.2%
distribute-rgt-neg-out87.2%
remove-double-neg87.2%
associate-*l*90.8%
*-commutative90.8%
sqr-neg90.8%
+-commutative90.8%
sqr-neg90.8%
fma-define90.8%
Simplified90.8%
associate-*r*88.5%
*-commutative88.5%
associate-/r*88.5%
*-commutative88.5%
associate-/l/88.5%
fma-undefine88.5%
+-commutative88.5%
associate-/r*87.3%
*-un-lft-identity87.3%
add-sqr-sqrt44.7%
times-frac44.7%
+-commutative44.7%
fma-undefine44.7%
*-commutative44.7%
sqrt-prod44.7%
fma-undefine44.7%
+-commutative44.7%
hypot-1-def44.7%
+-commutative44.7%
Applied egg-rr50.8%
associate-/l/50.8%
associate-*r/50.9%
*-rgt-identity50.9%
*-commutative50.9%
Simplified50.9%
Final simplification50.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 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 (sqrt y_m)) (hypot 1.0 z)) x_m)
(* (hypot 1.0 z) (sqrt 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 / sqrt(y_m)) / hypot(1.0, z)) / x_m) / (hypot(1.0, z) * sqrt(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 / Math.sqrt(y_m)) / Math.hypot(1.0, z)) / x_m) / (Math.hypot(1.0, z) * Math.sqrt(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 / math.sqrt(y_m)) / math.hypot(1.0, z)) / x_m) / (math.hypot(1.0, z) * math.sqrt(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 / sqrt(y_m)) / hypot(1.0, z)) / x_m) / Float64(hypot(1.0, z) * sqrt(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 / sqrt(y_m)) / hypot(1.0, z)) / x_m) / (hypot(1.0, z) * sqrt(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 / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / x$95$m), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[y$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 \frac{\frac{\frac{\frac{1}{\sqrt{y\_m}}}{\mathsf{hypot}\left(1, z\right)}}{x\_m}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y\_m}}\right)
\end{array}
Initial program 87.3%
associate-/l/87.2%
remove-double-neg87.2%
distribute-rgt-neg-out87.2%
distribute-rgt-neg-out87.2%
remove-double-neg87.2%
associate-*l*90.8%
*-commutative90.8%
sqr-neg90.8%
+-commutative90.8%
sqr-neg90.8%
fma-define90.8%
Simplified90.8%
associate-*r*88.5%
*-commutative88.5%
associate-/r*88.5%
*-commutative88.5%
associate-/l/88.5%
fma-undefine88.5%
+-commutative88.5%
associate-/r*87.3%
*-un-lft-identity87.3%
add-sqr-sqrt44.7%
times-frac44.7%
+-commutative44.7%
fma-undefine44.7%
*-commutative44.7%
sqrt-prod44.7%
fma-undefine44.7%
+-commutative44.7%
hypot-1-def44.7%
+-commutative44.7%
Applied egg-rr50.8%
associate-*r/50.8%
associate-*r/50.8%
*-rgt-identity50.8%
*-commutative50.8%
associate-/r*50.8%
Simplified50.8%
Final simplification50.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 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 (<= y_m 2.05e+128)
(/ (/ 1.0 (* (hypot 1.0 z) x_m)) (* (hypot 1.0 z) y_m))
(/ (/ 1.0 y_m) (* x_m (fma z z 1.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 tmp;
if (y_m <= 2.05e+128) {
tmp = (1.0 / (hypot(1.0, z) * x_m)) / (hypot(1.0, z) * y_m);
} else {
tmp = (1.0 / y_m) / (x_m * fma(z, z, 1.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) tmp = 0.0 if (y_m <= 2.05e+128) tmp = Float64(Float64(1.0 / Float64(hypot(1.0, z) * x_m)) / Float64(hypot(1.0, z) * y_m)); else tmp = Float64(Float64(1.0 / y_m) / Float64(x_m * fma(z, z, 1.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_] := N[(y$95$s * N[(x$95$s * If[LessEqual[y$95$m, 2.05e+128], N[(N[(1.0 / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * y$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y$95$m), $MachinePrecision] / N[(x$95$m * N[(z * z + 1.0), $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}\;y\_m \leq 2.05 \cdot 10^{+128}:\\
\;\;\;\;\frac{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot x\_m}}{\mathsf{hypot}\left(1, z\right) \cdot y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\
\end{array}\right)
\end{array}
if y < 2.05000000000000006e128Initial program 86.8%
associate-/l/86.7%
remove-double-neg86.7%
distribute-rgt-neg-out86.7%
distribute-rgt-neg-out86.7%
remove-double-neg86.7%
associate-*l*89.6%
*-commutative89.6%
sqr-neg89.6%
+-commutative89.6%
sqr-neg89.6%
fma-define89.6%
Simplified89.6%
associate-*r*87.0%
*-commutative87.0%
associate-/r*86.9%
*-commutative86.9%
associate-/l/87.0%
fma-undefine87.0%
+-commutative87.0%
associate-/r*86.8%
*-un-lft-identity86.8%
add-sqr-sqrt38.3%
times-frac38.3%
+-commutative38.3%
fma-undefine38.3%
*-commutative38.3%
sqrt-prod38.4%
fma-undefine38.4%
+-commutative38.4%
hypot-1-def38.4%
+-commutative38.4%
Applied egg-rr44.1%
associate-/r*44.1%
Simplified44.1%
frac-times43.3%
frac-times43.4%
metadata-eval43.4%
*-commutative43.4%
associate-*r*43.4%
add-sqr-sqrt97.3%
Applied egg-rr97.3%
if 2.05000000000000006e128 < y Initial program 91.0%
associate-/l/91.1%
remove-double-neg91.1%
distribute-rgt-neg-out91.1%
distribute-rgt-neg-out91.1%
remove-double-neg91.1%
associate-*l*99.8%
*-commutative99.8%
sqr-neg99.8%
+-commutative99.8%
sqr-neg99.8%
fma-define99.8%
Simplified99.8%
associate-/r*99.9%
div-inv99.7%
Applied egg-rr99.7%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification97.6%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 1 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 (hypot 1.0 z)) (* (hypot 1.0 z) 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 / hypot(1.0, z)) / (hypot(1.0, z) * x_m)) / 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 / Math.hypot(1.0, z)) / (Math.hypot(1.0, z) * 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 / math.hypot(1.0, z)) / (math.hypot(1.0, z) * 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(Float64(1.0 / hypot(1.0, z)) / Float64(hypot(1.0, z) * 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 / hypot(1.0, z)) / (hypot(1.0, z) * 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[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x$95$m), $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}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right) \cdot x\_m}}{y\_m}\right)
\end{array}
Initial program 87.3%
associate-/l/87.2%
remove-double-neg87.2%
distribute-rgt-neg-out87.2%
distribute-rgt-neg-out87.2%
remove-double-neg87.2%
associate-*l*90.8%
*-commutative90.8%
sqr-neg90.8%
+-commutative90.8%
sqr-neg90.8%
fma-define90.8%
Simplified90.8%
associate-/r*90.9%
div-inv90.8%
Applied egg-rr90.8%
associate-*l/90.9%
*-un-lft-identity90.9%
associate-/r*91.0%
Applied egg-rr91.0%
*-un-lft-identity91.0%
add-sqr-sqrt91.0%
times-frac91.0%
fma-undefine91.0%
+-commutative91.0%
hypot-1-def91.0%
fma-undefine91.0%
+-commutative91.0%
hypot-1-def95.8%
associate-/r*95.7%
Applied egg-rr95.7%
associate-*r/95.8%
*-rgt-identity95.8%
Simplified95.8%
Final simplification95.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 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 (or (<= (* z z) 20000.0) (not (<= (* z z) 5e+302)))
(/ (/ 1.0 x_m) (+ y_m (* z (* z y_m))))
(/ 1.0 (* y_m (* x_m (pow z 2.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 tmp;
if (((z * z) <= 20000.0) || !((z * z) <= 5e+302)) {
tmp = (1.0 / x_m) / (y_m + (z * (z * y_m)));
} else {
tmp = 1.0 / (y_m * (x_m * pow(z, 2.0)));
}
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 * z) <= 20000.0d0) .or. (.not. ((z * z) <= 5d+302))) then
tmp = (1.0d0 / x_m) / (y_m + (z * (z * y_m)))
else
tmp = 1.0d0 / (y_m * (x_m * (z ** 2.0d0)))
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 * z) <= 20000.0) || !((z * z) <= 5e+302)) {
tmp = (1.0 / x_m) / (y_m + (z * (z * y_m)));
} else {
tmp = 1.0 / (y_m * (x_m * Math.pow(z, 2.0)));
}
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 * z) <= 20000.0) or not ((z * z) <= 5e+302): tmp = (1.0 / x_m) / (y_m + (z * (z * y_m))) else: tmp = 1.0 / (y_m * (x_m * math.pow(z, 2.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) tmp = 0.0 if ((Float64(z * z) <= 20000.0) || !(Float64(z * z) <= 5e+302)) tmp = Float64(Float64(1.0 / x_m) / Float64(y_m + Float64(z * Float64(z * y_m)))); else tmp = Float64(1.0 / Float64(y_m * Float64(x_m * (z ^ 2.0)))); 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 * z) <= 20000.0) || ~(((z * z) <= 5e+302)))
tmp = (1.0 / x_m) / (y_m + (z * (z * y_m)));
else
tmp = 1.0 / (y_m * (x_m * (z ^ 2.0)));
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[Or[LessEqual[N[(z * z), $MachinePrecision], 20000.0], N[Not[LessEqual[N[(z * z), $MachinePrecision], 5e+302]], $MachinePrecision]], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(y$95$m + N[(z * N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(y$95$m * N[(x$95$m * N[Power[z, 2.0], $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 \cdot z \leq 20000 \lor \neg \left(z \cdot z \leq 5 \cdot 10^{+302}\right):\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y\_m + z \cdot \left(z \cdot y\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x\_m \cdot {z}^{2}\right)}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 2e4 or 5e302 < (*.f64 z z) Initial program 89.3%
+-commutative89.3%
distribute-lft-in89.3%
associate-*r*96.9%
*-rgt-identity96.9%
fma-define96.9%
Applied egg-rr96.9%
fma-undefine96.9%
*-commutative96.9%
Applied egg-rr96.9%
if 2e4 < (*.f64 z z) < 5e302Initial program 80.2%
associate-/l/80.2%
remove-double-neg80.2%
distribute-rgt-neg-out80.2%
distribute-rgt-neg-out80.2%
remove-double-neg80.2%
associate-*l*96.1%
*-commutative96.1%
sqr-neg96.1%
+-commutative96.1%
sqr-neg96.1%
fma-define96.1%
Simplified96.1%
Taylor expanded in z around inf 95.7%
Final simplification96.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 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 (or (<= z 1650000.0) (not (<= z 1.35e+154)))
(/ (/ 1.0 x_m) (+ y_m (* z (* z y_m))))
(/ (/ 1.0 (* x_m (pow z 2.0))) 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 <= 1650000.0) || !(z <= 1.35e+154)) {
tmp = (1.0 / x_m) / (y_m + (z * (z * y_m)));
} else {
tmp = (1.0 / (x_m * pow(z, 2.0))) / 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 <= 1650000.0d0) .or. (.not. (z <= 1.35d+154))) then
tmp = (1.0d0 / x_m) / (y_m + (z * (z * y_m)))
else
tmp = (1.0d0 / (x_m * (z ** 2.0d0))) / 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 <= 1650000.0) || !(z <= 1.35e+154)) {
tmp = (1.0 / x_m) / (y_m + (z * (z * y_m)));
} else {
tmp = (1.0 / (x_m * Math.pow(z, 2.0))) / 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 <= 1650000.0) or not (z <= 1.35e+154): tmp = (1.0 / x_m) / (y_m + (z * (z * y_m))) else: tmp = (1.0 / (x_m * math.pow(z, 2.0))) / 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 <= 1650000.0) || !(z <= 1.35e+154)) tmp = Float64(Float64(1.0 / x_m) / Float64(y_m + Float64(z * Float64(z * y_m)))); else tmp = Float64(Float64(1.0 / Float64(x_m * (z ^ 2.0))) / 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 <= 1650000.0) || ~((z <= 1.35e+154)))
tmp = (1.0 / x_m) / (y_m + (z * (z * y_m)));
else
tmp = (1.0 / (x_m * (z ^ 2.0))) / 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[Or[LessEqual[z, 1650000.0], N[Not[LessEqual[z, 1.35e+154]], $MachinePrecision]], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(y$95$m + N[(z * N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(x$95$m * N[Power[z, 2.0], $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 \begin{array}{l}
\mathbf{if}\;z \leq 1650000 \lor \neg \left(z \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y\_m + z \cdot \left(z \cdot y\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x\_m \cdot {z}^{2}}}{y\_m}\\
\end{array}\right)
\end{array}
if z < 1.65e6 or 1.35000000000000003e154 < z Initial program 87.9%
+-commutative87.9%
distribute-lft-in87.9%
associate-*r*94.5%
*-rgt-identity94.5%
fma-define94.5%
Applied egg-rr94.5%
fma-undefine94.5%
*-commutative94.5%
Applied egg-rr94.5%
if 1.65e6 < z < 1.35000000000000003e154Initial program 81.0%
associate-/l/81.0%
remove-double-neg81.0%
distribute-rgt-neg-out81.0%
distribute-rgt-neg-out81.0%
remove-double-neg81.0%
associate-*l*99.2%
*-commutative99.2%
sqr-neg99.2%
+-commutative99.2%
sqr-neg99.2%
fma-define99.2%
Simplified99.2%
associate-/r*99.4%
div-inv99.4%
Applied egg-rr99.4%
associate-*l/99.5%
*-un-lft-identity99.5%
associate-/r*99.4%
Applied egg-rr99.4%
Taylor expanded in z around inf 98.7%
Final simplification94.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 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+232)
(/ (/ 1.0 y_m) (* x_m (fma z z 1.0)))
(/ (/ 1.0 (* (hypot 1.0 z) 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 * z) <= 5e+232) {
tmp = (1.0 / y_m) / (x_m * fma(z, z, 1.0));
} else {
tmp = (1.0 / (hypot(1.0, z) * 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 (Float64(z * z) <= 5e+232) tmp = Float64(Float64(1.0 / y_m) / Float64(x_m * fma(z, z, 1.0))); else tmp = Float64(Float64(1.0 / Float64(hypot(1.0, z) * x_m)) / Float64(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+232], 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[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision] / N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[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^{+232}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot x\_m}}{z \cdot y\_m}\\
\end{array}\right)
\end{array}
if (*.f64 z z) < 4.99999999999999987e232Initial program 94.9%
associate-/l/94.9%
remove-double-neg94.9%
distribute-rgt-neg-out94.9%
distribute-rgt-neg-out94.9%
remove-double-neg94.9%
associate-*l*98.5%
*-commutative98.5%
sqr-neg98.5%
+-commutative98.5%
sqr-neg98.5%
fma-define98.5%
Simplified98.5%
associate-/r*98.6%
div-inv98.5%
Applied egg-rr98.5%
un-div-inv98.6%
Applied egg-rr98.6%
if 4.99999999999999987e232 < (*.f64 z z) Initial program 70.7%
associate-/l/70.7%
remove-double-neg70.7%
distribute-rgt-neg-out70.7%
distribute-rgt-neg-out70.7%
remove-double-neg70.7%
associate-*l*74.2%
*-commutative74.2%
sqr-neg74.2%
+-commutative74.2%
sqr-neg74.2%
fma-define74.2%
Simplified74.2%
associate-*r*69.1%
*-commutative69.1%
associate-/r*69.0%
*-commutative69.0%
associate-/l/69.1%
fma-undefine69.1%
+-commutative69.1%
associate-/r*70.7%
*-un-lft-identity70.7%
add-sqr-sqrt28.2%
times-frac28.2%
+-commutative28.2%
fma-undefine28.2%
*-commutative28.2%
sqrt-prod28.2%
fma-undefine28.2%
+-commutative28.2%
hypot-1-def28.2%
+-commutative28.2%
Applied egg-rr45.4%
associate-/r*45.4%
Simplified45.4%
frac-times44.3%
frac-times44.4%
metadata-eval44.4%
*-commutative44.4%
associate-*r*44.5%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
Taylor expanded in z around inf 80.9%
Final simplification93.0%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 y)
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 (<= y_m 5e-8)
(/ (/ 1.0 x_m) (+ y_m (* z (* z y_m))))
(/ 1.0 (* y_m (* x_m (fma z z 1.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 tmp;
if (y_m <= 5e-8) {
tmp = (1.0 / x_m) / (y_m + (z * (z * y_m)));
} else {
tmp = 1.0 / (y_m * (x_m * fma(z, z, 1.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) tmp = 0.0 if (y_m <= 5e-8) tmp = Float64(Float64(1.0 / x_m) / Float64(y_m + Float64(z * Float64(z * y_m)))); else tmp = Float64(1.0 / Float64(y_m * Float64(x_m * fma(z, z, 1.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_] := N[(y$95$s * N[(x$95$s * If[LessEqual[y$95$m, 5e-8], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(y$95$m + N[(z * N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(y$95$m * N[(x$95$m * N[(z * z + 1.0), $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}\;y\_m \leq 5 \cdot 10^{-8}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y\_m + z \cdot \left(z \cdot y\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x\_m \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\
\end{array}\right)
\end{array}
if y < 4.9999999999999998e-8Initial program 84.7%
+-commutative84.7%
distribute-lft-in84.7%
associate-*r*92.8%
*-rgt-identity92.8%
fma-define92.8%
Applied egg-rr92.8%
fma-undefine92.8%
*-commutative92.8%
Applied egg-rr92.8%
if 4.9999999999999998e-8 < y Initial program 94.3%
associate-/l/94.3%
remove-double-neg94.3%
distribute-rgt-neg-out94.3%
distribute-rgt-neg-out94.3%
remove-double-neg94.3%
associate-*l*99.7%
*-commutative99.7%
sqr-neg99.7%
+-commutative99.7%
sqr-neg99.7%
fma-define99.7%
Simplified99.7%
Final simplification94.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 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 (<= y_m 4e-7)
(/ (/ 1.0 x_m) (+ y_m (* z (* z y_m))))
(/ 1.0 (* (fma z z 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) {
double tmp;
if (y_m <= 4e-7) {
tmp = (1.0 / x_m) / (y_m + (z * (z * y_m)));
} else {
tmp = 1.0 / (fma(z, z, 1.0) * (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 (y_m <= 4e-7) tmp = Float64(Float64(1.0 / x_m) / Float64(y_m + Float64(z * Float64(z * y_m)))); else tmp = Float64(1.0 / Float64(fma(z, z, 1.0) * Float64(y_m * x_m))); end return Float64(y_s * Float64(x_s * tmp)) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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[y$95$m, 4e-7], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(y$95$m + N[(z * N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(z * z + 1.0), $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}\;y\_m \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y\_m + z \cdot \left(z \cdot y\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot \left(y\_m \cdot x\_m\right)}\\
\end{array}\right)
\end{array}
if y < 3.9999999999999998e-7Initial program 84.7%
+-commutative84.7%
distribute-lft-in84.7%
associate-*r*92.8%
*-rgt-identity92.8%
fma-define92.8%
Applied egg-rr92.8%
fma-undefine92.8%
*-commutative92.8%
Applied egg-rr92.8%
if 3.9999999999999998e-7 < y Initial program 94.3%
remove-double-neg94.3%
distribute-lft-neg-out94.3%
distribute-rgt-neg-in94.3%
associate-/r*99.7%
associate-/l/99.7%
associate-/l/99.7%
distribute-lft-neg-out99.7%
distribute-rgt-neg-in99.7%
distribute-lft-neg-in99.7%
remove-double-neg99.7%
sqr-neg99.7%
+-commutative99.7%
sqr-neg99.7%
fma-define99.7%
*-commutative99.7%
Simplified99.7%
Final simplification94.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 1 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 (<= y_m 2e-119)
(/ (/ 1.0 x_m) (+ y_m (* z (* z y_m))))
(/ (/ 1.0 y_m) (* x_m (fma z z 1.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 tmp;
if (y_m <= 2e-119) {
tmp = (1.0 / x_m) / (y_m + (z * (z * y_m)));
} else {
tmp = (1.0 / y_m) / (x_m * fma(z, z, 1.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) tmp = 0.0 if (y_m <= 2e-119) tmp = Float64(Float64(1.0 / x_m) / Float64(y_m + Float64(z * Float64(z * y_m)))); else tmp = Float64(Float64(1.0 / y_m) / Float64(x_m * fma(z, z, 1.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_] := N[(y$95$s * N[(x$95$s * If[LessEqual[y$95$m, 2e-119], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(y$95$m + N[(z * N[(z * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y$95$m), $MachinePrecision] / N[(x$95$m * N[(z * z + 1.0), $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}\;y\_m \leq 2 \cdot 10^{-119}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y\_m + z \cdot \left(z \cdot y\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\
\end{array}\right)
\end{array}
if y < 2.00000000000000003e-119Initial program 84.1%
+-commutative84.1%
distribute-lft-in84.1%
associate-*r*93.1%
*-rgt-identity93.1%
fma-define93.1%
Applied egg-rr93.1%
fma-undefine93.1%
*-commutative93.1%
Applied egg-rr93.1%
if 2.00000000000000003e-119 < y Initial program 93.4%
associate-/l/93.4%
remove-double-neg93.4%
distribute-rgt-neg-out93.4%
distribute-rgt-neg-out93.4%
remove-double-neg93.4%
associate-*l*97.5%
*-commutative97.5%
sqr-neg97.5%
+-commutative97.5%
sqr-neg97.5%
fma-define97.5%
Simplified97.5%
associate-/r*97.7%
div-inv97.5%
Applied egg-rr97.5%
un-div-inv97.7%
Applied egg-rr97.7%
Final simplification94.6%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 1 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.25e-5) (/ (/ 1.0 y_m) x_m) (/ (/ 1.0 (* z 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) {
double tmp;
if (z <= 1.25e-5) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / (z * x_m)) / 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.25d-5) then
tmp = (1.0d0 / y_m) / x_m
else
tmp = (1.0d0 / (z * x_m)) / 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.25e-5) {
tmp = (1.0 / y_m) / x_m;
} else {
tmp = (1.0 / (z * x_m)) / 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.25e-5: tmp = (1.0 / y_m) / x_m else: tmp = (1.0 / (z * x_m)) / 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.25e-5) tmp = Float64(Float64(1.0 / y_m) / x_m); else tmp = Float64(Float64(1.0 / Float64(z * x_m)) / 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.25e-5)
tmp = (1.0 / y_m) / x_m;
else
tmp = (1.0 / (z * x_m)) / 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.25e-5], N[(N[(1.0 / y$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(1.0 / N[(z * x$95$m), $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 \leq 1.25 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z \cdot x\_m}}{y\_m}\\
\end{array}\right)
\end{array}
if z < 1.25000000000000006e-5Initial program 92.1%
associate-/l/92.0%
remove-double-neg92.0%
distribute-rgt-neg-out92.0%
distribute-rgt-neg-out92.0%
remove-double-neg92.0%
associate-*l*94.4%
*-commutative94.4%
sqr-neg94.4%
+-commutative94.4%
sqr-neg94.4%
fma-define94.4%
Simplified94.4%
associate-*r*92.5%
*-commutative92.5%
associate-/r*92.4%
*-commutative92.4%
associate-/l/92.5%
fma-undefine92.5%
+-commutative92.5%
associate-/r*92.1%
*-un-lft-identity92.1%
add-sqr-sqrt48.4%
times-frac48.4%
+-commutative48.4%
fma-undefine48.4%
*-commutative48.4%
sqrt-prod48.4%
fma-undefine48.4%
+-commutative48.4%
hypot-1-def48.4%
+-commutative48.4%
Applied egg-rr51.7%
associate-/r*51.7%
Simplified51.7%
frac-times50.7%
frac-times50.7%
metadata-eval50.7%
*-commutative50.7%
associate-*r*50.8%
add-sqr-sqrt97.4%
Applied egg-rr97.4%
Taylor expanded in z around 0 75.4%
associate-/r*75.1%
*-rgt-identity75.1%
associate-*r/75.0%
associate-*l/75.0%
*-lft-identity75.0%
Simplified75.0%
if 1.25000000000000006e-5 < z Initial program 71.6%
associate-/l/71.6%
remove-double-neg71.6%
distribute-rgt-neg-out71.6%
distribute-rgt-neg-out71.6%
remove-double-neg71.6%
associate-*l*79.2%
*-commutative79.2%
sqr-neg79.2%
+-commutative79.2%
sqr-neg79.2%
fma-define79.2%
Simplified79.2%
associate-*r*75.7%
*-commutative75.7%
associate-/r*75.6%
*-commutative75.6%
associate-/l/75.6%
fma-undefine75.6%
+-commutative75.6%
associate-/r*71.6%
*-un-lft-identity71.6%
add-sqr-sqrt32.6%
times-frac32.7%
+-commutative32.7%
fma-undefine32.7%
*-commutative32.7%
sqrt-prod32.8%
fma-undefine32.8%
+-commutative32.8%
hypot-1-def32.8%
+-commutative32.8%
Applied egg-rr47.9%
associate-/r*47.9%
Simplified47.9%
frac-times46.5%
frac-times46.7%
metadata-eval46.7%
*-commutative46.7%
associate-*r*46.6%
add-sqr-sqrt96.7%
Applied egg-rr96.7%
Taylor expanded in z around 0 29.5%
Taylor expanded in z around inf 29.5%
Final simplification64.4%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 1 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 (+ 1.0 (* z 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) {
return y_s * (x_s * ((1.0 / x_m) / (y_m * (1.0 + (z * z)))));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
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 * (1.0d0 + (z * z)))))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
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 * (1.0 + (z * z)))));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [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 * (1.0 + (z * z)))))
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) / Float64(y_m * Float64(1.0 + Float64(z * z)))))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
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 * (1.0 + (z * z)))));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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] / N[(y$95$m * N[(1.0 + N[(z * z), $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 \frac{\frac{1}{x\_m}}{y\_m \cdot \left(1 + z \cdot z\right)}\right)
\end{array}
Initial program 87.3%
Final simplification87.3%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 1 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 (* z (* 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) / (y_m + (z * (z * y_m)))));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
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 + (z * (z * y_m)))))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
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 + (z * (z * y_m)))));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [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 + (z * (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(1.0 / x_m) / Float64(y_m + Float64(z * Float64(z * y_m)))))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
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 + (z * (z * y_m)))));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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] / N[(y$95$m + N[(z * 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 \frac{\frac{1}{x\_m}}{y\_m + z \cdot \left(z \cdot y\_m\right)}\right)
\end{array}
Initial program 87.3%
+-commutative87.3%
distribute-lft-in87.3%
associate-*r*93.2%
*-rgt-identity93.2%
fma-define93.2%
Applied egg-rr93.2%
fma-undefine93.2%
*-commutative93.2%
Applied egg-rr93.2%
Final simplification93.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 1 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 87.3%
associate-/l/87.2%
remove-double-neg87.2%
distribute-rgt-neg-out87.2%
distribute-rgt-neg-out87.2%
remove-double-neg87.2%
associate-*l*90.8%
*-commutative90.8%
sqr-neg90.8%
+-commutative90.8%
sqr-neg90.8%
fma-define90.8%
Simplified90.8%
Taylor expanded in z around 0 60.4%
Final simplification60.4%
(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 2024055
(FPCore (x y z)
:name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
:precision binary64
:alt
(if (< (* y (+ 1.0 (* z z))) (- INFINITY)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x)) (if (< (* y (+ 1.0 (* z z))) 8.680743250567252e+305) (/ (/ 1.0 x) (* (+ 1.0 (* z z)) y)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x))))
(/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))