
(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 (/ (pow y -0.5) z)))
(*
x_s
(if (<= (* z z) 2e+41)
(/ (/ 1.0 y) (* x_m (fma z z 1.0)))
(* t_0 (/ t_0 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 = pow(y, -0.5) / z;
double tmp;
if ((z * z) <= 2e+41) {
tmp = (1.0 / y) / (x_m * fma(z, z, 1.0));
} else {
tmp = t_0 * (t_0 / 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 ^ -0.5) / z) tmp = 0.0 if (Float64(z * z) <= 2e+41) tmp = Float64(Float64(1.0 / y) / Float64(x_m * fma(z, z, 1.0))); else tmp = Float64(t_0 * Float64(t_0 / 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_] := Block[{t$95$0 = N[(N[Power[y, -0.5], $MachinePrecision] / z), $MachinePrecision]}, N[(x$95$s * If[LessEqual[N[(z * z), $MachinePrecision], 2e+41], N[(N[(1.0 / y), $MachinePrecision] / N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(t$95$0 / 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 := \frac{{y}^{-0.5}}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+41}:\\
\;\;\;\;\frac{\frac{1}{y}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{t\_0}{x\_m}\\
\end{array}
\end{array}
\end{array}
if (*.f64 z z) < 2.00000000000000001e41Initial program 99.2%
associate-/l/99.1%
associate-*l*99.0%
*-commutative99.0%
sqr-neg99.0%
+-commutative99.0%
sqr-neg99.0%
fma-define99.0%
Simplified99.0%
associate-*r*99.6%
*-commutative99.6%
associate-/r*99.7%
*-commutative99.7%
associate-/l/99.7%
fma-undefine99.7%
+-commutative99.7%
associate-/r*99.2%
*-un-lft-identity99.2%
add-sqr-sqrt53.1%
times-frac53.1%
+-commutative53.1%
fma-undefine53.1%
*-commutative53.1%
sqrt-prod53.1%
fma-undefine53.1%
+-commutative53.1%
hypot-1-def53.1%
+-commutative53.1%
Applied egg-rr53.7%
*-commutative53.7%
div-inv53.6%
associate-*l*53.6%
associate-/r*53.6%
associate-/r*53.6%
frac-times53.7%
Applied egg-rr99.1%
if 2.00000000000000001e41 < (*.f64 z z) Initial program 71.4%
associate-/l/71.5%
associate-*l*80.0%
*-commutative80.0%
sqr-neg80.0%
+-commutative80.0%
sqr-neg80.0%
fma-define80.0%
Simplified80.0%
associate-*r*73.8%
*-commutative73.8%
associate-/r*73.7%
*-commutative73.7%
associate-/l/73.7%
fma-undefine73.7%
+-commutative73.7%
associate-/r*71.4%
*-un-lft-identity71.4%
add-sqr-sqrt33.4%
times-frac33.5%
+-commutative33.5%
fma-undefine33.5%
*-commutative33.5%
sqrt-prod33.5%
fma-undefine33.5%
+-commutative33.5%
hypot-1-def33.5%
+-commutative33.5%
Applied egg-rr47.0%
Taylor expanded in z around inf 71.5%
associate-*r*73.8%
*-commutative73.8%
Simplified73.8%
associate-/r*73.8%
associate-/l/72.7%
un-div-inv72.8%
add-sqr-sqrt61.5%
associate-/l*61.4%
associate-*l/61.5%
*-un-lft-identity61.5%
sqrt-div34.3%
inv-pow34.3%
sqrt-pow134.4%
metadata-eval34.4%
sqrt-pow130.8%
metadata-eval30.8%
pow130.8%
Applied egg-rr47.1%
Final simplification76.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 (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 87.3%
associate-/l/87.2%
associate-*l*90.8%
*-commutative90.8%
sqr-neg90.8%
+-commutative90.8%
sqr-neg90.8%
fma-define90.8%
Simplified90.8%
associate-*r*88.5%
*-commutative88.5%
associate-/r*88.5%
*-commutative88.5%
associate-/l/88.5%
fma-undefine88.5%
+-commutative88.5%
associate-/r*87.3%
*-un-lft-identity87.3%
add-sqr-sqrt44.7%
times-frac44.7%
+-commutative44.7%
fma-undefine44.7%
*-commutative44.7%
sqrt-prod44.7%
fma-undefine44.7%
+-commutative44.7%
hypot-1-def44.7%
+-commutative44.7%
Applied egg-rr50.8%
Final simplification50.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 (sqrt y)) (hypot 1.0 z)) (* (* (hypot 1.0 z) (sqrt 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 / sqrt(y)) / hypot(1.0, z)) / ((hypot(1.0, z) * sqrt(y)) * 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 / Math.sqrt(y)) / Math.hypot(1.0, z)) / ((Math.hypot(1.0, z) * Math.sqrt(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 / math.sqrt(y)) / math.hypot(1.0, z)) / ((math.hypot(1.0, z) * math.sqrt(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(Float64(Float64(1.0 / sqrt(y)) / hypot(1.0, z)) / Float64(Float64(hypot(1.0, z) * sqrt(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 / sqrt(y)) / hypot(1.0, z)) / ((hypot(1.0, z) * sqrt(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[(N[(N[(1.0 / N[Sqrt[y], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[y], $MachinePrecision]), $MachinePrecision] * 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{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x\_m}
\end{array}
Initial program 87.3%
associate-/l/87.2%
associate-*l*90.8%
*-commutative90.8%
sqr-neg90.8%
+-commutative90.8%
sqr-neg90.8%
fma-define90.8%
Simplified90.8%
associate-*r*88.5%
*-commutative88.5%
associate-/r*88.5%
*-commutative88.5%
associate-/l/88.5%
fma-undefine88.5%
+-commutative88.5%
associate-/r*87.3%
*-un-lft-identity87.3%
add-sqr-sqrt44.7%
times-frac44.7%
+-commutative44.7%
fma-undefine44.7%
*-commutative44.7%
sqrt-prod44.7%
fma-undefine44.7%
+-commutative44.7%
hypot-1-def44.7%
+-commutative44.7%
Applied egg-rr50.8%
associate-/l/50.8%
associate-*r/50.9%
*-rgt-identity50.9%
*-commutative50.9%
associate-/r*50.8%
*-commutative50.8%
Simplified50.8%
Final simplification50.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)) (* (hypot 1.0 z) 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 / hypot(1.0, z)) / (hypot(1.0, z) * x_m)) / 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)) / (Math.hypot(1.0, z) * 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 / math.hypot(1.0, z)) / (math.hypot(1.0, z) * 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(Float64(1.0 / hypot(1.0, z)) / Float64(hypot(1.0, z) * 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 / hypot(1.0, z)) / (hypot(1.0, z) * 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[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision] / y), $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{1}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right) \cdot x\_m}}{y}
\end{array}
Initial program 87.3%
associate-/l/87.2%
associate-*l*90.8%
*-commutative90.8%
sqr-neg90.8%
+-commutative90.8%
sqr-neg90.8%
fma-define90.8%
Simplified90.8%
associate-*r*88.5%
*-commutative88.5%
associate-/r*88.5%
*-commutative88.5%
associate-/l/88.5%
fma-undefine88.5%
+-commutative88.5%
associate-/r*87.3%
*-un-lft-identity87.3%
add-sqr-sqrt44.7%
times-frac44.7%
+-commutative44.7%
fma-undefine44.7%
*-commutative44.7%
sqrt-prod44.7%
fma-undefine44.7%
+-commutative44.7%
hypot-1-def44.7%
+-commutative44.7%
Applied egg-rr50.8%
*-commutative50.8%
associate-/r*50.1%
associate-/r*50.1%
frac-times48.0%
add-sqr-sqrt95.8%
Applied egg-rr95.8%
associate-/l/95.7%
associate-*l/95.8%
*-un-lft-identity95.8%
*-commutative95.8%
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) 20000.0)
(/ (/ 1.0 x_m) (* y (+ 1.0 (* z z))))
(if (<= (* z z) 2e+273)
(/ (/ 1.0 (* x_m (pow z 2.0))) y)
(* (/ (/ 1.0 z) y) (/ (/ 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) <= 20000.0) {
tmp = (1.0 / x_m) / (y * (1.0 + (z * z)));
} else if ((z * z) <= 2e+273) {
tmp = (1.0 / (x_m * pow(z, 2.0))) / y;
} else {
tmp = ((1.0 / z) / y) * ((1.0 / z) / 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 * z) <= 20000.0d0) then
tmp = (1.0d0 / x_m) / (y * (1.0d0 + (z * z)))
else if ((z * z) <= 2d+273) then
tmp = (1.0d0 / (x_m * (z ** 2.0d0))) / y
else
tmp = ((1.0d0 / z) / y) * ((1.0d0 / z) / 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 * z) <= 20000.0) {
tmp = (1.0 / x_m) / (y * (1.0 + (z * z)));
} else if ((z * z) <= 2e+273) {
tmp = (1.0 / (x_m * Math.pow(z, 2.0))) / y;
} else {
tmp = ((1.0 / z) / y) * ((1.0 / z) / 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 * z) <= 20000.0: tmp = (1.0 / x_m) / (y * (1.0 + (z * z))) elif (z * z) <= 2e+273: tmp = (1.0 / (x_m * math.pow(z, 2.0))) / y else: tmp = ((1.0 / z) / y) * ((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) <= 20000.0) tmp = Float64(Float64(1.0 / x_m) / Float64(y * Float64(1.0 + Float64(z * z)))); elseif (Float64(z * z) <= 2e+273) tmp = Float64(Float64(1.0 / Float64(x_m * (z ^ 2.0))) / y); else tmp = Float64(Float64(Float64(1.0 / z) / y) * Float64(Float64(1.0 / z) / 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 * z) <= 20000.0)
tmp = (1.0 / x_m) / (y * (1.0 + (z * z)));
elseif ((z * z) <= 2e+273)
tmp = (1.0 / (x_m * (z ^ 2.0))) / y;
else
tmp = ((1.0 / z) / y) * ((1.0 / z) / 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[N[(z * z), $MachinePrecision], 20000.0], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+273], N[(N[(1.0 / N[(x$95$m * N[Power[z, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / 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 \cdot z \leq 20000:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y \cdot \left(1 + z \cdot z\right)}\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+273}:\\
\;\;\;\;\frac{\frac{1}{x\_m \cdot {z}^{2}}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y} \cdot \frac{\frac{1}{z}}{x\_m}\\
\end{array}
\end{array}
if (*.f64 z z) < 2e4Initial program 99.8%
if 2e4 < (*.f64 z z) < 1.99999999999999989e273Initial program 80.2%
associate-/l/80.2%
associate-*l*95.8%
*-commutative95.8%
sqr-neg95.8%
+-commutative95.8%
sqr-neg95.8%
fma-define95.8%
Simplified95.8%
associate-*r*87.1%
*-commutative87.1%
associate-/r*87.0%
*-commutative87.0%
associate-/l/87.0%
fma-undefine87.0%
+-commutative87.0%
associate-/r*80.2%
*-un-lft-identity80.2%
add-sqr-sqrt47.3%
times-frac47.4%
+-commutative47.4%
fma-undefine47.4%
*-commutative47.4%
sqrt-prod47.5%
fma-undefine47.5%
+-commutative47.5%
hypot-1-def47.5%
+-commutative47.5%
Applied egg-rr52.5%
*-commutative52.5%
associate-/r*50.7%
associate-/r*50.6%
frac-times50.7%
add-sqr-sqrt96.6%
Applied egg-rr96.6%
Taylor expanded in z around inf 95.7%
if 1.99999999999999989e273 < (*.f64 z z) Initial program 68.9%
associate-/l/68.9%
associate-*l*70.2%
*-commutative70.2%
sqr-neg70.2%
+-commutative70.2%
sqr-neg70.2%
fma-define70.2%
Simplified70.2%
associate-*r*68.5%
*-commutative68.5%
associate-/r*68.4%
*-commutative68.4%
associate-/l/68.3%
fma-undefine68.3%
+-commutative68.3%
associate-/r*68.9%
*-un-lft-identity68.9%
add-sqr-sqrt26.9%
times-frac26.9%
+-commutative26.9%
fma-undefine26.9%
*-commutative26.9%
sqrt-prod26.9%
fma-undefine26.9%
+-commutative26.9%
hypot-1-def26.9%
+-commutative26.9%
Applied egg-rr45.5%
Taylor expanded in z around inf 68.9%
associate-*r*68.5%
*-commutative68.5%
Simplified68.5%
associate-/r*68.5%
add-sqr-sqrt68.4%
*-commutative68.4%
times-frac70.2%
sqrt-div70.2%
metadata-eval70.2%
sqrt-pow167.5%
metadata-eval67.5%
pow167.5%
sqrt-div67.5%
metadata-eval67.5%
sqrt-pow198.5%
metadata-eval98.5%
pow198.5%
Applied egg-rr98.5%
Final simplification98.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) 20000.0)
(/ (/ 1.0 x_m) (* y (+ 1.0 (* z z))))
(if (<= (* z z) 2e+273)
(/ (/ (pow z -2.0) x_m) y)
(* (/ (/ 1.0 z) y) (/ (/ 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) <= 20000.0) {
tmp = (1.0 / x_m) / (y * (1.0 + (z * z)));
} else if ((z * z) <= 2e+273) {
tmp = (pow(z, -2.0) / x_m) / y;
} else {
tmp = ((1.0 / z) / y) * ((1.0 / z) / 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 * z) <= 20000.0d0) then
tmp = (1.0d0 / x_m) / (y * (1.0d0 + (z * z)))
else if ((z * z) <= 2d+273) then
tmp = ((z ** (-2.0d0)) / x_m) / y
else
tmp = ((1.0d0 / z) / y) * ((1.0d0 / z) / 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 * z) <= 20000.0) {
tmp = (1.0 / x_m) / (y * (1.0 + (z * z)));
} else if ((z * z) <= 2e+273) {
tmp = (Math.pow(z, -2.0) / x_m) / y;
} else {
tmp = ((1.0 / z) / y) * ((1.0 / z) / 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 * z) <= 20000.0: tmp = (1.0 / x_m) / (y * (1.0 + (z * z))) elif (z * z) <= 2e+273: tmp = (math.pow(z, -2.0) / x_m) / y else: tmp = ((1.0 / z) / y) * ((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) <= 20000.0) tmp = Float64(Float64(1.0 / x_m) / Float64(y * Float64(1.0 + Float64(z * z)))); elseif (Float64(z * z) <= 2e+273) tmp = Float64(Float64((z ^ -2.0) / x_m) / y); else tmp = Float64(Float64(Float64(1.0 / z) / y) * Float64(Float64(1.0 / z) / 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 * z) <= 20000.0)
tmp = (1.0 / x_m) / (y * (1.0 + (z * z)));
elseif ((z * z) <= 2e+273)
tmp = ((z ^ -2.0) / x_m) / y;
else
tmp = ((1.0 / z) / y) * ((1.0 / z) / 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[N[(z * z), $MachinePrecision], 20000.0], N[(N[(1.0 / x$95$m), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+273], N[(N[(N[Power[z, -2.0], $MachinePrecision] / x$95$m), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / 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 \cdot z \leq 20000:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{y \cdot \left(1 + z \cdot z\right)}\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+273}:\\
\;\;\;\;\frac{\frac{{z}^{-2}}{x\_m}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y} \cdot \frac{\frac{1}{z}}{x\_m}\\
\end{array}
\end{array}
if (*.f64 z z) < 2e4Initial program 99.8%
if 2e4 < (*.f64 z z) < 1.99999999999999989e273Initial program 80.2%
associate-/l/80.2%
associate-*l*95.8%
*-commutative95.8%
sqr-neg95.8%
+-commutative95.8%
sqr-neg95.8%
fma-define95.8%
Simplified95.8%
associate-*r*87.1%
*-commutative87.1%
associate-/r*87.0%
*-commutative87.0%
associate-/l/87.0%
fma-undefine87.0%
+-commutative87.0%
associate-/r*80.2%
*-un-lft-identity80.2%
add-sqr-sqrt47.3%
times-frac47.4%
+-commutative47.4%
fma-undefine47.4%
*-commutative47.4%
sqrt-prod47.5%
fma-undefine47.5%
+-commutative47.5%
hypot-1-def47.5%
+-commutative47.5%
Applied egg-rr52.5%
*-commutative52.5%
associate-/r*50.7%
associate-/r*50.6%
frac-times50.7%
add-sqr-sqrt96.6%
Applied egg-rr96.6%
associate-/l/96.5%
associate-*l/96.7%
*-un-lft-identity96.7%
*-commutative96.7%
Applied egg-rr96.7%
Taylor expanded in z around inf 80.0%
associate-*r*86.7%
associate-/r*86.6%
*-rgt-identity86.6%
associate-/l*86.8%
unpow-186.8%
exp-to-pow40.6%
*-commutative40.6%
exp-prod40.6%
*-commutative40.6%
associate-*r*40.6%
metadata-eval40.6%
*-commutative40.6%
exp-to-pow86.8%
associate-*l/86.9%
*-lft-identity86.9%
associate-/r*96.3%
Simplified96.3%
if 1.99999999999999989e273 < (*.f64 z z) Initial program 68.9%
associate-/l/68.9%
associate-*l*70.2%
*-commutative70.2%
sqr-neg70.2%
+-commutative70.2%
sqr-neg70.2%
fma-define70.2%
Simplified70.2%
associate-*r*68.5%
*-commutative68.5%
associate-/r*68.4%
*-commutative68.4%
associate-/l/68.3%
fma-undefine68.3%
+-commutative68.3%
associate-/r*68.9%
*-un-lft-identity68.9%
add-sqr-sqrt26.9%
times-frac26.9%
+-commutative26.9%
fma-undefine26.9%
*-commutative26.9%
sqrt-prod26.9%
fma-undefine26.9%
+-commutative26.9%
hypot-1-def26.9%
+-commutative26.9%
Applied egg-rr45.5%
Taylor expanded in z around inf 68.9%
associate-*r*68.5%
*-commutative68.5%
Simplified68.5%
associate-/r*68.5%
add-sqr-sqrt68.4%
*-commutative68.4%
times-frac70.2%
sqrt-div70.2%
metadata-eval70.2%
sqrt-pow167.5%
metadata-eval67.5%
pow167.5%
sqrt-div67.5%
metadata-eval67.5%
sqrt-pow198.5%
metadata-eval98.5%
pow198.5%
Applied egg-rr98.5%
Final simplification98.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
(if (<= (* z z) 1e+253)
(/ (/ 1.0 y) (* x_m (fma z z 1.0)))
(* (/ (/ 1.0 y) z) (/ (/ 1.0 (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+253) {
tmp = (1.0 / y) / (x_m * fma(z, z, 1.0));
} else {
tmp = ((1.0 / y) / z) * ((1.0 / 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+253) tmp = Float64(Float64(1.0 / y) / Float64(x_m * fma(z, z, 1.0))); else tmp = Float64(Float64(Float64(1.0 / y) / z) * Float64(Float64(1.0 / 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+253], N[(N[(1.0 / y), $MachinePrecision] / N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / y), $MachinePrecision] / z), $MachinePrecision] * N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / 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 \cdot z \leq 10^{+253}:\\
\;\;\;\;\frac{\frac{1}{y}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{z} \cdot \frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{x\_m}\\
\end{array}
\end{array}
if (*.f64 z z) < 9.9999999999999994e252Initial program 94.6%
associate-/l/94.5%
associate-*l*98.6%
*-commutative98.6%
sqr-neg98.6%
+-commutative98.6%
sqr-neg98.6%
fma-define98.6%
Simplified98.6%
associate-*r*97.1%
*-commutative97.1%
associate-/r*97.0%
*-commutative97.0%
associate-/l/97.1%
fma-undefine97.1%
+-commutative97.1%
associate-/r*94.6%
*-un-lft-identity94.6%
add-sqr-sqrt52.8%
times-frac52.8%
+-commutative52.8%
fma-undefine52.8%
*-commutative52.8%
sqrt-prod52.8%
fma-undefine52.8%
+-commutative52.8%
hypot-1-def52.8%
+-commutative52.8%
Applied egg-rr54.3%
*-commutative54.3%
div-inv54.2%
associate-*l*53.7%
associate-/r*53.7%
associate-/r*53.7%
frac-times53.7%
Applied egg-rr98.6%
if 9.9999999999999994e252 < (*.f64 z z) Initial program 69.7%
associate-/l/69.6%
associate-*l*72.1%
*-commutative72.1%
sqr-neg72.1%
+-commutative72.1%
sqr-neg72.1%
fma-define72.1%
Simplified72.1%
clear-num72.1%
associate-*r*67.9%
*-commutative67.9%
*-commutative67.9%
associate-/r/67.9%
associate-/r*68.0%
Applied egg-rr68.0%
add-sqr-sqrt67.9%
*-commutative67.9%
times-frac72.1%
clear-num72.1%
sqrt-div72.1%
metadata-eval72.1%
/-rgt-identity72.1%
fma-undefine72.1%
+-commutative72.1%
hypot-1-def72.1%
clear-num72.1%
sqrt-div72.1%
metadata-eval72.1%
/-rgt-identity72.1%
fma-undefine72.1%
+-commutative72.1%
hypot-1-def98.5%
Applied egg-rr98.5%
Taylor expanded in z around inf 82.0%
associate-/r*82.0%
Simplified82.0%
Final simplification93.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
(if (<= (* z z) 2e+273)
(/ 1.0 (* y (* x_m (fma z z 1.0))))
(* (/ (/ 1.0 z) y) (/ (/ 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) <= 2e+273) {
tmp = 1.0 / (y * (x_m * fma(z, z, 1.0)));
} else {
tmp = ((1.0 / z) / y) * ((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) <= 2e+273) tmp = Float64(1.0 / Float64(y * Float64(x_m * fma(z, z, 1.0)))); else tmp = Float64(Float64(Float64(1.0 / z) / y) * Float64(Float64(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], 2e+273], N[(1.0 / N[(y * N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / 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 \cdot z \leq 2 \cdot 10^{+273}:\\
\;\;\;\;\frac{1}{y \cdot \left(x\_m \cdot \mathsf{fma}\left(z, z, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y} \cdot \frac{\frac{1}{z}}{x\_m}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.99999999999999989e273Initial program 94.2%
associate-/l/94.1%
associate-*l*98.6%
*-commutative98.6%
sqr-neg98.6%
+-commutative98.6%
sqr-neg98.6%
fma-define98.6%
Simplified98.6%
if 1.99999999999999989e273 < (*.f64 z z) Initial program 68.9%
associate-/l/68.9%
associate-*l*70.2%
*-commutative70.2%
sqr-neg70.2%
+-commutative70.2%
sqr-neg70.2%
fma-define70.2%
Simplified70.2%
associate-*r*68.5%
*-commutative68.5%
associate-/r*68.4%
*-commutative68.4%
associate-/l/68.3%
fma-undefine68.3%
+-commutative68.3%
associate-/r*68.9%
*-un-lft-identity68.9%
add-sqr-sqrt26.9%
times-frac26.9%
+-commutative26.9%
fma-undefine26.9%
*-commutative26.9%
sqrt-prod26.9%
fma-undefine26.9%
+-commutative26.9%
hypot-1-def26.9%
+-commutative26.9%
Applied egg-rr45.5%
Taylor expanded in z around inf 68.9%
associate-*r*68.5%
*-commutative68.5%
Simplified68.5%
associate-/r*68.5%
add-sqr-sqrt68.4%
*-commutative68.4%
times-frac70.2%
sqrt-div70.2%
metadata-eval70.2%
sqrt-pow167.5%
metadata-eval67.5%
pow167.5%
sqrt-div67.5%
metadata-eval67.5%
sqrt-pow198.5%
metadata-eval98.5%
pow198.5%
Applied egg-rr98.5%
Final simplification98.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
(if (<= (* z z) 2e+273)
(/ (/ 1.0 y) (* x_m (fma z z 1.0)))
(* (/ (/ 1.0 z) y) (/ (/ 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) <= 2e+273) {
tmp = (1.0 / y) / (x_m * fma(z, z, 1.0));
} else {
tmp = ((1.0 / z) / y) * ((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) <= 2e+273) tmp = Float64(Float64(1.0 / y) / Float64(x_m * fma(z, z, 1.0))); else tmp = Float64(Float64(Float64(1.0 / z) / y) * Float64(Float64(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], 2e+273], N[(N[(1.0 / y), $MachinePrecision] / N[(x$95$m * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / 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 \cdot z \leq 2 \cdot 10^{+273}:\\
\;\;\;\;\frac{\frac{1}{y}}{x\_m \cdot \mathsf{fma}\left(z, z, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y} \cdot \frac{\frac{1}{z}}{x\_m}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.99999999999999989e273Initial program 94.2%
associate-/l/94.1%
associate-*l*98.6%
*-commutative98.6%
sqr-neg98.6%
+-commutative98.6%
sqr-neg98.6%
fma-define98.6%
Simplified98.6%
associate-*r*96.1%
*-commutative96.1%
associate-/r*96.1%
*-commutative96.1%
associate-/l/96.1%
fma-undefine96.1%
+-commutative96.1%
associate-/r*94.2%
*-un-lft-identity94.2%
add-sqr-sqrt51.4%
times-frac51.4%
+-commutative51.4%
fma-undefine51.4%
*-commutative51.4%
sqrt-prod51.4%
fma-undefine51.4%
+-commutative51.4%
hypot-1-def51.4%
+-commutative51.4%
Applied egg-rr52.8%
*-commutative52.8%
div-inv52.8%
associate-*l*52.3%
associate-/r*52.3%
associate-/r*52.3%
frac-times52.3%
Applied egg-rr98.6%
if 1.99999999999999989e273 < (*.f64 z z) Initial program 68.9%
associate-/l/68.9%
associate-*l*70.2%
*-commutative70.2%
sqr-neg70.2%
+-commutative70.2%
sqr-neg70.2%
fma-define70.2%
Simplified70.2%
associate-*r*68.5%
*-commutative68.5%
associate-/r*68.4%
*-commutative68.4%
associate-/l/68.3%
fma-undefine68.3%
+-commutative68.3%
associate-/r*68.9%
*-un-lft-identity68.9%
add-sqr-sqrt26.9%
times-frac26.9%
+-commutative26.9%
fma-undefine26.9%
*-commutative26.9%
sqrt-prod26.9%
fma-undefine26.9%
+-commutative26.9%
hypot-1-def26.9%
+-commutative26.9%
Applied egg-rr45.5%
Taylor expanded in z around inf 68.9%
associate-*r*68.5%
*-commutative68.5%
Simplified68.5%
associate-/r*68.5%
add-sqr-sqrt68.4%
*-commutative68.4%
times-frac70.2%
sqrt-div70.2%
metadata-eval70.2%
sqrt-pow167.5%
metadata-eval67.5%
pow167.5%
sqrt-div67.5%
metadata-eval67.5%
sqrt-pow198.5%
metadata-eval98.5%
pow198.5%
Applied egg-rr98.5%
Final simplification98.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 4e+297)
(/ (/ 1.0 x_m) t_0)
(* (/ (/ 1.0 z) y) (/ (/ 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 t_0 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= 4e+297) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = ((1.0 / z) / y) * ((1.0 / z) / 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 <= 4d+297) then
tmp = (1.0d0 / x_m) / t_0
else
tmp = ((1.0d0 / z) / y) * ((1.0d0 / z) / 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 <= 4e+297) {
tmp = (1.0 / x_m) / t_0;
} else {
tmp = ((1.0 / z) / y) * ((1.0 / z) / 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 <= 4e+297: tmp = (1.0 / x_m) / t_0 else: tmp = ((1.0 / z) / y) * ((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) t_0 = Float64(y * Float64(1.0 + Float64(z * z))) tmp = 0.0 if (t_0 <= 4e+297) tmp = Float64(Float64(1.0 / x_m) / t_0); else tmp = Float64(Float64(Float64(1.0 / z) / y) * Float64(Float64(1.0 / z) / 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 <= 4e+297)
tmp = (1.0 / x_m) / t_0;
else
tmp = ((1.0 / z) / y) * ((1.0 / z) / 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, 4e+297], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / 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 4 \cdot 10^{+297}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y} \cdot \frac{\frac{1}{z}}{x\_m}\\
\end{array}
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 4.0000000000000001e297Initial program 92.3%
if 4.0000000000000001e297 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 59.2%
associate-/l/59.2%
associate-*l*68.5%
*-commutative68.5%
sqr-neg68.5%
+-commutative68.5%
sqr-neg68.5%
fma-define68.5%
Simplified68.5%
associate-*r*68.2%
*-commutative68.2%
associate-/r*68.1%
*-commutative68.1%
associate-/l/68.0%
fma-undefine68.0%
+-commutative68.0%
associate-/r*59.2%
*-un-lft-identity59.2%
add-sqr-sqrt59.2%
times-frac59.2%
+-commutative59.2%
fma-undefine59.2%
*-commutative59.2%
sqrt-prod59.2%
fma-undefine59.2%
+-commutative59.2%
hypot-1-def59.2%
+-commutative59.2%
Applied egg-rr99.4%
Taylor expanded in z around inf 59.2%
associate-*r*67.9%
*-commutative67.9%
Simplified67.9%
associate-/r*67.9%
add-sqr-sqrt67.8%
*-commutative67.8%
times-frac66.2%
sqrt-div66.3%
metadata-eval66.3%
sqrt-pow163.4%
metadata-eval63.4%
pow163.4%
sqrt-div63.3%
metadata-eval63.3%
sqrt-pow195.1%
metadata-eval95.1%
pow195.1%
Applied egg-rr95.1%
Final simplification92.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 (if (<= z 1.25e-5) (/ (/ 1.0 y) x_m) (* (/ 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 <= 1.25e-5) {
tmp = (1.0 / y) / x_m;
} 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 <= 1.25d-5) then
tmp = (1.0d0 / y) / x_m
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 <= 1.25e-5) {
tmp = (1.0 / y) / x_m;
} 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 <= 1.25e-5: tmp = (1.0 / y) / x_m 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 <= 1.25e-5) tmp = Float64(Float64(1.0 / y) / x_m); else tmp = Float64(Float64(1.0 / z) * Float64(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 <= 1.25e-5)
tmp = (1.0 / y) / x_m;
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, 1.25e-5], N[(N[(1.0 / y), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / z), $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])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1.25 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{y}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{\frac{1}{z}}{y \cdot x\_m}\\
\end{array}
\end{array}
if z < 1.25000000000000006e-5Initial program 92.1%
associate-/l/92.0%
associate-*l*94.4%
*-commutative94.4%
sqr-neg94.4%
+-commutative94.4%
sqr-neg94.4%
fma-define94.4%
Simplified94.4%
associate-*r*92.5%
*-commutative92.5%
associate-/r*92.4%
*-commutative92.4%
associate-/l/92.5%
fma-undefine92.5%
+-commutative92.5%
associate-/r*92.1%
*-un-lft-identity92.1%
add-sqr-sqrt48.4%
times-frac48.4%
+-commutative48.4%
fma-undefine48.4%
*-commutative48.4%
sqrt-prod48.4%
fma-undefine48.4%
+-commutative48.4%
hypot-1-def48.4%
+-commutative48.4%
Applied egg-rr51.7%
*-commutative51.7%
div-inv51.7%
associate-*l*49.8%
associate-/r*49.8%
associate-/r*49.8%
frac-times48.6%
Applied egg-rr92.3%
Taylor expanded in z around 0 75.0%
if 1.25000000000000006e-5 < z Initial program 71.6%
associate-/l/71.6%
associate-*l*79.2%
*-commutative79.2%
sqr-neg79.2%
+-commutative79.2%
sqr-neg79.2%
fma-define79.2%
Simplified79.2%
associate-*r*75.7%
*-commutative75.7%
associate-/r*75.6%
*-commutative75.6%
associate-/l/75.6%
fma-undefine75.6%
+-commutative75.6%
associate-/r*71.6%
*-un-lft-identity71.6%
add-sqr-sqrt32.6%
times-frac32.7%
+-commutative32.7%
fma-undefine32.7%
*-commutative32.7%
sqrt-prod32.8%
fma-undefine32.8%
+-commutative32.8%
hypot-1-def32.8%
+-commutative32.8%
Applied egg-rr47.9%
Taylor expanded in z around inf 70.5%
associate-*r*74.4%
*-commutative74.4%
Simplified74.4%
associate-/r*74.5%
add-sqr-sqrt74.4%
associate-/l*74.3%
sqrt-div74.3%
metadata-eval74.3%
sqrt-pow174.3%
metadata-eval74.3%
pow174.3%
sqrt-div74.2%
metadata-eval74.2%
sqrt-pow183.3%
metadata-eval83.3%
pow183.3%
Applied egg-rr83.3%
Final simplification77.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 1.25e-5) (/ (/ 1.0 y) x_m) (* (/ (/ 1.0 z) y) (/ (/ 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 <= 1.25e-5) {
tmp = (1.0 / y) / x_m;
} else {
tmp = ((1.0 / z) / y) * ((1.0 / z) / 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 <= 1.25d-5) then
tmp = (1.0d0 / y) / x_m
else
tmp = ((1.0d0 / z) / y) * ((1.0d0 / z) / 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 <= 1.25e-5) {
tmp = (1.0 / y) / x_m;
} else {
tmp = ((1.0 / z) / y) * ((1.0 / z) / 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 <= 1.25e-5: tmp = (1.0 / y) / x_m else: tmp = ((1.0 / z) / y) * ((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 (z <= 1.25e-5) tmp = Float64(Float64(1.0 / y) / x_m); else tmp = Float64(Float64(Float64(1.0 / z) / y) * Float64(Float64(1.0 / z) / 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 <= 1.25e-5)
tmp = (1.0 / y) / x_m;
else
tmp = ((1.0 / z) / y) * ((1.0 / z) / 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, 1.25e-5], N[(N[(1.0 / y), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / y), $MachinePrecision] * N[(N[(1.0 / z), $MachinePrecision] / 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 1.25 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{y}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y} \cdot \frac{\frac{1}{z}}{x\_m}\\
\end{array}
\end{array}
if z < 1.25000000000000006e-5Initial program 92.1%
associate-/l/92.0%
associate-*l*94.4%
*-commutative94.4%
sqr-neg94.4%
+-commutative94.4%
sqr-neg94.4%
fma-define94.4%
Simplified94.4%
associate-*r*92.5%
*-commutative92.5%
associate-/r*92.4%
*-commutative92.4%
associate-/l/92.5%
fma-undefine92.5%
+-commutative92.5%
associate-/r*92.1%
*-un-lft-identity92.1%
add-sqr-sqrt48.4%
times-frac48.4%
+-commutative48.4%
fma-undefine48.4%
*-commutative48.4%
sqrt-prod48.4%
fma-undefine48.4%
+-commutative48.4%
hypot-1-def48.4%
+-commutative48.4%
Applied egg-rr51.7%
*-commutative51.7%
div-inv51.7%
associate-*l*49.8%
associate-/r*49.8%
associate-/r*49.8%
frac-times48.6%
Applied egg-rr92.3%
Taylor expanded in z around 0 75.0%
if 1.25000000000000006e-5 < z Initial program 71.6%
associate-/l/71.6%
associate-*l*79.2%
*-commutative79.2%
sqr-neg79.2%
+-commutative79.2%
sqr-neg79.2%
fma-define79.2%
Simplified79.2%
associate-*r*75.7%
*-commutative75.7%
associate-/r*75.6%
*-commutative75.6%
associate-/l/75.6%
fma-undefine75.6%
+-commutative75.6%
associate-/r*71.6%
*-un-lft-identity71.6%
add-sqr-sqrt32.6%
times-frac32.7%
+-commutative32.7%
fma-undefine32.7%
*-commutative32.7%
sqrt-prod32.8%
fma-undefine32.8%
+-commutative32.8%
hypot-1-def32.8%
+-commutative32.8%
Applied egg-rr47.9%
Taylor expanded in z around inf 70.5%
associate-*r*74.4%
*-commutative74.4%
Simplified74.4%
associate-/r*74.5%
add-sqr-sqrt74.4%
*-commutative74.4%
times-frac76.3%
sqrt-div76.3%
metadata-eval76.3%
sqrt-pow176.3%
metadata-eval76.3%
pow176.3%
sqrt-div76.3%
metadata-eval76.3%
sqrt-pow195.2%
metadata-eval95.2%
pow195.2%
Applied egg-rr95.2%
Final simplification79.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 1.25e-5) (/ (/ 1.0 y) x_m) (/ (/ (/ (/ 1.0 y) z) 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 <= 1.25e-5) {
tmp = (1.0 / y) / x_m;
} else {
tmp = (((1.0 / y) / z) / z) / 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 <= 1.25d-5) then
tmp = (1.0d0 / y) / x_m
else
tmp = (((1.0d0 / y) / z) / z) / 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 <= 1.25e-5) {
tmp = (1.0 / y) / x_m;
} else {
tmp = (((1.0 / y) / z) / z) / 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 <= 1.25e-5: tmp = (1.0 / y) / x_m else: tmp = (((1.0 / y) / z) / 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 (z <= 1.25e-5) tmp = Float64(Float64(1.0 / y) / x_m); else tmp = Float64(Float64(Float64(Float64(1.0 / y) / z) / z) / 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 <= 1.25e-5)
tmp = (1.0 / y) / x_m;
else
tmp = (((1.0 / y) / z) / z) / 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, 1.25e-5], N[(N[(1.0 / y), $MachinePrecision] / x$95$m), $MachinePrecision], N[(N[(N[(N[(1.0 / y), $MachinePrecision] / z), $MachinePrecision] / z), $MachinePrecision] / x$95$m), $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 1.25 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{y}}{x\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\frac{1}{y}}{z}}{z}}{x\_m}\\
\end{array}
\end{array}
if z < 1.25000000000000006e-5Initial program 92.1%
associate-/l/92.0%
associate-*l*94.4%
*-commutative94.4%
sqr-neg94.4%
+-commutative94.4%
sqr-neg94.4%
fma-define94.4%
Simplified94.4%
associate-*r*92.5%
*-commutative92.5%
associate-/r*92.4%
*-commutative92.4%
associate-/l/92.5%
fma-undefine92.5%
+-commutative92.5%
associate-/r*92.1%
*-un-lft-identity92.1%
add-sqr-sqrt48.4%
times-frac48.4%
+-commutative48.4%
fma-undefine48.4%
*-commutative48.4%
sqrt-prod48.4%
fma-undefine48.4%
+-commutative48.4%
hypot-1-def48.4%
+-commutative48.4%
Applied egg-rr51.7%
*-commutative51.7%
div-inv51.7%
associate-*l*49.8%
associate-/r*49.8%
associate-/r*49.8%
frac-times48.6%
Applied egg-rr92.3%
Taylor expanded in z around 0 75.0%
if 1.25000000000000006e-5 < z Initial program 71.6%
associate-/l/71.6%
associate-*l*79.2%
*-commutative79.2%
sqr-neg79.2%
+-commutative79.2%
sqr-neg79.2%
fma-define79.2%
Simplified79.2%
associate-*r*75.7%
*-commutative75.7%
associate-/r*75.6%
*-commutative75.6%
associate-/l/75.6%
fma-undefine75.6%
+-commutative75.6%
associate-/r*71.6%
*-un-lft-identity71.6%
add-sqr-sqrt32.6%
times-frac32.7%
+-commutative32.7%
fma-undefine32.7%
*-commutative32.7%
sqrt-prod32.8%
fma-undefine32.8%
+-commutative32.8%
hypot-1-def32.8%
+-commutative32.8%
Applied egg-rr47.9%
*-commutative47.9%
div-inv47.9%
associate-*l*47.6%
associate-/r*47.6%
associate-/r*47.5%
frac-times35.5%
Applied egg-rr74.6%
Taylor expanded in z around inf 73.3%
associate-*l/73.2%
*-un-lft-identity73.2%
unpow273.2%
associate-/r*90.1%
Applied egg-rr90.1%
Final simplification78.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 87.3%
associate-/l/87.2%
associate-*l*90.8%
*-commutative90.8%
sqr-neg90.8%
+-commutative90.8%
sqr-neg90.8%
fma-define90.8%
Simplified90.8%
Taylor expanded in z around 0 60.4%
Final simplification60.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* z z))) (t_1 (* y t_0)) (t_2 (/ (/ 1.0 y) (* t_0 x))))
(if (< t_1 (- INFINITY))
t_2
(if (< t_1 8.680743250567252e+305) (/ (/ 1.0 x) (* t_0 y)) t_2))))
double code(double x, double y, double z) {
double t_0 = 1.0 + (z * z);
double t_1 = y * t_0;
double t_2 = (1.0 / y) / (t_0 * x);
double tmp;
if (t_1 < -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 < 8.680743250567252e+305) {
tmp = (1.0 / x) / (t_0 * y);
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = 1.0 + (z * z);
double t_1 = y * t_0;
double t_2 = (1.0 / y) / (t_0 * x);
double tmp;
if (t_1 < -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if (t_1 < 8.680743250567252e+305) {
tmp = (1.0 / x) / (t_0 * y);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + (z * z) t_1 = y * t_0 t_2 = (1.0 / y) / (t_0 * x) tmp = 0 if t_1 < -math.inf: tmp = t_2 elif t_1 < 8.680743250567252e+305: tmp = (1.0 / x) / (t_0 * y) else: tmp = t_2 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(z * z)) t_1 = Float64(y * t_0) t_2 = Float64(Float64(1.0 / y) / Float64(t_0 * x)) tmp = 0.0 if (t_1 < Float64(-Inf)) tmp = t_2; elseif (t_1 < 8.680743250567252e+305) tmp = Float64(Float64(1.0 / x) / Float64(t_0 * y)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + (z * z); t_1 = y * t_0; t_2 = (1.0 / y) / (t_0 * x); tmp = 0.0; if (t_1 < -Inf) tmp = t_2; elseif (t_1 < 8.680743250567252e+305) tmp = (1.0 / x) / (t_0 * y); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 / y), $MachinePrecision] / N[(t$95$0 * x), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$1, (-Infinity)], t$95$2, If[Less[t$95$1, 8.680743250567252e+305], N[(N[(1.0 / x), $MachinePrecision] / N[(t$95$0 * y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + z \cdot z\\
t_1 := y \cdot t\_0\\
t_2 := \frac{\frac{1}{y}}{t\_0 \cdot x}\\
\mathbf{if}\;t\_1 < -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 < 8.680743250567252 \cdot 10^{+305}:\\
\;\;\;\;\frac{\frac{1}{x}}{t\_0 \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024055
(FPCore (x y z)
:name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
:precision binary64
:alt
(if (< (* y (+ 1.0 (* z z))) (- INFINITY)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x)) (if (< (* y (+ 1.0 (* z z))) 8.680743250567252e+305) (/ (/ 1.0 x) (* (+ 1.0 (* z z)) y)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x))))
(/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))