
(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}
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z) :precision binary64 (* y_s (/ (/ (/ 1.0 (sqrt y_m)) (hypot 1.0 z)) (* x (* (sqrt y_m) (hypot 1.0 z))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z);
double code(double y_s, double x, double y_m, double z) {
return y_s * (((1.0 / sqrt(y_m)) / hypot(1.0, z)) / (x * (sqrt(y_m) * hypot(1.0, z))));
}
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z;
public static double code(double y_s, double x, double y_m, double z) {
return y_s * (((1.0 / Math.sqrt(y_m)) / Math.hypot(1.0, z)) / (x * (Math.sqrt(y_m) * Math.hypot(1.0, z))));
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z] = sort([x, y_m, z]) def code(y_s, x, y_m, z): return y_s * (((1.0 / math.sqrt(y_m)) / math.hypot(1.0, z)) / (x * (math.sqrt(y_m) * math.hypot(1.0, z))))
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z = sort([x, y_m, z]) function code(y_s, x, y_m, z) return Float64(y_s * Float64(Float64(Float64(1.0 / sqrt(y_m)) / hypot(1.0, z)) / Float64(x * Float64(sqrt(y_m) * hypot(1.0, z))))) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z = num2cell(sort([x, y_m, z])){:}
function tmp = code(y_s, x, y_m, z)
tmp = y_s * (((1.0 / sqrt(y_m)) / hypot(1.0, z)) / (x * (sqrt(y_m) * hypot(1.0, z))));
end
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, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(N[(N[(1.0 / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[(x * N[(N[Sqrt[y$95$m], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z] = \mathsf{sort}([x, y_m, z])\\
\\
y\_s \cdot \frac{\frac{\frac{1}{\sqrt{y\_m}}}{\mathsf{hypot}\left(1, z\right)}}{x \cdot \left(\sqrt{y\_m} \cdot \mathsf{hypot}\left(1, z\right)\right)}
\end{array}
Initial program 90.4%
associate-/l/90.4%
remove-double-neg90.4%
distribute-rgt-neg-out90.4%
distribute-rgt-neg-out90.4%
remove-double-neg90.4%
associate-*l*89.2%
*-commutative89.2%
sqr-neg89.2%
+-commutative89.2%
sqr-neg89.2%
fma-define89.2%
Simplified89.2%
associate-*r*91.3%
*-commutative91.3%
associate-/r*91.0%
*-commutative91.0%
associate-/l/91.0%
fma-undefine91.0%
+-commutative91.0%
associate-/r*90.4%
*-un-lft-identity90.4%
add-sqr-sqrt42.3%
times-frac42.3%
+-commutative42.3%
fma-undefine42.3%
*-commutative42.3%
sqrt-prod42.3%
fma-undefine42.3%
+-commutative42.3%
hypot-1-def42.3%
+-commutative42.3%
Applied egg-rr47.8%
associate-/l/47.8%
associate-*r/47.8%
*-rgt-identity47.8%
*-commutative47.8%
associate-/r*47.8%
*-commutative47.8%
Simplified47.8%
Final simplification47.8%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z) :precision binary64 (let* ((t_0 (* (sqrt y_m) (hypot 1.0 z)))) (* y_s (/ 1.0 (* t_0 (* x t_0))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z);
double code(double y_s, double x, double y_m, double z) {
double t_0 = sqrt(y_m) * hypot(1.0, z);
return y_s * (1.0 / (t_0 * (x * t_0)));
}
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z;
public static double code(double y_s, double x, double y_m, double z) {
double t_0 = Math.sqrt(y_m) * Math.hypot(1.0, z);
return y_s * (1.0 / (t_0 * (x * t_0)));
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z] = sort([x, y_m, z]) def code(y_s, x, y_m, z): t_0 = math.sqrt(y_m) * math.hypot(1.0, z) return y_s * (1.0 / (t_0 * (x * t_0)))
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z = sort([x, y_m, z]) function code(y_s, x, y_m, z) t_0 = Float64(sqrt(y_m) * hypot(1.0, z)) return Float64(y_s * Float64(1.0 / Float64(t_0 * Float64(x * t_0)))) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z = num2cell(sort([x, y_m, z])){:}
function tmp = code(y_s, x, y_m, z)
t_0 = sqrt(y_m) * hypot(1.0, z);
tmp = y_s * (1.0 / (t_0 * (x * t_0)));
end
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, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[Sqrt[y$95$m], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(1.0 / N[(t$95$0 * N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z] = \mathsf{sort}([x, y_m, z])\\
\\
\begin{array}{l}
t_0 := \sqrt{y\_m} \cdot \mathsf{hypot}\left(1, z\right)\\
y\_s \cdot \frac{1}{t\_0 \cdot \left(x \cdot t\_0\right)}
\end{array}
\end{array}
Initial program 90.4%
associate-/l/90.4%
remove-double-neg90.4%
distribute-rgt-neg-out90.4%
distribute-rgt-neg-out90.4%
remove-double-neg90.4%
associate-*l*89.2%
*-commutative89.2%
sqr-neg89.2%
+-commutative89.2%
sqr-neg89.2%
fma-define89.2%
Simplified89.2%
associate-/r*89.2%
div-inv89.2%
Applied egg-rr89.2%
un-div-inv89.2%
*-un-lft-identity89.2%
fma-undefine89.2%
+-commutative89.2%
times-frac90.8%
metadata-eval90.8%
add-sqr-sqrt42.7%
frac-times42.8%
add-sqr-sqrt42.8%
hypot-1-def42.8%
hypot-1-def42.8%
frac-times44.8%
associate-/l/44.8%
un-div-inv44.8%
times-frac47.8%
*-un-lft-identity47.8%
div-inv47.8%
Applied egg-rr47.7%
Final simplification47.7%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z) :precision binary64 (* y_s (/ (pow y_m -0.5) (* (* (sqrt y_m) (hypot 1.0 z)) (* (hypot 1.0 z) x)))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z);
double code(double y_s, double x, double y_m, double z) {
return y_s * (pow(y_m, -0.5) / ((sqrt(y_m) * hypot(1.0, z)) * (hypot(1.0, z) * x)));
}
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z;
public static double code(double y_s, double x, double y_m, double z) {
return y_s * (Math.pow(y_m, -0.5) / ((Math.sqrt(y_m) * Math.hypot(1.0, z)) * (Math.hypot(1.0, z) * x)));
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z] = sort([x, y_m, z]) def code(y_s, x, y_m, z): return y_s * (math.pow(y_m, -0.5) / ((math.sqrt(y_m) * math.hypot(1.0, z)) * (math.hypot(1.0, z) * x)))
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z = sort([x, y_m, z]) function code(y_s, x, y_m, z) return Float64(y_s * Float64((y_m ^ -0.5) / Float64(Float64(sqrt(y_m) * hypot(1.0, z)) * Float64(hypot(1.0, z) * x)))) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z = num2cell(sort([x, y_m, z])){:}
function tmp = code(y_s, x, y_m, z)
tmp = y_s * ((y_m ^ -0.5) / ((sqrt(y_m) * hypot(1.0, z)) * (hypot(1.0, z) * x)));
end
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, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(N[Power[y$95$m, -0.5], $MachinePrecision] / N[(N[(N[Sqrt[y$95$m], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z] = \mathsf{sort}([x, y_m, z])\\
\\
y\_s \cdot \frac{{y\_m}^{-0.5}}{\left(\sqrt{y\_m} \cdot \mathsf{hypot}\left(1, z\right)\right) \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot x\right)}
\end{array}
Initial program 90.4%
associate-/l/90.4%
remove-double-neg90.4%
distribute-rgt-neg-out90.4%
distribute-rgt-neg-out90.4%
remove-double-neg90.4%
associate-*l*89.2%
*-commutative89.2%
sqr-neg89.2%
+-commutative89.2%
sqr-neg89.2%
fma-define89.2%
Simplified89.2%
associate-/r*89.2%
div-inv89.2%
Applied egg-rr89.2%
un-div-inv89.2%
*-un-lft-identity89.2%
fma-undefine89.2%
+-commutative89.2%
times-frac90.8%
metadata-eval90.8%
add-sqr-sqrt42.7%
frac-times42.8%
add-sqr-sqrt42.8%
hypot-1-def42.8%
hypot-1-def42.8%
frac-times44.8%
associate-/l/44.8%
un-div-inv44.8%
times-frac47.8%
*-un-lft-identity47.8%
associate-/l/47.4%
Applied egg-rr46.7%
Final simplification46.7%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z) :precision binary64 (* y_s (/ (pow (* (hypot 1.0 z) (sqrt x)) -2.0) y_m)))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z);
double code(double y_s, double x, double y_m, double z) {
return y_s * (pow((hypot(1.0, z) * sqrt(x)), -2.0) / y_m);
}
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z;
public static double code(double y_s, double x, double y_m, double z) {
return y_s * (Math.pow((Math.hypot(1.0, z) * Math.sqrt(x)), -2.0) / y_m);
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z] = sort([x, y_m, z]) def code(y_s, x, y_m, z): return y_s * (math.pow((math.hypot(1.0, z) * math.sqrt(x)), -2.0) / y_m)
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z = sort([x, y_m, z]) function code(y_s, x, y_m, z) return Float64(y_s * Float64((Float64(hypot(1.0, z) * sqrt(x)) ^ -2.0) / y_m)) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z = num2cell(sort([x, y_m, z])){:}
function tmp = code(y_s, x, y_m, z)
tmp = y_s * (((hypot(1.0, z) * sqrt(x)) ^ -2.0) / y_m);
end
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, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(N[Power[N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z] = \mathsf{sort}([x, y_m, z])\\
\\
y\_s \cdot \frac{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x}\right)}^{-2}}{y\_m}
\end{array}
Initial program 90.4%
associate-/l/90.4%
remove-double-neg90.4%
distribute-rgt-neg-out90.4%
distribute-rgt-neg-out90.4%
remove-double-neg90.4%
associate-*l*89.2%
*-commutative89.2%
sqr-neg89.2%
+-commutative89.2%
sqr-neg89.2%
fma-define89.2%
Simplified89.2%
associate-*r*91.3%
*-commutative91.3%
associate-/r*91.0%
*-commutative91.0%
associate-/l/91.0%
fma-undefine91.0%
+-commutative91.0%
associate-/r*90.4%
*-un-lft-identity90.4%
add-sqr-sqrt42.3%
times-frac42.3%
+-commutative42.3%
fma-undefine42.3%
*-commutative42.3%
sqrt-prod42.3%
fma-undefine42.3%
+-commutative42.3%
hypot-1-def42.3%
+-commutative42.3%
Applied egg-rr47.8%
associate-/l/47.8%
associate-*r/47.8%
*-rgt-identity47.8%
*-commutative47.8%
associate-/r*47.8%
*-commutative47.8%
Simplified47.8%
*-un-lft-identity47.8%
times-frac44.8%
un-div-inv44.8%
associate-/l/44.8%
frac-times42.8%
frac-times42.7%
metadata-eval42.7%
add-sqr-sqrt90.8%
hypot-1-def90.8%
hypot-1-def90.8%
add-sqr-sqrt90.8%
times-frac89.2%
+-commutative89.2%
fma-undefine89.2%
add-sqr-sqrt42.6%
Applied egg-rr46.6%
associate-/r*46.6%
associate-/l/46.6%
associate-*r/44.1%
unpow-144.1%
unpow-144.1%
pow-sqr44.1%
metadata-eval44.1%
Simplified44.1%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= (+ 1.0 (* z z)) INFINITY)
(/ (/ (/ 1.0 x) (fma z z 1.0)) y_m)
(* (/ (/ 1.0 z) y_m) (/ (/ 1.0 z) x)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if ((1.0 + (z * z)) <= ((double) INFINITY)) {
tmp = ((1.0 / x) / fma(z, z, 1.0)) / y_m;
} else {
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x);
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z = sort([x, y_m, z]) function code(y_s, x, y_m, z) tmp = 0.0 if (Float64(1.0 + Float64(z * z)) <= Inf) tmp = Float64(Float64(Float64(1.0 / x) / fma(z, z, 1.0)) / y_m); else tmp = Float64(Float64(Float64(1.0 / z) / y_m) * Float64(Float64(1.0 / z) / x)); end return Float64(y_s * tmp) end
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, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(1.0 / x), $MachinePrecision] / N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z] = \mathsf{sort}([x, y_m, z])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;1 + z \cdot z \leq \infty:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{\mathsf{fma}\left(z, z, 1\right)}}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y\_m} \cdot \frac{\frac{1}{z}}{x}\\
\end{array}
\end{array}
if (+.f64 #s(literal 1 binary64) (*.f64 z z)) < +inf.0Initial program 90.4%
associate-/l/90.4%
remove-double-neg90.4%
distribute-rgt-neg-out90.4%
distribute-rgt-neg-out90.4%
remove-double-neg90.4%
associate-*l*89.2%
*-commutative89.2%
sqr-neg89.2%
+-commutative89.2%
sqr-neg89.2%
fma-define89.2%
Simplified89.2%
associate-*r*91.3%
*-commutative91.3%
associate-/r*91.0%
*-commutative91.0%
associate-/l/91.0%
fma-undefine91.0%
+-commutative91.0%
associate-/r*90.4%
*-un-lft-identity90.4%
add-sqr-sqrt42.3%
times-frac42.3%
+-commutative42.3%
fma-undefine42.3%
*-commutative42.3%
sqrt-prod42.3%
fma-undefine42.3%
+-commutative42.3%
hypot-1-def42.3%
+-commutative42.3%
Applied egg-rr47.8%
associate-/l/47.8%
associate-*r/47.8%
*-rgt-identity47.8%
*-commutative47.8%
associate-/r*47.8%
*-commutative47.8%
Simplified47.8%
*-un-lft-identity47.8%
times-frac44.8%
un-div-inv44.8%
associate-/l/44.8%
frac-times42.8%
frac-times42.7%
metadata-eval42.7%
add-sqr-sqrt90.8%
hypot-1-def90.8%
hypot-1-def90.8%
add-sqr-sqrt90.8%
times-frac89.2%
+-commutative89.2%
fma-undefine89.2%
add-sqr-sqrt42.6%
Applied egg-rr46.6%
associate-/r*46.6%
associate-/l/46.6%
associate-*r/44.1%
unpow-144.1%
unpow-144.1%
pow-sqr44.1%
metadata-eval44.1%
Simplified44.1%
Taylor expanded in x around 0 89.2%
associate-/r*89.3%
+-commutative89.3%
unpow289.3%
fma-define89.3%
Simplified89.3%
if +inf.0 < (+.f64 #s(literal 1 binary64) (*.f64 z z)) Initial program 90.4%
remove-double-neg90.4%
distribute-lft-neg-out90.4%
distribute-rgt-neg-in90.4%
associate-/r*91.0%
associate-/l/91.0%
associate-/l/91.3%
distribute-lft-neg-out91.3%
distribute-rgt-neg-in91.3%
distribute-lft-neg-in91.3%
remove-double-neg91.3%
sqr-neg91.3%
+-commutative91.3%
sqr-neg91.3%
fma-define91.3%
*-commutative91.3%
Simplified91.3%
Taylor expanded in z around inf 59.3%
*-un-lft-identity59.3%
pow259.3%
associate-/r*59.3%
pow259.3%
pow-flip59.4%
metadata-eval59.4%
Applied egg-rr59.4%
*-lft-identity59.4%
Simplified59.4%
sqr-pow59.2%
*-commutative59.2%
times-frac63.0%
metadata-eval63.0%
unpow-163.0%
metadata-eval63.0%
unpow-163.0%
Applied egg-rr63.0%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= (* z z) INFINITY)
(/ 1.0 (* y_m (* x (fma z z 1.0))))
(* (/ (/ 1.0 z) y_m) (/ (/ 1.0 z) x)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if ((z * z) <= ((double) INFINITY)) {
tmp = 1.0 / (y_m * (x * fma(z, z, 1.0)));
} else {
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x);
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z = sort([x, y_m, z]) function code(y_s, x, y_m, z) tmp = 0.0 if (Float64(z * z) <= Inf) tmp = Float64(1.0 / Float64(y_m * Float64(x * fma(z, z, 1.0)))); else tmp = Float64(Float64(Float64(1.0 / z) / y_m) * Float64(Float64(1.0 / z) / x)); end return Float64(y_s * tmp) end
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, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(z * z), $MachinePrecision], Infinity], N[(1.0 / N[(y$95$m * N[(x * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z] = \mathsf{sort}([x, y_m, z])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq \infty:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y\_m} \cdot \frac{\frac{1}{z}}{x}\\
\end{array}
\end{array}
if (*.f64 z z) < +inf.0Initial program 90.4%
associate-/l/90.4%
remove-double-neg90.4%
distribute-rgt-neg-out90.4%
distribute-rgt-neg-out90.4%
remove-double-neg90.4%
associate-*l*89.2%
*-commutative89.2%
sqr-neg89.2%
+-commutative89.2%
sqr-neg89.2%
fma-define89.2%
Simplified89.2%
if +inf.0 < (*.f64 z z) Initial program 90.4%
remove-double-neg90.4%
distribute-lft-neg-out90.4%
distribute-rgt-neg-in90.4%
associate-/r*91.0%
associate-/l/91.0%
associate-/l/91.3%
distribute-lft-neg-out91.3%
distribute-rgt-neg-in91.3%
distribute-lft-neg-in91.3%
remove-double-neg91.3%
sqr-neg91.3%
+-commutative91.3%
sqr-neg91.3%
fma-define91.3%
*-commutative91.3%
Simplified91.3%
Taylor expanded in z around inf 59.3%
*-un-lft-identity59.3%
pow259.3%
associate-/r*59.3%
pow259.3%
pow-flip59.4%
metadata-eval59.4%
Applied egg-rr59.4%
*-lft-identity59.4%
Simplified59.4%
sqr-pow59.2%
*-commutative59.2%
times-frac63.0%
metadata-eval63.0%
unpow-163.0%
metadata-eval63.0%
unpow-163.0%
Applied egg-rr63.0%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z) :precision binary64 (let* ((t_0 (/ (/ 1.0 x) (* y_m (+ 1.0 (* z z)))))) (* y_s (if (<= t_0 5e-273) (* (/ 1.0 z) (/ (/ 1.0 z) (* y_m x))) t_0))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z);
double code(double y_s, double x, double y_m, double z) {
double t_0 = (1.0 / x) / (y_m * (1.0 + (z * z)));
double tmp;
if (t_0 <= 5e-273) {
tmp = (1.0 / z) * ((1.0 / z) / (y_m * x));
} else {
tmp = t_0;
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 / x) / (y_m * (1.0d0 + (z * z)))
if (t_0 <= 5d-273) then
tmp = (1.0d0 / z) * ((1.0d0 / z) / (y_m * x))
else
tmp = t_0
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z;
public static double code(double y_s, double x, double y_m, double z) {
double t_0 = (1.0 / x) / (y_m * (1.0 + (z * z)));
double tmp;
if (t_0 <= 5e-273) {
tmp = (1.0 / z) * ((1.0 / z) / (y_m * x));
} else {
tmp = t_0;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z] = sort([x, y_m, z]) def code(y_s, x, y_m, z): t_0 = (1.0 / x) / (y_m * (1.0 + (z * z))) tmp = 0 if t_0 <= 5e-273: tmp = (1.0 / z) * ((1.0 / z) / (y_m * x)) else: tmp = t_0 return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z = sort([x, y_m, z]) function code(y_s, x, y_m, z) t_0 = Float64(Float64(1.0 / x) / Float64(y_m * Float64(1.0 + Float64(z * z)))) tmp = 0.0 if (t_0 <= 5e-273) tmp = Float64(Float64(1.0 / z) * Float64(Float64(1.0 / z) / Float64(y_m * x))); else tmp = t_0; end return Float64(y_s * tmp) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z = num2cell(sort([x, y_m, z])){:}
function tmp_2 = code(y_s, x, y_m, z)
t_0 = (1.0 / x) / (y_m * (1.0 + (z * z)));
tmp = 0.0;
if (t_0 <= 5e-273)
tmp = (1.0 / z) * ((1.0 / z) / (y_m * x));
else
tmp = t_0;
end
tmp_2 = y_s * tmp;
end
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, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(1.0 / x), $MachinePrecision] / N[(y$95$m * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, 5e-273], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / N[(y$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z] = \mathsf{sort}([x, y_m, z])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{x}}{y\_m \cdot \left(1 + z \cdot z\right)}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-273}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{\frac{1}{z}}{y\_m \cdot x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (/.f64 (/.f64 #s(literal 1 binary64) x) (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))) < 4.99999999999999965e-273Initial program 86.3%
remove-double-neg86.3%
distribute-lft-neg-out86.3%
distribute-rgt-neg-in86.3%
associate-/r*88.7%
associate-/l/88.7%
associate-/l/89.1%
distribute-lft-neg-out89.1%
distribute-rgt-neg-in89.1%
distribute-lft-neg-in89.1%
remove-double-neg89.1%
sqr-neg89.1%
+-commutative89.1%
sqr-neg89.1%
fma-define89.1%
*-commutative89.1%
Simplified89.1%
Taylor expanded in z around inf 66.5%
*-un-lft-identity66.5%
pow266.5%
associate-/r*66.5%
pow266.5%
pow-flip66.6%
metadata-eval66.6%
Applied egg-rr66.6%
*-lft-identity66.6%
Simplified66.6%
sqr-pow66.5%
associate-/l*76.1%
metadata-eval76.1%
unpow-176.1%
metadata-eval76.1%
unpow-176.1%
Applied egg-rr76.1%
if 4.99999999999999965e-273 < (/.f64 (/.f64 #s(literal 1 binary64) x) (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))) Initial program 99.6%
Final simplification83.4%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= (* z z) 0.01)
(/ (/ 1.0 y_m) x)
(if (<= (* z z) INFINITY)
(/ 1.0 (* y_m (* x (* z z))))
(* (/ (/ 1.0 z) y_m) (/ (/ 1.0 z) x))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if ((z * z) <= 0.01) {
tmp = (1.0 / y_m) / x;
} else if ((z * z) <= ((double) INFINITY)) {
tmp = 1.0 / (y_m * (x * (z * z)));
} else {
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x);
}
return y_s * tmp;
}
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z;
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if ((z * z) <= 0.01) {
tmp = (1.0 / y_m) / x;
} else if ((z * z) <= Double.POSITIVE_INFINITY) {
tmp = 1.0 / (y_m * (x * (z * z)));
} else {
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z] = sort([x, y_m, z]) def code(y_s, x, y_m, z): tmp = 0 if (z * z) <= 0.01: tmp = (1.0 / y_m) / x elif (z * z) <= math.inf: tmp = 1.0 / (y_m * (x * (z * z))) else: tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z = sort([x, y_m, z]) function code(y_s, x, y_m, z) tmp = 0.0 if (Float64(z * z) <= 0.01) tmp = Float64(Float64(1.0 / y_m) / x); elseif (Float64(z * z) <= Inf) tmp = Float64(1.0 / Float64(y_m * Float64(x * Float64(z * z)))); else tmp = Float64(Float64(Float64(1.0 / z) / y_m) * Float64(Float64(1.0 / z) / x)); end return Float64(y_s * tmp) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z = num2cell(sort([x, y_m, z])){:}
function tmp_2 = code(y_s, x, y_m, z)
tmp = 0.0;
if ((z * z) <= 0.01)
tmp = (1.0 / y_m) / x;
elseif ((z * z) <= Inf)
tmp = 1.0 / (y_m * (x * (z * z)));
else
tmp = ((1.0 / z) / y_m) * ((1.0 / z) / x);
end
tmp_2 = y_s * tmp;
end
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, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 0.01], N[(N[(1.0 / y$95$m), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], Infinity], N[(1.0 / N[(y$95$m * N[(x * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z] = \mathsf{sort}([x, y_m, z])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 0.01:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x}\\
\mathbf{elif}\;z \cdot z \leq \infty:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x \cdot \left(z \cdot z\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y\_m} \cdot \frac{\frac{1}{z}}{x}\\
\end{array}
\end{array}
if (*.f64 z z) < 0.0100000000000000002Initial program 99.7%
associate-/l/99.7%
remove-double-neg99.7%
distribute-rgt-neg-out99.7%
distribute-rgt-neg-out99.7%
remove-double-neg99.7%
associate-*l*99.7%
*-commutative99.7%
sqr-neg99.7%
+-commutative99.7%
sqr-neg99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in z around 0 99.0%
add-sqr-sqrt59.4%
pow259.4%
inv-pow59.4%
sqrt-pow159.4%
*-commutative59.4%
metadata-eval59.4%
Applied egg-rr59.4%
pow-pow99.0%
metadata-eval99.0%
inv-pow99.0%
*-commutative99.0%
associate-/r*98.9%
Applied egg-rr98.9%
if 0.0100000000000000002 < (*.f64 z z) < +inf.0Initial program 82.6%
associate-/l/82.6%
remove-double-neg82.6%
distribute-rgt-neg-out82.6%
distribute-rgt-neg-out82.6%
remove-double-neg82.6%
associate-*l*80.6%
*-commutative80.6%
sqr-neg80.6%
+-commutative80.6%
sqr-neg80.6%
fma-define80.6%
Simplified80.6%
Taylor expanded in z around inf 80.6%
pow280.6%
Applied egg-rr80.6%
if +inf.0 < (*.f64 z z) Initial program 90.4%
remove-double-neg90.4%
distribute-lft-neg-out90.4%
distribute-rgt-neg-in90.4%
associate-/r*91.0%
associate-/l/91.0%
associate-/l/91.3%
distribute-lft-neg-out91.3%
distribute-rgt-neg-in91.3%
distribute-lft-neg-in91.3%
remove-double-neg91.3%
sqr-neg91.3%
+-commutative91.3%
sqr-neg91.3%
fma-define91.3%
*-commutative91.3%
Simplified91.3%
Taylor expanded in z around inf 59.3%
*-un-lft-identity59.3%
pow259.3%
associate-/r*59.3%
pow259.3%
pow-flip59.4%
metadata-eval59.4%
Applied egg-rr59.4%
*-lft-identity59.4%
Simplified59.4%
sqr-pow59.2%
*-commutative59.2%
times-frac63.0%
metadata-eval63.0%
unpow-163.0%
metadata-eval63.0%
unpow-163.0%
Applied egg-rr63.0%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= (* z z) 0.01)
(/ (/ 1.0 y_m) x)
(if (<= (* z z) 5e+248)
(/ 1.0 (* y_m (* x (* z z))))
(* (/ 1.0 z) (/ (/ 1.0 z) (* y_m x)))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if ((z * z) <= 0.01) {
tmp = (1.0 / y_m) / x;
} else if ((z * z) <= 5e+248) {
tmp = 1.0 / (y_m * (x * (z * z)));
} else {
tmp = (1.0 / z) * ((1.0 / z) / (y_m * x));
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 0.01d0) then
tmp = (1.0d0 / y_m) / x
else if ((z * z) <= 5d+248) then
tmp = 1.0d0 / (y_m * (x * (z * z)))
else
tmp = (1.0d0 / z) * ((1.0d0 / z) / (y_m * x))
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z;
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if ((z * z) <= 0.01) {
tmp = (1.0 / y_m) / x;
} else if ((z * z) <= 5e+248) {
tmp = 1.0 / (y_m * (x * (z * z)));
} else {
tmp = (1.0 / z) * ((1.0 / z) / (y_m * x));
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z] = sort([x, y_m, z]) def code(y_s, x, y_m, z): tmp = 0 if (z * z) <= 0.01: tmp = (1.0 / y_m) / x elif (z * z) <= 5e+248: tmp = 1.0 / (y_m * (x * (z * z))) else: tmp = (1.0 / z) * ((1.0 / z) / (y_m * x)) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z = sort([x, y_m, z]) function code(y_s, x, y_m, z) tmp = 0.0 if (Float64(z * z) <= 0.01) tmp = Float64(Float64(1.0 / y_m) / x); elseif (Float64(z * z) <= 5e+248) tmp = Float64(1.0 / Float64(y_m * Float64(x * Float64(z * z)))); else tmp = Float64(Float64(1.0 / z) * Float64(Float64(1.0 / z) / Float64(y_m * x))); end return Float64(y_s * tmp) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z = num2cell(sort([x, y_m, z])){:}
function tmp_2 = code(y_s, x, y_m, z)
tmp = 0.0;
if ((z * z) <= 0.01)
tmp = (1.0 / y_m) / x;
elseif ((z * z) <= 5e+248)
tmp = 1.0 / (y_m * (x * (z * z)));
else
tmp = (1.0 / z) * ((1.0 / z) / (y_m * x));
end
tmp_2 = y_s * tmp;
end
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, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 0.01], N[(N[(1.0 / y$95$m), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+248], N[(1.0 / N[(y$95$m * N[(x * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / N[(y$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z] = \mathsf{sort}([x, y_m, z])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 0.01:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x}\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+248}:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x \cdot \left(z \cdot z\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{\frac{1}{z}}{y\_m \cdot x}\\
\end{array}
\end{array}
if (*.f64 z z) < 0.0100000000000000002Initial program 99.7%
associate-/l/99.7%
remove-double-neg99.7%
distribute-rgt-neg-out99.7%
distribute-rgt-neg-out99.7%
remove-double-neg99.7%
associate-*l*99.7%
*-commutative99.7%
sqr-neg99.7%
+-commutative99.7%
sqr-neg99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in z around 0 99.0%
add-sqr-sqrt59.4%
pow259.4%
inv-pow59.4%
sqrt-pow159.4%
*-commutative59.4%
metadata-eval59.4%
Applied egg-rr59.4%
pow-pow99.0%
metadata-eval99.0%
inv-pow99.0%
*-commutative99.0%
associate-/r*98.9%
Applied egg-rr98.9%
if 0.0100000000000000002 < (*.f64 z z) < 4.9999999999999996e248Initial program 88.0%
associate-/l/88.0%
remove-double-neg88.0%
distribute-rgt-neg-out88.0%
distribute-rgt-neg-out88.0%
remove-double-neg88.0%
associate-*l*86.2%
*-commutative86.2%
sqr-neg86.2%
+-commutative86.2%
sqr-neg86.2%
fma-define86.2%
Simplified86.2%
Taylor expanded in z around inf 86.2%
pow286.2%
Applied egg-rr86.2%
if 4.9999999999999996e248 < (*.f64 z z) Initial program 79.0%
remove-double-neg79.0%
distribute-lft-neg-out79.0%
distribute-rgt-neg-in79.0%
associate-/r*78.6%
associate-/l/78.6%
associate-/l/78.7%
distribute-lft-neg-out78.7%
distribute-rgt-neg-in78.7%
distribute-lft-neg-in78.7%
remove-double-neg78.7%
sqr-neg78.7%
+-commutative78.7%
sqr-neg78.7%
fma-define78.7%
*-commutative78.7%
Simplified78.7%
Taylor expanded in z around inf 78.7%
*-un-lft-identity78.7%
pow278.7%
associate-/r*78.7%
pow278.7%
pow-flip78.8%
metadata-eval78.8%
Applied egg-rr78.8%
*-lft-identity78.8%
Simplified78.8%
sqr-pow78.8%
associate-/l*93.3%
metadata-eval93.3%
unpow-193.3%
metadata-eval93.3%
unpow-193.3%
Applied egg-rr93.3%
Final simplification94.3%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= (* z z) 1.0) (/ (/ 1.0 y_m) x) (/ 1.0 (* y_m (* x (* z z)))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if ((z * z) <= 1.0) {
tmp = (1.0 / y_m) / x;
} else {
tmp = 1.0 / (y_m * (x * (z * z)));
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 1.0d0) then
tmp = (1.0d0 / y_m) / x
else
tmp = 1.0d0 / (y_m * (x * (z * z)))
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z;
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if ((z * z) <= 1.0) {
tmp = (1.0 / y_m) / x;
} else {
tmp = 1.0 / (y_m * (x * (z * z)));
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z] = sort([x, y_m, z]) def code(y_s, x, y_m, z): tmp = 0 if (z * z) <= 1.0: tmp = (1.0 / y_m) / x else: tmp = 1.0 / (y_m * (x * (z * z))) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z = sort([x, y_m, z]) function code(y_s, x, y_m, z) tmp = 0.0 if (Float64(z * z) <= 1.0) tmp = Float64(Float64(1.0 / y_m) / x); else tmp = Float64(1.0 / Float64(y_m * Float64(x * Float64(z * z)))); end return Float64(y_s * tmp) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z = num2cell(sort([x, y_m, z])){:}
function tmp_2 = code(y_s, x, y_m, z)
tmp = 0.0;
if ((z * z) <= 1.0)
tmp = (1.0 / y_m) / x;
else
tmp = 1.0 / (y_m * (x * (z * z)));
end
tmp_2 = y_s * tmp;
end
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, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 1.0], N[(N[(1.0 / y$95$m), $MachinePrecision] / x), $MachinePrecision], N[(1.0 / N[(y$95$m * N[(x * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z] = \mathsf{sort}([x, y_m, z])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y\_m}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y\_m \cdot \left(x \cdot \left(z \cdot z\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 1Initial program 99.7%
associate-/l/99.7%
remove-double-neg99.7%
distribute-rgt-neg-out99.7%
distribute-rgt-neg-out99.7%
remove-double-neg99.7%
associate-*l*99.7%
*-commutative99.7%
sqr-neg99.7%
+-commutative99.7%
sqr-neg99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in z around 0 99.0%
add-sqr-sqrt59.4%
pow259.4%
inv-pow59.4%
sqrt-pow159.4%
*-commutative59.4%
metadata-eval59.4%
Applied egg-rr59.4%
pow-pow99.0%
metadata-eval99.0%
inv-pow99.0%
*-commutative99.0%
associate-/r*98.9%
Applied egg-rr98.9%
if 1 < (*.f64 z z) Initial program 82.6%
associate-/l/82.6%
remove-double-neg82.6%
distribute-rgt-neg-out82.6%
distribute-rgt-neg-out82.6%
remove-double-neg82.6%
associate-*l*80.6%
*-commutative80.6%
sqr-neg80.6%
+-commutative80.6%
sqr-neg80.6%
fma-define80.6%
Simplified80.6%
Taylor expanded in z around inf 80.6%
pow280.6%
Applied egg-rr80.6%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) NOTE: x, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x y_m z) :precision binary64 (* y_s (/ 1.0 (* y_m x))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x < y_m && y_m < z);
double code(double y_s, double x, double y_m, double z) {
return y_s * (1.0 / (y_m * x));
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (1.0d0 / (y_m * x))
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z;
public static double code(double y_s, double x, double y_m, double z) {
return y_s * (1.0 / (y_m * x));
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) [x, y_m, z] = sort([x, y_m, z]) def code(y_s, x, y_m, z): return y_s * (1.0 / (y_m * x))
y\_m = abs(y) y\_s = copysign(1.0, y) x, y_m, z = sort([x, y_m, z]) function code(y_s, x, y_m, z) return Float64(y_s * Float64(1.0 / Float64(y_m * x))) end
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x, y_m, z = num2cell(sort([x, y_m, z])){:}
function tmp = code(y_s, x, y_m, z)
tmp = y_s * (1.0 / (y_m * x));
end
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, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(1.0 / N[(y$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z] = \mathsf{sort}([x, y_m, z])\\
\\
y\_s \cdot \frac{1}{y\_m \cdot x}
\end{array}
Initial program 90.4%
associate-/l/90.4%
remove-double-neg90.4%
distribute-rgt-neg-out90.4%
distribute-rgt-neg-out90.4%
remove-double-neg90.4%
associate-*l*89.2%
*-commutative89.2%
sqr-neg89.2%
+-commutative89.2%
sqr-neg89.2%
fma-define89.2%
Simplified89.2%
Taylor expanded in z around 0 52.9%
(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 2024119
(FPCore (x y z)
:name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (if (< (* y (+ 1 (* z z))) -inf.0) (/ (/ 1 y) (* (+ 1 (* z z)) x)) (if (< (* y (+ 1 (* z z))) 868074325056725200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (/ 1 x) (* (+ 1 (* z z)) y)) (/ (/ 1 y) (* (+ 1 (* z z)) x)))))
(/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))