
(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 11 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) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (/ (/ (/ (/ 1.0 (sqrt y)) (hypot 1.0 z)) x_m) (* (sqrt y) (hypot 1.0 z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
return x_s * ((((1.0 / sqrt(y)) / hypot(1.0, z)) / x_m) / (sqrt(y) * hypot(1.0, z)));
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
return x_s * ((((1.0 / Math.sqrt(y)) / Math.hypot(1.0, z)) / x_m) / (Math.sqrt(y) * Math.hypot(1.0, z)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): return x_s * ((((1.0 / math.sqrt(y)) / math.hypot(1.0, z)) / x_m) / (math.sqrt(y) * math.hypot(1.0, z)))
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) return Float64(x_s * Float64(Float64(Float64(Float64(1.0 / sqrt(y)) / hypot(1.0, z)) / x_m) / Float64(sqrt(y) * hypot(1.0, z)))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp = code(x_s, x_m, y, z)
tmp = x_s * ((((1.0 / sqrt(y)) / hypot(1.0, z)) / x_m) / (sqrt(y) * hypot(1.0, 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * N[(N[(N[(N[(1.0 / N[Sqrt[y], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / x$95$m), $MachinePrecision] / N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \frac{\frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{x\_m}}{\sqrt{y} \cdot \mathsf{hypot}\left(1, z\right)}
\end{array}
Initial program 91.5%
associate-/l/91.2%
associate-*l*91.3%
*-commutative91.3%
sqr-neg91.3%
+-commutative91.3%
sqr-neg91.3%
fma-define91.3%
Simplified91.3%
associate-*r*91.5%
*-commutative91.5%
associate-/r*91.7%
*-commutative91.7%
associate-/l/91.8%
fma-undefine91.8%
+-commutative91.8%
associate-/r*91.5%
*-un-lft-identity91.5%
add-sqr-sqrt43.8%
times-frac43.8%
+-commutative43.8%
fma-undefine43.8%
*-commutative43.8%
sqrt-prod43.8%
fma-undefine43.8%
+-commutative43.8%
hypot-1-def43.8%
+-commutative43.8%
Applied egg-rr48.2%
associate-*r/48.2%
associate-*r/48.2%
*-rgt-identity48.2%
*-commutative48.2%
associate-/r*48.2%
Simplified48.2%
Final simplification48.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (let* ((t_0 (* (sqrt y) (hypot 1.0 z)))) (* x_s (/ (/ 1.0 t_0) (* x_m t_0)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double t_0 = sqrt(y) * hypot(1.0, z);
return x_s * ((1.0 / t_0) / (x_m * t_0));
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double t_0 = Math.sqrt(y) * Math.hypot(1.0, z);
return x_s * ((1.0 / t_0) / (x_m * t_0));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): t_0 = math.sqrt(y) * math.hypot(1.0, z) return x_s * ((1.0 / t_0) / (x_m * t_0))
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) t_0 = Float64(sqrt(y) * hypot(1.0, z)) return 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);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp = code(x_s, x_m, y, z)
t_0 = sqrt(y) * hypot(1.0, z);
tmp = 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := Block[{t$95$0 = N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * N[(N[(1.0 / t$95$0), $MachinePrecision] / N[(x$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
\begin{array}{l}
t_0 := \sqrt{y} \cdot \mathsf{hypot}\left(1, z\right)\\
x\_s \cdot \frac{\frac{1}{t\_0}}{x\_m \cdot t\_0}
\end{array}
\end{array}
Initial program 91.5%
associate-/l/91.2%
associate-*l*91.3%
*-commutative91.3%
sqr-neg91.3%
+-commutative91.3%
sqr-neg91.3%
fma-define91.3%
Simplified91.3%
associate-*r*91.5%
*-commutative91.5%
associate-/r*91.7%
*-commutative91.7%
associate-/l/91.8%
fma-undefine91.8%
+-commutative91.8%
associate-/r*91.5%
*-un-lft-identity91.5%
add-sqr-sqrt43.8%
times-frac43.8%
+-commutative43.8%
fma-undefine43.8%
*-commutative43.8%
sqrt-prod43.8%
fma-undefine43.8%
+-commutative43.8%
hypot-1-def43.8%
+-commutative43.8%
Applied egg-rr48.2%
associate-/l/48.1%
associate-*r/48.1%
*-rgt-identity48.1%
*-commutative48.1%
Simplified48.1%
Final simplification48.1%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (pow (/ (pow y -0.5) (* (hypot 1.0 z) (sqrt x_m))) 2.0)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
return x_s * pow((pow(y, -0.5) / (hypot(1.0, z) * sqrt(x_m))), 2.0);
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
return x_s * Math.pow((Math.pow(y, -0.5) / (Math.hypot(1.0, z) * Math.sqrt(x_m))), 2.0);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): return x_s * math.pow((math.pow(y, -0.5) / (math.hypot(1.0, z) * math.sqrt(x_m))), 2.0)
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) return Float64(x_s * (Float64((y ^ -0.5) / Float64(hypot(1.0, z) * sqrt(x_m))) ^ 2.0)) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp = code(x_s, x_m, y, z)
tmp = x_s * (((y ^ -0.5) / (hypot(1.0, z) * sqrt(x_m))) ^ 2.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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * N[Power[N[(N[Power[y, -0.5], $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot {\left(\frac{{y}^{-0.5}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x\_m}}\right)}^{2}
\end{array}
Initial program 91.5%
associate-/l/91.2%
associate-*l*91.3%
*-commutative91.3%
sqr-neg91.3%
+-commutative91.3%
sqr-neg91.3%
fma-define91.3%
Simplified91.3%
associate-*r*91.5%
*-commutative91.5%
associate-/r*91.7%
*-commutative91.7%
associate-/l/91.8%
fma-undefine91.8%
+-commutative91.8%
associate-/r*91.5%
*-un-lft-identity91.5%
add-sqr-sqrt43.8%
times-frac43.8%
+-commutative43.8%
fma-undefine43.8%
*-commutative43.8%
sqrt-prod43.8%
fma-undefine43.8%
+-commutative43.8%
hypot-1-def43.8%
+-commutative43.8%
Applied egg-rr48.2%
associate-*r/48.2%
associate-*r/48.2%
*-rgt-identity48.2%
*-commutative48.2%
associate-/r*48.2%
Simplified48.2%
Applied egg-rr23.6%
unpow223.6%
associate-/l/23.6%
Simplified23.6%
Final simplification23.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= (* z z) 1e+296)
(/ (/ (/ 1.0 x_m) (fma z z 1.0)) y)
(/ (pow y -1.0) (* z (* (hypot 1.0 z) x_m))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z * z) <= 1e+296) {
tmp = ((1.0 / x_m) / fma(z, z, 1.0)) / y;
} else {
tmp = pow(y, -1.0) / (z * (hypot(1.0, z) * x_m));
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (Float64(z * z) <= 1e+296) tmp = Float64(Float64(Float64(1.0 / x_m) / fma(z, z, 1.0)) / y); else tmp = Float64((y ^ -1.0) / Float64(z * Float64(hypot(1.0, z) * x_m))); end return 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 1e+296], N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[Power[y, -1.0], $MachinePrecision] / N[(z * N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+296}:\\
\;\;\;\;\frac{\frac{\frac{1}{x\_m}}{\mathsf{fma}\left(z, z, 1\right)}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{{y}^{-1}}{z \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot x\_m\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 9.99999999999999981e295Initial program 97.2%
associate-/l/96.8%
associate-*l*96.9%
*-commutative96.9%
sqr-neg96.9%
+-commutative96.9%
sqr-neg96.9%
fma-define96.9%
Simplified96.9%
*-commutative96.9%
metadata-eval96.9%
associate-*l*96.8%
*-commutative96.8%
fma-undefine96.8%
+-commutative96.8%
frac-times97.2%
*-commutative97.2%
+-commutative97.2%
fma-undefine97.2%
*-commutative97.2%
Applied egg-rr97.2%
associate-*l/97.2%
*-un-lft-identity97.2%
associate-/r*98.3%
Applied egg-rr98.3%
if 9.99999999999999981e295 < (*.f64 z z) Initial program 73.6%
associate-/l/73.6%
associate-*l*73.6%
*-commutative73.6%
sqr-neg73.6%
+-commutative73.6%
sqr-neg73.6%
fma-define73.6%
Simplified73.6%
associate-*r*73.0%
*-commutative73.0%
associate-/r*73.0%
*-commutative73.0%
associate-/l/73.0%
fma-undefine73.0%
+-commutative73.0%
associate-/r*73.6%
*-un-lft-identity73.6%
add-sqr-sqrt44.2%
times-frac44.2%
+-commutative44.2%
fma-undefine44.2%
*-commutative44.2%
sqrt-prod44.2%
fma-undefine44.2%
+-commutative44.2%
hypot-1-def44.2%
+-commutative44.2%
Applied egg-rr57.9%
associate-*r/57.9%
associate-*r/57.9%
*-rgt-identity57.9%
*-commutative57.9%
associate-/r*57.9%
Simplified57.9%
Taylor expanded in z around inf 48.6%
*-un-lft-identity48.6%
times-frac47.0%
pow1/247.0%
pow-flip47.0%
metadata-eval47.0%
associate-/l/47.0%
pow1/247.0%
pow-flip47.0%
metadata-eval47.0%
Applied egg-rr47.0%
associate-/l/45.5%
associate-*r/45.5%
pow-sqr77.9%
metadata-eval77.9%
Simplified77.9%
Final simplification93.4%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (/ (/ 1.0 y) (* (hypot 1.0 z) (* (hypot 1.0 z) x_m)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
return x_s * ((1.0 / y) / (hypot(1.0, z) * (hypot(1.0, z) * x_m)));
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
return x_s * ((1.0 / y) / (Math.hypot(1.0, z) * (Math.hypot(1.0, z) * x_m)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): return x_s * ((1.0 / y) / (math.hypot(1.0, z) * (math.hypot(1.0, z) * x_m)))
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) return Float64(x_s * Float64(Float64(1.0 / y) / Float64(hypot(1.0, z) * Float64(hypot(1.0, z) * x_m)))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp = code(x_s, x_m, y, z)
tmp = x_s * ((1.0 / y) / (hypot(1.0, z) * (hypot(1.0, z) * 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * N[(N[(1.0 / y), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \frac{\frac{1}{y}}{\mathsf{hypot}\left(1, z\right) \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot x\_m\right)}
\end{array}
Initial program 91.5%
associate-/l/91.2%
associate-*l*91.3%
*-commutative91.3%
sqr-neg91.3%
+-commutative91.3%
sqr-neg91.3%
fma-define91.3%
Simplified91.3%
*-commutative91.3%
metadata-eval91.3%
associate-*l*91.2%
*-commutative91.2%
fma-undefine91.2%
+-commutative91.2%
frac-times91.5%
*-commutative91.5%
+-commutative91.5%
fma-undefine91.5%
*-commutative91.5%
Applied egg-rr91.5%
associate-*l/91.5%
times-frac91.7%
fma-undefine91.7%
unpow291.7%
+-commutative91.7%
add-sqr-sqrt91.7%
metadata-eval91.7%
unpow291.7%
hypot-undefine91.7%
metadata-eval91.7%
unpow291.7%
hypot-undefine91.7%
pow291.7%
times-frac91.5%
pow291.5%
add-sqr-sqrt43.8%
swap-sqr45.3%
unpow245.3%
Applied egg-rr95.8%
Final simplification95.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= (* z z) 2e+217)
(/ (/ (/ 1.0 x_m) (fma z z 1.0)) y)
(/ (* (/ 1.0 z) (/ (/ 1.0 x_m) z)) y))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((z * z) <= 2e+217) {
tmp = ((1.0 / x_m) / fma(z, z, 1.0)) / y;
} else {
tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (Float64(z * z) <= 2e+217) tmp = Float64(Float64(Float64(1.0 / x_m) / fma(z, z, 1.0)) / y); else tmp = Float64(Float64(Float64(1.0 / z) * Float64(Float64(1.0 / x_m) / z)) / y); end return 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 2e+217], N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+217}:\\
\;\;\;\;\frac{\frac{\frac{1}{x\_m}}{\mathsf{fma}\left(z, z, 1\right)}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{x\_m}}{z}}{y}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.99999999999999992e217Initial program 97.1%
associate-/l/96.7%
associate-*l*98.8%
*-commutative98.8%
sqr-neg98.8%
+-commutative98.8%
sqr-neg98.8%
fma-define98.8%
Simplified98.8%
*-commutative98.8%
metadata-eval98.8%
associate-*l*96.7%
*-commutative96.7%
fma-undefine96.7%
+-commutative96.7%
frac-times97.1%
*-commutative97.1%
+-commutative97.1%
fma-undefine97.1%
*-commutative97.1%
Applied egg-rr97.1%
associate-*l/97.1%
*-un-lft-identity97.1%
associate-/r*99.2%
Applied egg-rr99.2%
if 1.99999999999999992e217 < (*.f64 z z) Initial program 77.5%
associate-/l/77.5%
associate-*l*72.6%
*-commutative72.6%
sqr-neg72.6%
+-commutative72.6%
sqr-neg72.6%
fma-define72.6%
Simplified72.6%
associate-*r*75.7%
*-commutative75.7%
associate-/r*75.7%
*-commutative75.7%
associate-/l/75.7%
fma-undefine75.7%
+-commutative75.7%
associate-/r*77.5%
*-un-lft-identity77.5%
add-sqr-sqrt42.9%
times-frac42.9%
+-commutative42.9%
fma-undefine42.9%
*-commutative42.9%
sqrt-prod42.9%
fma-undefine42.9%
+-commutative42.9%
hypot-1-def42.9%
+-commutative42.9%
Applied egg-rr54.6%
associate-*r/54.6%
associate-*r/54.6%
*-rgt-identity54.6%
*-commutative54.6%
associate-/r*54.6%
Simplified54.6%
Taylor expanded in z around inf 77.5%
associate-*r*75.7%
*-commutative75.7%
metadata-eval75.7%
associate-*r/75.7%
associate-/r*75.7%
metadata-eval75.7%
distribute-neg-frac75.7%
distribute-frac-neg275.7%
distribute-rgt-neg-out75.7%
associate-*r/75.7%
associate-*r/75.7%
associate-*l/75.7%
distribute-rgt-neg-out75.7%
distribute-neg-frac275.7%
distribute-neg-frac75.7%
metadata-eval75.7%
associate-/r*75.7%
associate-*l/75.7%
associate-*r/75.7%
*-commutative75.7%
Simplified72.6%
associate-/r*75.0%
*-un-lft-identity75.0%
unpow275.0%
times-frac89.4%
Applied egg-rr89.4%
Final simplification96.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z)
:precision binary64
(let* ((t_0 (* y (+ 1.0 (* z z)))))
(*
x_s
(if (<= t_0 5e+307)
(/ (/ 1.0 x_m) t_0)
(/ (* (/ 1.0 z) (/ (/ 1.0 x_m) z)) y)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double t_0 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= 5e+307) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = y * (1.0d0 + (z * z))
if (t_0 <= 5d+307) then
tmp = (1.0d0 / x_m) / t_0
else
tmp = ((1.0d0 / z) * ((1.0d0 / x_m) / z)) / y
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double t_0 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= 5e+307) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): t_0 = y * (1.0 + (z * z)) tmp = 0 if t_0 <= 5e+307: tmp = (1.0 / x_m) / t_0 else: tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) t_0 = Float64(y * Float64(1.0 + Float64(z * z))) tmp = 0.0 if (t_0 <= 5e+307) tmp = Float64(Float64(1.0 / x_m) / t_0); else tmp = Float64(Float64(Float64(1.0 / z) * Float64(Float64(1.0 / x_m) / z)) / y); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
t_0 = y * (1.0 + (z * z));
tmp = 0.0;
if (t_0 <= 5e+307)
tmp = (1.0 / x_m) / t_0;
else
tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y;
end
tmp_2 = 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := Block[{t$95$0 = N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, 5e+307], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + z \cdot z\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{x\_m}}{z}}{y}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 5e307Initial program 95.2%
if 5e307 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 72.1%
associate-/l/72.1%
associate-*l*79.0%
*-commutative79.0%
sqr-neg79.0%
+-commutative79.0%
sqr-neg79.0%
fma-define79.0%
Simplified79.0%
associate-*r*78.5%
*-commutative78.5%
associate-/r*78.5%
*-commutative78.5%
associate-/l/78.5%
fma-undefine78.5%
+-commutative78.5%
associate-/r*72.1%
*-un-lft-identity72.1%
add-sqr-sqrt72.1%
times-frac72.1%
+-commutative72.1%
fma-undefine72.1%
*-commutative72.1%
sqrt-prod72.1%
fma-undefine72.1%
+-commutative72.1%
hypot-1-def72.1%
+-commutative72.1%
Applied egg-rr99.6%
associate-*r/99.6%
associate-*r/99.6%
*-rgt-identity99.6%
*-commutative99.6%
associate-/r*99.6%
Simplified99.6%
Taylor expanded in z around inf 72.1%
associate-*r*78.5%
*-commutative78.5%
metadata-eval78.5%
associate-*r/78.5%
associate-/r*78.5%
metadata-eval78.5%
distribute-neg-frac78.5%
distribute-frac-neg278.5%
distribute-rgt-neg-out78.5%
associate-*r/78.5%
associate-*r/78.5%
associate-*l/78.5%
distribute-rgt-neg-out78.5%
distribute-neg-frac278.5%
distribute-neg-frac78.5%
metadata-eval78.5%
associate-/r*78.5%
associate-*l/78.5%
associate-*r/78.5%
*-commutative78.5%
Simplified78.9%
associate-/r*78.9%
*-un-lft-identity78.9%
unpow278.9%
times-frac95.1%
Applied egg-rr95.1%
Final simplification95.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= z 7e-5) (/ (/ 1.0 x_m) y) (/ (* (/ 1.0 z) (/ 1.0 z)) (* y x_m)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= 7e-5) {
tmp = (1.0 / x_m) / y;
} else {
tmp = ((1.0 / z) * (1.0 / z)) / (y * x_m);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 7d-5) then
tmp = (1.0d0 / x_m) / y
else
tmp = ((1.0d0 / z) * (1.0d0 / z)) / (y * x_m)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= 7e-5) {
tmp = (1.0 / x_m) / y;
} else {
tmp = ((1.0 / z) * (1.0 / z)) / (y * x_m);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): tmp = 0 if z <= 7e-5: tmp = (1.0 / x_m) / y else: tmp = ((1.0 / z) * (1.0 / z)) / (y * x_m) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= 7e-5) tmp = Float64(Float64(1.0 / x_m) / y); else tmp = Float64(Float64(Float64(1.0 / z) * Float64(1.0 / z)) / Float64(y * x_m)); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
tmp = 0.0;
if (z <= 7e-5)
tmp = (1.0 / x_m) / y;
else
tmp = ((1.0 / z) * (1.0 / z)) / (y * x_m);
end
tmp_2 = 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, 7e-5], N[(N[(1.0 / x$95$m), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision] / N[(y * x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z} \cdot \frac{1}{z}}{y \cdot x\_m}\\
\end{array}
\end{array}
if z < 6.9999999999999994e-5Initial program 94.3%
Taylor expanded in z around 0 69.9%
if 6.9999999999999994e-5 < z Initial program 82.1%
associate-/l/81.8%
associate-*l*80.5%
*-commutative80.5%
sqr-neg80.5%
+-commutative80.5%
sqr-neg80.5%
fma-define80.5%
Simplified80.5%
Taylor expanded in z around inf 80.0%
associate-*r*78.1%
*-commutative78.1%
Simplified78.1%
add-sqr-sqrt64.6%
pow264.6%
sqrt-div35.4%
metadata-eval35.4%
*-commutative35.4%
sqrt-prod35.7%
sqrt-pow137.5%
metadata-eval37.5%
pow137.5%
Applied egg-rr37.5%
unpow237.5%
associate-/r*37.5%
associate-/r*37.5%
frac-times35.8%
add-sqr-sqrt78.7%
*-commutative78.7%
Applied egg-rr78.7%
Final simplification71.9%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= z 7e-5) (/ (/ 1.0 x_m) y) (/ (* (/ 1.0 z) (/ (/ 1.0 x_m) z)) y))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= 7e-5) {
tmp = (1.0 / x_m) / y;
} else {
tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 7d-5) then
tmp = (1.0d0 / x_m) / y
else
tmp = ((1.0d0 / z) * ((1.0d0 / x_m) / z)) / y
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= 7e-5) {
tmp = (1.0 / x_m) / y;
} else {
tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): tmp = 0 if z <= 7e-5: tmp = (1.0 / x_m) / y else: tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= 7e-5) tmp = Float64(Float64(1.0 / x_m) / y); else tmp = Float64(Float64(Float64(1.0 / z) * Float64(Float64(1.0 / x_m) / z)) / y); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
tmp = 0.0;
if (z <= 7e-5)
tmp = (1.0 / x_m) / y;
else
tmp = ((1.0 / z) * ((1.0 / x_m) / z)) / y;
end
tmp_2 = 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, 7e-5], N[(N[(1.0 / x$95$m), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{x\_m}}{z}}{y}\\
\end{array}
\end{array}
if z < 6.9999999999999994e-5Initial program 94.3%
Taylor expanded in z around 0 69.9%
if 6.9999999999999994e-5 < z Initial program 82.1%
associate-/l/81.8%
associate-*l*80.5%
*-commutative80.5%
sqr-neg80.5%
+-commutative80.5%
sqr-neg80.5%
fma-define80.5%
Simplified80.5%
associate-*r*79.9%
*-commutative79.9%
associate-/r*80.1%
*-commutative80.1%
associate-/l/80.2%
fma-undefine80.2%
+-commutative80.2%
associate-/r*82.1%
*-un-lft-identity82.1%
add-sqr-sqrt37.5%
times-frac37.5%
+-commutative37.5%
fma-undefine37.5%
*-commutative37.5%
sqrt-prod37.5%
fma-undefine37.5%
+-commutative37.5%
hypot-1-def37.5%
+-commutative37.5%
Applied egg-rr43.8%
associate-*r/43.9%
associate-*r/43.8%
*-rgt-identity43.8%
*-commutative43.8%
associate-/r*43.9%
Simplified43.9%
Taylor expanded in z around inf 80.0%
associate-*r*78.1%
*-commutative78.1%
metadata-eval78.1%
associate-*r/78.1%
associate-/r*78.4%
metadata-eval78.4%
distribute-neg-frac78.4%
distribute-frac-neg278.4%
distribute-rgt-neg-out78.4%
associate-*r/78.4%
associate-*r/78.4%
associate-*l/78.4%
distribute-rgt-neg-out78.4%
distribute-neg-frac278.4%
distribute-neg-frac78.4%
metadata-eval78.4%
associate-/r*78.4%
associate-*l/78.4%
associate-*r/78.4%
*-commutative78.4%
Simplified79.1%
associate-/r*80.7%
*-un-lft-identity80.7%
unpow280.7%
times-frac85.2%
Applied egg-rr85.2%
Final simplification73.4%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= z 7e-5) (/ (/ 1.0 x_m) y) (/ 1.0 (* x_m (* y z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= 7e-5) {
tmp = (1.0 / x_m) / y;
} else {
tmp = 1.0 / (x_m * (y * z));
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 7d-5) then
tmp = (1.0d0 / x_m) / y
else
tmp = 1.0d0 / (x_m * (y * z))
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= 7e-5) {
tmp = (1.0 / x_m) / y;
} else {
tmp = 1.0 / (x_m * (y * z));
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): tmp = 0 if z <= 7e-5: tmp = (1.0 / x_m) / y else: tmp = 1.0 / (x_m * (y * z)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= 7e-5) tmp = Float64(Float64(1.0 / x_m) / y); else tmp = Float64(1.0 / Float64(x_m * Float64(y * z))); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
tmp = 0.0;
if (z <= 7e-5)
tmp = (1.0 / x_m) / y;
else
tmp = 1.0 / (x_m * (y * z));
end
tmp_2 = 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, 7e-5], N[(N[(1.0 / x$95$m), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(x$95$m * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x\_m \cdot \left(y \cdot z\right)}\\
\end{array}
\end{array}
if z < 6.9999999999999994e-5Initial program 94.3%
Taylor expanded in z around 0 69.9%
if 6.9999999999999994e-5 < z Initial program 82.1%
associate-/l/81.8%
associate-*l*80.5%
*-commutative80.5%
sqr-neg80.5%
+-commutative80.5%
sqr-neg80.5%
fma-define80.5%
Simplified80.5%
associate-*r*79.9%
*-commutative79.9%
associate-/r*80.1%
*-commutative80.1%
associate-/l/80.2%
fma-undefine80.2%
+-commutative80.2%
associate-/r*82.1%
*-un-lft-identity82.1%
add-sqr-sqrt37.5%
times-frac37.5%
+-commutative37.5%
fma-undefine37.5%
*-commutative37.5%
sqrt-prod37.5%
fma-undefine37.5%
+-commutative37.5%
hypot-1-def37.5%
+-commutative37.5%
Applied egg-rr43.8%
associate-*r/43.9%
associate-*r/43.8%
*-rgt-identity43.8%
*-commutative43.8%
associate-/r*43.9%
Simplified43.9%
Taylor expanded in z around inf 43.3%
Taylor expanded in z around 0 49.6%
Final simplification65.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 1 x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (/ 1.0 (* y x_m))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
return x_s * (1.0 / (y * x_m));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x_s * (1.0d0 / (y * x_m))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
return x_s * (1.0 / (y * x_m));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): return x_s * (1.0 / (y * x_m))
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) return Float64(x_s * Float64(1.0 / Float64(y * x_m))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp = code(x_s, x_m, y, z)
tmp = x_s * (1.0 / (y * 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]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * N[(1.0 / N[(y * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \frac{1}{y \cdot x\_m}
\end{array}
Initial program 91.5%
associate-/l/91.2%
associate-*l*91.3%
*-commutative91.3%
sqr-neg91.3%
+-commutative91.3%
sqr-neg91.3%
fma-define91.3%
Simplified91.3%
Taylor expanded in z around 0 59.7%
Final simplification59.7%
(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 2024053
(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)))))