
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
x_m = (fabs.f64 x) x_s = (copysign.f64 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 (* (hypot 1.0 z) (sqrt y)))) (* x_s (* (/ 1.0 t_0) (/ (/ 1.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 = hypot(1.0, z) * sqrt(y);
return x_s * ((1.0 / t_0) * ((1.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.hypot(1.0, z) * Math.sqrt(y);
return x_s * ((1.0 / t_0) * ((1.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.hypot(1.0, z) * math.sqrt(y) return x_s * ((1.0 / t_0) * ((1.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(hypot(1.0, z) * sqrt(y)) return Float64(x_s * Float64(Float64(1.0 / t_0) * Float64(Float64(1.0 / 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 = hypot(1.0, z) * sqrt(y);
tmp = x_s * ((1.0 / t_0) * ((1.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[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[(1.0 / x$95$m), $MachinePrecision] / 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 := \mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\\
x\_s \cdot \left(\frac{1}{t\_0} \cdot \frac{\frac{1}{x\_m}}{t\_0}\right)
\end{array}
\end{array}
Initial program 91.6%
associate-/l/91.0%
metadata-eval91.0%
associate-*r/91.0%
associate-/l/91.6%
associate-*r/91.6%
associate-/l*90.9%
associate-/r/91.0%
/-rgt-identity91.0%
associate-*l*92.5%
*-commutative92.5%
sqr-neg92.5%
+-commutative92.5%
sqr-neg92.5%
fma-def92.5%
Simplified92.5%
fma-udef92.5%
+-commutative92.5%
*-commutative92.5%
associate-*l*91.0%
associate-/l/91.6%
add-sqr-sqrt50.1%
*-un-lft-identity50.1%
times-frac50.1%
*-commutative50.1%
sqrt-prod50.1%
hypot-1-def50.1%
*-commutative50.1%
sqrt-prod51.5%
hypot-1-def55.5%
Applied egg-rr55.5%
Final simplification55.5%
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 x_m -0.5) (* (hypot 1.0 z) (sqrt y))) 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(x_m, -0.5) / (hypot(1.0, z) * sqrt(y))), 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(x_m, -0.5) / (Math.hypot(1.0, z) * Math.sqrt(y))), 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(x_m, -0.5) / (math.hypot(1.0, z) * math.sqrt(y))), 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((x_m ^ -0.5) / Float64(hypot(1.0, z) * sqrt(y))) ^ 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 * (((x_m ^ -0.5) / (hypot(1.0, z) * sqrt(y))) ^ 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[x$95$m, -0.5], $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[y], $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{{x\_m}^{-0.5}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}}\right)}^{2}
\end{array}
Initial program 91.6%
associate-/l/91.0%
metadata-eval91.0%
associate-*r/91.0%
associate-/l/91.6%
associate-*r/91.6%
associate-/l*90.9%
associate-/r/91.0%
/-rgt-identity91.0%
associate-*l*92.5%
*-commutative92.5%
sqr-neg92.5%
+-commutative92.5%
sqr-neg92.5%
fma-def92.5%
Simplified92.5%
fma-udef92.5%
+-commutative92.5%
*-commutative92.5%
associate-*l*91.0%
associate-/l/91.6%
add-sqr-sqrt62.2%
pow262.2%
sqrt-div24.0%
inv-pow24.0%
sqrt-pow124.0%
metadata-eval24.0%
*-commutative24.0%
sqrt-prod25.0%
hypot-1-def27.1%
Applied egg-rr27.1%
Final simplification27.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 (* (/ 1.0 y) (/ (/ (/ 1.0 x_m) (hypot 1.0 z)) (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 / y) * (((1.0 / x_m) / hypot(1.0, z)) / 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 / y) * (((1.0 / x_m) / Math.hypot(1.0, z)) / 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 / y) * (((1.0 / x_m) / math.hypot(1.0, z)) / 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(1.0 / y) * Float64(Float64(Float64(1.0 / x_m) / hypot(1.0, z)) / 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 / y) * (((1.0 / x_m) / hypot(1.0, z)) / 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[(1.0 / y), $MachinePrecision] * N[(N[(N[(1.0 / x$95$m), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $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 \left(\frac{1}{y} \cdot \frac{\frac{\frac{1}{x\_m}}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right)}\right)
\end{array}
Initial program 91.6%
associate-/l/91.0%
metadata-eval91.0%
associate-*r/91.0%
associate-/l/91.6%
associate-*r/91.6%
associate-/l*90.9%
associate-/r/91.0%
/-rgt-identity91.0%
associate-*l*92.5%
*-commutative92.5%
sqr-neg92.5%
+-commutative92.5%
sqr-neg92.5%
fma-def92.5%
Simplified92.5%
associate-/r*93.0%
div-inv92.9%
Applied egg-rr92.9%
associate-/r*93.1%
*-un-lft-identity93.1%
add-sqr-sqrt93.1%
times-frac93.0%
Applied egg-rr93.0%
associate-*r/93.1%
fma-udef93.1%
unpow293.1%
+-commutative93.1%
unpow293.1%
hypot-1-def93.1%
associate-*r/93.0%
fma-udef93.0%
unpow293.0%
+-commutative93.0%
unpow293.0%
hypot-1-def96.8%
associate-*l/96.8%
*-lft-identity96.8%
Simplified96.8%
Final simplification96.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 (/ (/ 1.0 (* (hypot 1.0 z) x_m)) (* (hypot 1.0 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) {
return x_s * ((1.0 / (hypot(1.0, z) * x_m)) / (hypot(1.0, z) * y));
}
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.hypot(1.0, z) * x_m)) / (Math.hypot(1.0, z) * y));
}
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.hypot(1.0, z) * x_m)) / (math.hypot(1.0, z) * y))
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 / Float64(hypot(1.0, z) * x_m)) / Float64(hypot(1.0, z) * y))) 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 / (hypot(1.0, z) * x_m)) / (hypot(1.0, z) * y));
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 / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * y), $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}{\mathsf{hypot}\left(1, z\right) \cdot x\_m}}{\mathsf{hypot}\left(1, z\right) \cdot y}
\end{array}
Initial program 91.6%
associate-/l/91.0%
metadata-eval91.0%
associate-*r/91.0%
associate-/l/91.6%
associate-*r/91.6%
associate-/l*90.9%
associate-/r/91.0%
/-rgt-identity91.0%
associate-*l*92.5%
*-commutative92.5%
sqr-neg92.5%
+-commutative92.5%
sqr-neg92.5%
fma-def92.5%
Simplified92.5%
associate-/r*93.0%
div-inv92.9%
Applied egg-rr92.9%
associate-/r*93.1%
*-un-lft-identity93.1%
add-sqr-sqrt93.1%
times-frac93.0%
Applied egg-rr93.0%
associate-*r/93.1%
fma-udef93.1%
unpow293.1%
+-commutative93.1%
unpow293.1%
hypot-1-def93.1%
associate-*r/93.0%
fma-udef93.0%
unpow293.0%
+-commutative93.0%
unpow293.0%
hypot-1-def96.8%
associate-*l/96.8%
*-lft-identity96.8%
Simplified96.8%
frac-times97.6%
*-un-lft-identity97.6%
associate-/l/97.6%
*-commutative97.6%
*-commutative97.6%
Applied egg-rr97.6%
Final simplification97.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
(let* ((t_0 (* y (+ 1.0 (* z z)))))
(*
x_s
(if (<= t_0 2e+302)
(/ (/ 1.0 x_m) t_0)
(/ 1.0 (* (pow z 2.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) {
double t_0 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= 2e+302) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = 1.0 / (pow(z, 2.0) * (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) :: t_0
real(8) :: tmp
t_0 = y * (1.0d0 + (z * z))
if (t_0 <= 2d+302) then
tmp = (1.0d0 / x_m) / t_0
else
tmp = 1.0d0 / ((z ** 2.0d0) * (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 t_0 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= 2e+302) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = 1.0 / (Math.pow(z, 2.0) * (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): t_0 = y * (1.0 + (z * z)) tmp = 0 if t_0 <= 2e+302: tmp = (1.0 / x_m) / t_0 else: tmp = 1.0 / (math.pow(z, 2.0) * (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) t_0 = Float64(y * Float64(1.0 + Float64(z * z))) tmp = 0.0 if (t_0 <= 2e+302) tmp = Float64(Float64(1.0 / x_m) / t_0); else tmp = Float64(1.0 / Float64((z ^ 2.0) * 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)
t_0 = y * (1.0 + (z * z));
tmp = 0.0;
if (t_0 <= 2e+302)
tmp = (1.0 / x_m) / t_0;
else
tmp = 1.0 / ((z ^ 2.0) * (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_] := Block[{t$95$0 = N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, 2e+302], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(1.0 / N[(N[Power[z, 2.0], $MachinePrecision] * N[(y * 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])\\
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + z \cdot z\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{z}^{2} \cdot \left(y \cdot x\_m\right)}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 2.0000000000000002e302Initial program 96.3%
if 2.0000000000000002e302 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 72.6%
associate-/l/72.6%
metadata-eval72.6%
associate-*r/72.6%
associate-/l/72.6%
associate-*r/72.6%
associate-/l*72.6%
associate-/r/72.6%
/-rgt-identity72.6%
associate-*l*79.9%
*-commutative79.9%
sqr-neg79.9%
+-commutative79.9%
sqr-neg79.9%
fma-def79.9%
Simplified79.9%
Taylor expanded in z around inf 72.6%
associate-*r*79.7%
*-commutative79.7%
Simplified79.7%
Final simplification93.0%
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 2e+302)
(/ (/ 1.0 x_m) t_0)
(/ (/ 1.0 y) (* x_m (pow z 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) {
double t_0 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= 2e+302) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = (1.0 / y) / (x_m * pow(z, 2.0));
}
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 <= 2d+302) then
tmp = (1.0d0 / x_m) / t_0
else
tmp = (1.0d0 / y) / (x_m * (z ** 2.0d0))
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 <= 2e+302) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = (1.0 / y) / (x_m * Math.pow(z, 2.0));
}
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 <= 2e+302: tmp = (1.0 / x_m) / t_0 else: tmp = (1.0 / y) / (x_m * math.pow(z, 2.0)) 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 <= 2e+302) tmp = Float64(Float64(1.0 / x_m) / t_0); else tmp = Float64(Float64(1.0 / y) / Float64(x_m * (z ^ 2.0))); 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 <= 2e+302)
tmp = (1.0 / x_m) / t_0;
else
tmp = (1.0 / y) / (x_m * (z ^ 2.0));
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, 2e+302], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] / N[(x$95$m * N[Power[z, 2.0], $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])\\
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + z \cdot z\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{x\_m \cdot {z}^{2}}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 2.0000000000000002e302Initial program 96.3%
if 2.0000000000000002e302 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 72.6%
associate-/l/72.6%
metadata-eval72.6%
associate-*r/72.6%
associate-/l/72.6%
associate-*r/72.6%
associate-/l*72.6%
associate-/r/72.6%
/-rgt-identity72.6%
associate-*l*79.9%
*-commutative79.9%
sqr-neg79.9%
+-commutative79.9%
sqr-neg79.9%
fma-def79.9%
Simplified79.9%
fma-udef79.9%
+-commutative79.9%
*-commutative79.9%
associate-*l*72.6%
associate-/l/72.6%
add-sqr-sqrt72.6%
*-un-lft-identity72.6%
times-frac72.6%
*-commutative72.6%
sqrt-prod72.6%
hypot-1-def72.6%
*-commutative72.6%
sqrt-prod79.8%
hypot-1-def99.6%
Applied egg-rr99.6%
Taylor expanded in y around 0 72.6%
*-commutative72.6%
+-commutative72.6%
unpow272.6%
fma-udef72.6%
associate-*l*79.9%
associate-/l/79.9%
Simplified79.9%
Taylor expanded in z around inf 79.9%
Final simplification93.0%
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 2e+302) (/ (/ 1.0 x_m) t_0) (/ (pow z -2.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) {
double t_0 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= 2e+302) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = pow(z, -2.0) / (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) :: t_0
real(8) :: tmp
t_0 = y * (1.0d0 + (z * z))
if (t_0 <= 2d+302) then
tmp = (1.0d0 / x_m) / t_0
else
tmp = (z ** (-2.0d0)) / (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 t_0 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= 2e+302) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = Math.pow(z, -2.0) / (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): t_0 = y * (1.0 + (z * z)) tmp = 0 if t_0 <= 2e+302: tmp = (1.0 / x_m) / t_0 else: tmp = math.pow(z, -2.0) / (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) t_0 = Float64(y * Float64(1.0 + Float64(z * z))) tmp = 0.0 if (t_0 <= 2e+302) tmp = Float64(Float64(1.0 / x_m) / t_0); else tmp = Float64((z ^ -2.0) / 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)
t_0 = y * (1.0 + (z * z));
tmp = 0.0;
if (t_0 <= 2e+302)
tmp = (1.0 / x_m) / t_0;
else
tmp = (z ^ -2.0) / (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_] := Block[{t$95$0 = N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, 2e+302], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[Power[z, -2.0], $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])\\
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + z \cdot z\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{{z}^{-2}}{y \cdot x\_m}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 2.0000000000000002e302Initial program 96.3%
if 2.0000000000000002e302 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 72.6%
associate-/l/72.6%
metadata-eval72.6%
associate-*r/72.6%
associate-/l/72.6%
associate-*r/72.6%
associate-/l*72.6%
associate-/r/72.6%
/-rgt-identity72.6%
associate-*l*79.9%
*-commutative79.9%
sqr-neg79.9%
+-commutative79.9%
sqr-neg79.9%
fma-def79.9%
Simplified79.9%
Taylor expanded in z around inf 72.6%
associate-*r*79.7%
*-commutative79.7%
Simplified79.7%
expm1-log1p-u79.7%
expm1-udef72.4%
associate-/r*72.4%
pow-flip72.4%
metadata-eval72.4%
Applied egg-rr72.4%
expm1-def79.7%
expm1-log1p79.7%
Simplified79.7%
Final simplification93.0%
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) INFINITY)
(/ (/ 1.0 y) (* x_m (fma z z 1.0)))
(/ (/ 1.0 (* (hypot 1.0 z) 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) <= ((double) INFINITY)) {
tmp = (1.0 / y) / (x_m * fma(z, z, 1.0));
} else {
tmp = (1.0 / (hypot(1.0, z) * 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) <= Inf) tmp = Float64(Float64(1.0 / y) / Float64(x_m * fma(z, z, 1.0))); else tmp = Float64(Float64(1.0 / Float64(hypot(1.0, z) * x_m)) / Float64(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], Infinity], N[(N[(1.0 / y), $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), $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 \infty:\\
\;\;\;\;\frac{\frac{1}{y}}{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}\\
\end{array}
\end{array}
if (*.f64 z z) < +inf.0Initial program 91.6%
associate-/l/91.0%
metadata-eval91.0%
associate-*r/91.0%
associate-/l/91.6%
associate-*r/91.6%
associate-/l*90.9%
associate-/r/91.0%
/-rgt-identity91.0%
associate-*l*92.5%
*-commutative92.5%
sqr-neg92.5%
+-commutative92.5%
sqr-neg92.5%
fma-def92.5%
Simplified92.5%
fma-udef92.5%
+-commutative92.5%
*-commutative92.5%
associate-*l*91.0%
associate-/l/91.6%
add-sqr-sqrt50.1%
*-un-lft-identity50.1%
times-frac50.1%
*-commutative50.1%
sqrt-prod50.1%
hypot-1-def50.1%
*-commutative50.1%
sqrt-prod51.5%
hypot-1-def55.5%
Applied egg-rr55.5%
Taylor expanded in y around 0 91.0%
*-commutative91.0%
+-commutative91.0%
unpow291.0%
fma-udef91.0%
associate-*l*92.5%
associate-/l/93.0%
Simplified93.0%
if +inf.0 < (*.f64 z z) Initial program 91.6%
associate-/l/91.0%
metadata-eval91.0%
associate-*r/91.0%
associate-/l/91.6%
associate-*r/91.6%
associate-/l*90.9%
associate-/r/91.0%
/-rgt-identity91.0%
associate-*l*92.5%
*-commutative92.5%
sqr-neg92.5%
+-commutative92.5%
sqr-neg92.5%
fma-def92.5%
Simplified92.5%
associate-/r*93.0%
div-inv92.9%
Applied egg-rr92.9%
associate-/r*93.1%
*-un-lft-identity93.1%
add-sqr-sqrt93.1%
times-frac93.0%
Applied egg-rr93.0%
associate-*r/93.1%
fma-udef93.1%
unpow293.1%
+-commutative93.1%
unpow293.1%
hypot-1-def93.1%
associate-*r/93.0%
fma-udef93.0%
unpow293.0%
+-commutative93.0%
unpow293.0%
hypot-1-def96.8%
associate-*l/96.8%
*-lft-identity96.8%
Simplified96.8%
frac-times97.6%
*-un-lft-identity97.6%
associate-/l/97.6%
*-commutative97.6%
*-commutative97.6%
Applied egg-rr97.6%
Taylor expanded in z around inf 41.4%
Final simplification93.0%
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 (<= y 2.5e+110)
(/ (/ 1.0 x_m) (fma (* z y) z y))
(/ (/ 1.0 y) (* x_m (fma z z 1.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 tmp;
if (y <= 2.5e+110) {
tmp = (1.0 / x_m) / fma((z * y), z, y);
} else {
tmp = (1.0 / y) / (x_m * fma(z, z, 1.0));
}
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 (y <= 2.5e+110) tmp = Float64(Float64(1.0 / x_m) / fma(Float64(z * y), z, y)); else tmp = Float64(Float64(1.0 / y) / Float64(x_m * fma(z, z, 1.0))); 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[y, 2.5e+110], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(N[(z * y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] / N[(x$95$m * N[(z * z + 1.0), $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}\;y \leq 2.5 \cdot 10^{+110}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{\mathsf{fma}\left(z \cdot y, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\
\end{array}
\end{array}
if y < 2.49999999999999989e110Initial program 91.4%
+-commutative91.4%
distribute-lft-in91.5%
associate-*r*94.6%
*-rgt-identity94.6%
fma-def94.6%
Applied egg-rr94.6%
if 2.49999999999999989e110 < y Initial program 91.9%
associate-/l/91.9%
metadata-eval91.9%
associate-*r/91.9%
associate-/l/91.9%
associate-*r/91.9%
associate-/l*91.9%
associate-/r/91.9%
/-rgt-identity91.9%
associate-*l*98.2%
*-commutative98.2%
sqr-neg98.2%
+-commutative98.2%
sqr-neg98.2%
fma-def98.2%
Simplified98.2%
fma-udef98.2%
+-commutative98.2%
*-commutative98.2%
associate-*l*91.9%
associate-/l/91.9%
add-sqr-sqrt91.7%
*-un-lft-identity91.7%
times-frac91.7%
*-commutative91.7%
sqrt-prod91.7%
hypot-1-def91.7%
*-commutative91.7%
sqrt-prod98.0%
hypot-1-def99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 91.9%
*-commutative91.9%
+-commutative91.9%
unpow291.9%
fma-udef91.9%
associate-*l*98.2%
associate-/l/98.3%
Simplified98.3%
Final simplification95.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 (* x_m (fma z z 1.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 * (1.0 / (y * (x_m * fma(z, z, 1.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(1.0 / Float64(y * Float64(x_m * fma(z, z, 1.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[(1.0 / N[(y * 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)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \frac{1}{y \cdot \left(x\_m \cdot \mathsf{fma}\left(z, z, 1\right)\right)}
\end{array}
Initial program 91.6%
associate-/l/91.0%
metadata-eval91.0%
associate-*r/91.0%
associate-/l/91.6%
associate-*r/91.6%
associate-/l*90.9%
associate-/r/91.0%
/-rgt-identity91.0%
associate-*l*92.5%
*-commutative92.5%
sqr-neg92.5%
+-commutative92.5%
sqr-neg92.5%
fma-def92.5%
Simplified92.5%
Final simplification92.5%
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 (* x_m (* y (+ 1.0 (* z 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 / (x_m * (y * (1.0 + (z * z)))));
}
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 / (x_m * (y * (1.0d0 + (z * z)))))
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 / (x_m * (y * (1.0 + (z * 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 / (x_m * (y * (1.0 + (z * 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(1.0 / Float64(x_m * Float64(y * Float64(1.0 + Float64(z * 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 / (x_m * (y * (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]
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[(x$95$m * N[(y * 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)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \frac{1}{x\_m \cdot \left(y \cdot \left(1 + z \cdot z\right)\right)}
\end{array}
Initial program 91.6%
associate-/l/91.0%
Simplified91.0%
Final simplification91.0%
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 x_m) (* y (+ 1.0 (* z 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 / x_m) / (y * (1.0 + (z * z))));
}
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 / x_m) / (y * (1.0d0 + (z * z))))
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 / x_m) / (y * (1.0 + (z * 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 / x_m) / (y * (1.0 + (z * 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(1.0 / x_m) / Float64(y * Float64(1.0 + Float64(z * 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 / x_m) / (y * (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]
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 / x$95$m), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $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}{x\_m}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
Initial program 91.6%
Final simplification91.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 (/ 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.6%
associate-/l/91.0%
metadata-eval91.0%
associate-*r/91.0%
associate-/l/91.6%
associate-*r/91.6%
associate-/l*90.9%
associate-/r/91.0%
/-rgt-identity91.0%
associate-*l*92.5%
*-commutative92.5%
sqr-neg92.5%
+-commutative92.5%
sqr-neg92.5%
fma-def92.5%
Simplified92.5%
Taylor expanded in z around 0 60.7%
Final simplification60.7%
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 x_m) 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) {
return x_s * ((1.0 / x_m) / y);
}
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 / x_m) / y)
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 / x_m) / y);
}
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 / x_m) / y)
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 / x_m) / y)) 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 / x_m) / y);
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 / x$95$m), $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 \frac{\frac{1}{x\_m}}{y}
\end{array}
Initial program 91.6%
Taylor expanded in z around 0 61.0%
Final simplification61.0%
(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 2024031
(FPCore (x y z)
:name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(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)))))