
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 8.3e-302)
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
(*
(/ (sqrt d) (sqrt h))
(*
(/ (sqrt d) (sqrt l))
(- 1.0 (* 0.5 (* (pow (/ (/ (* M D) 2.0) d) 2.0) (/ h l))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 8.3e-302) {
tmp = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else {
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (pow((((M * D) / 2.0) / d), 2.0) * (h / l)))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 8.3d-302) then
tmp = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0d0 - (0.5d0 * (((((m * d_1) / 2.0d0) / d) ** 2.0d0) * (h / l)))))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 8.3e-302) {
tmp = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (0.5 * (Math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 8.3e-302: tmp = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l)) else: tmp = (math.sqrt(d) / math.sqrt(h)) * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (0.5 * (math.pow((((M * D) / 2.0) / d), 2.0) * (h / l))))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 8.3e-302) tmp = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0) * Float64(h / l)))))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 8.3e-302)
tmp = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (((((M * D) / 2.0) / d) ^ 2.0) * (h / l)))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 8.3e-302], N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 8.3 \cdot 10^{-302}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if l < 8.29999999999999954e-302Initial program 65.5%
associate-*r/67.2%
*-commutative67.2%
frac-times67.1%
div-inv67.1%
metadata-eval67.1%
metadata-eval67.1%
Applied egg-rr67.1%
if 8.29999999999999954e-302 < l Initial program 61.4%
associate-*l*61.4%
metadata-eval61.4%
unpow1/261.4%
metadata-eval61.4%
unpow1/261.4%
associate-*l*61.4%
metadata-eval61.4%
times-frac61.4%
Simplified61.4%
frac-times61.4%
associate-/r*61.4%
Applied egg-rr61.4%
sqrt-div70.1%
Applied egg-rr70.1%
sqrt-div86.1%
Applied egg-rr86.1%
Final simplification76.9%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -1.55e-302)
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
(if (<= d 1.32e-168)
(* -0.125 (* (* (* D D) (* M (/ M d))) (sqrt (/ h (pow l 3.0)))))
(if (<= d 1e+177)
(*
(sqrt (/ d h))
(*
(/ (sqrt d) (sqrt l))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M d) (/ D 2.0)) 2.0))))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1.55e-302) {
tmp = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (d <= 1.32e-168) {
tmp = -0.125 * (((D * D) * (M * (M / d))) * sqrt((h / pow(l, 3.0))));
} else if (d <= 1e+177) {
tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * ((h / l) * pow(((M / d) * (D / 2.0)), 2.0)))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-1.55d-302)) then
tmp = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
else if (d <= 1.32d-168) then
tmp = (-0.125d0) * (((d_1 * d_1) * (m * (m / d))) * sqrt((h / (l ** 3.0d0))))
else if (d <= 1d+177) then
tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0d0 - (0.5d0 * ((h / l) * (((m / d) * (d_1 / 2.0d0)) ** 2.0d0)))))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1.55e-302) {
tmp = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (d <= 1.32e-168) {
tmp = -0.125 * (((D * D) * (M * (M / d))) * Math.sqrt((h / Math.pow(l, 3.0))));
} else if (d <= 1e+177) {
tmp = Math.sqrt((d / h)) * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (0.5 * ((h / l) * Math.pow(((M / d) * (D / 2.0)), 2.0)))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -1.55e-302: tmp = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l)) elif d <= 1.32e-168: tmp = -0.125 * (((D * D) * (M * (M / d))) * math.sqrt((h / math.pow(l, 3.0)))) elif d <= 1e+177: tmp = math.sqrt((d / h)) * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (0.5 * ((h / l) * math.pow(((M / d) * (D / 2.0)), 2.0))))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -1.55e-302) tmp = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l))); elseif (d <= 1.32e-168) tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) * Float64(M * Float64(M / d))) * sqrt(Float64(h / (l ^ 3.0))))); elseif (d <= 1e+177) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0)))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -1.55e-302)
tmp = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
elseif (d <= 1.32e-168)
tmp = -0.125 * (((D * D) * (M * (M / d))) * sqrt((h / (l ^ 3.0))));
elseif (d <= 1e+177)
tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * ((h / l) * (((M / d) * (D / 2.0)) ^ 2.0)))));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -1.55e-302], N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.32e-168], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1e+177], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.55 \cdot 10^{-302}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq 1.32 \cdot 10^{-168}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(D \cdot D\right) \cdot \left(M \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\\
\mathbf{elif}\;d \leq 10^{+177}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.54999999999999992e-302Initial program 66.0%
associate-*r/67.8%
*-commutative67.8%
frac-times67.7%
div-inv67.7%
metadata-eval67.7%
metadata-eval67.7%
Applied egg-rr67.7%
if -1.54999999999999992e-302 < d < 1.3200000000000001e-168Initial program 37.3%
Taylor expanded in d around 0 54.9%
associate-*l/55.0%
unpow255.0%
unpow255.0%
Simplified55.0%
Taylor expanded in D around 0 54.9%
unpow254.9%
unpow254.9%
*-rgt-identity54.9%
associate-*r/54.9%
unpow254.9%
unpow254.9%
associate-*l*54.5%
unpow254.5%
unpow254.5%
associate-*l*60.1%
associate-*r/60.1%
*-rgt-identity60.1%
Simplified60.1%
if 1.3200000000000001e-168 < d < 1e177Initial program 71.8%
associate-*l*71.8%
metadata-eval71.8%
unpow1/271.8%
metadata-eval71.8%
unpow1/271.8%
associate-*l*71.8%
metadata-eval71.8%
times-frac71.7%
Simplified71.7%
frac-times71.8%
associate-/r*71.8%
Applied egg-rr71.8%
sqrt-div82.1%
Applied egg-rr82.1%
associate-*r/74.7%
associate-/l/74.7%
Applied egg-rr86.3%
associate-*r/82.1%
rem-log-exp70.5%
exp-prod68.9%
log-pow60.5%
rem-log-exp82.1%
times-frac82.1%
Simplified82.1%
if 1e177 < d Initial program 62.4%
Taylor expanded in d around inf 95.9%
*-commutative95.9%
*-commutative95.9%
associate-/r*95.7%
Simplified95.7%
sqrt-div99.4%
Applied egg-rr99.4%
Final simplification73.9%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -1.55e-302)
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
(if (<= d 2e-176)
(* -0.125 (* (* (* D D) (* M (/ M d))) (sqrt (/ h (pow l 3.0)))))
(if (<= d 2.3e+178)
(*
(sqrt (/ d h))
(*
(/ (sqrt d) (sqrt l))
(- 1.0 (* 0.5 (/ (* h (pow (/ (* M D) (* d 2.0)) 2.0)) l)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1.55e-302) {
tmp = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (d <= 2e-176) {
tmp = -0.125 * (((D * D) * (M * (M / d))) * sqrt((h / pow(l, 3.0))));
} else if (d <= 2.3e+178) {
tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * ((h * pow(((M * D) / (d * 2.0)), 2.0)) / l))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-1.55d-302)) then
tmp = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
else if (d <= 2d-176) then
tmp = (-0.125d0) * (((d_1 * d_1) * (m * (m / d))) * sqrt((h / (l ** 3.0d0))))
else if (d <= 2.3d+178) then
tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0d0 - (0.5d0 * ((h * (((m * d_1) / (d * 2.0d0)) ** 2.0d0)) / l))))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1.55e-302) {
tmp = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (d <= 2e-176) {
tmp = -0.125 * (((D * D) * (M * (M / d))) * Math.sqrt((h / Math.pow(l, 3.0))));
} else if (d <= 2.3e+178) {
tmp = Math.sqrt((d / h)) * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (0.5 * ((h * Math.pow(((M * D) / (d * 2.0)), 2.0)) / l))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -1.55e-302: tmp = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l)) elif d <= 2e-176: tmp = -0.125 * (((D * D) * (M * (M / d))) * math.sqrt((h / math.pow(l, 3.0)))) elif d <= 2.3e+178: tmp = math.sqrt((d / h)) * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (0.5 * ((h * math.pow(((M * D) / (d * 2.0)), 2.0)) / l)))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -1.55e-302) tmp = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l))); elseif (d <= 2e-176) tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) * Float64(M * Float64(M / d))) * sqrt(Float64(h / (l ^ 3.0))))); elseif (d <= 2.3e+178) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)) / l))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -1.55e-302)
tmp = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
elseif (d <= 2e-176)
tmp = -0.125 * (((D * D) * (M * (M / d))) * sqrt((h / (l ^ 3.0))));
elseif (d <= 2.3e+178)
tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * ((h * (((M * D) / (d * 2.0)) ^ 2.0)) / l))));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -1.55e-302], N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2e-176], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.3e+178], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.55 \cdot 10^{-302}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq 2 \cdot 10^{-176}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(D \cdot D\right) \cdot \left(M \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\\
\mathbf{elif}\;d \leq 2.3 \cdot 10^{+178}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.54999999999999992e-302Initial program 66.0%
associate-*r/67.8%
*-commutative67.8%
frac-times67.7%
div-inv67.7%
metadata-eval67.7%
metadata-eval67.7%
Applied egg-rr67.7%
if -1.54999999999999992e-302 < d < 2e-176Initial program 37.3%
Taylor expanded in d around 0 54.9%
associate-*l/55.0%
unpow255.0%
unpow255.0%
Simplified55.0%
Taylor expanded in D around 0 54.9%
unpow254.9%
unpow254.9%
*-rgt-identity54.9%
associate-*r/54.9%
unpow254.9%
unpow254.9%
associate-*l*54.5%
unpow254.5%
unpow254.5%
associate-*l*60.1%
associate-*r/60.1%
*-rgt-identity60.1%
Simplified60.1%
if 2e-176 < d < 2.3000000000000001e178Initial program 71.8%
associate-*l*71.8%
metadata-eval71.8%
unpow1/271.8%
metadata-eval71.8%
unpow1/271.8%
associate-*l*71.8%
metadata-eval71.8%
times-frac71.7%
Simplified71.7%
frac-times71.8%
associate-/r*71.8%
Applied egg-rr71.8%
associate-*r/74.7%
associate-/l/74.7%
Applied egg-rr74.7%
sqrt-div82.1%
Applied egg-rr86.3%
if 2.3000000000000001e178 < d Initial program 62.4%
Taylor expanded in d around inf 95.9%
*-commutative95.9%
*-commutative95.9%
associate-/r*95.7%
Simplified95.7%
sqrt-div99.4%
Applied egg-rr99.4%
Final simplification75.1%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (sqrt (/ d h)))
(t_2 (- 1.0 (* 0.5 (/ (* h (pow (/ (* M D) (* d 2.0)) 2.0)) l)))))
(if (<= d 2.1e-266)
(* (* t_0 t_2) t_1)
(if (<= d 1.65e-177)
(*
(/ (sqrt d) (sqrt h))
(* t_0 (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))))
(if (<= d 9.6e+178)
(* t_1 (* (/ (sqrt d) (sqrt l)) t_2))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double t_2 = 1.0 - (0.5 * ((h * pow(((M * D) / (d * 2.0)), 2.0)) / l));
double tmp;
if (d <= 2.1e-266) {
tmp = (t_0 * t_2) * t_1;
} else if (d <= 1.65e-177) {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.0)))));
} else if (d <= 9.6e+178) {
tmp = t_1 * ((sqrt(d) / sqrt(l)) * t_2);
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt((d / h))
t_2 = 1.0d0 - (0.5d0 * ((h * (((m * d_1) / (d * 2.0d0)) ** 2.0d0)) / l))
if (d <= 2.1d-266) then
tmp = (t_0 * t_2) * t_1
else if (d <= 1.65d-177) then
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0)))))
else if (d <= 9.6d+178) then
tmp = t_1 * ((sqrt(d) / sqrt(l)) * t_2)
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((d / h));
double t_2 = 1.0 - (0.5 * ((h * Math.pow(((M * D) / (d * 2.0)), 2.0)) / l));
double tmp;
if (d <= 2.1e-266) {
tmp = (t_0 * t_2) * t_1;
} else if (d <= 1.65e-177) {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0)))));
} else if (d <= 9.6e+178) {
tmp = t_1 * ((Math.sqrt(d) / Math.sqrt(l)) * t_2);
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = math.sqrt((d / h)) t_2 = 1.0 - (0.5 * ((h * math.pow(((M * D) / (d * 2.0)), 2.0)) / l)) tmp = 0 if d <= 2.1e-266: tmp = (t_0 * t_2) * t_1 elif d <= 1.65e-177: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0))))) elif d <= 9.6e+178: tmp = t_1 * ((math.sqrt(d) / math.sqrt(l)) * t_2) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) t_2 = Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)) / l))) tmp = 0.0 if (d <= 2.1e-266) tmp = Float64(Float64(t_0 * t_2) * t_1); elseif (d <= 1.65e-177) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)))))); elseif (d <= 9.6e+178) tmp = Float64(t_1 * Float64(Float64(sqrt(d) / sqrt(l)) * t_2)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
t_1 = sqrt((d / h));
t_2 = 1.0 - (0.5 * ((h * (((M * D) / (d * 2.0)) ^ 2.0)) / l));
tmp = 0.0;
if (d <= 2.1e-266)
tmp = (t_0 * t_2) * t_1;
elseif (d <= 1.65e-177)
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 2.0)))));
elseif (d <= 9.6e+178)
tmp = t_1 * ((sqrt(d) / sqrt(l)) * t_2);
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, 2.1e-266], N[(N[(t$95$0 * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, 1.65e-177], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.6e+178], N[(t$95$1 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := 1 - 0.5 \cdot \frac{h \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}{\ell}\\
\mathbf{if}\;d \leq 2.1 \cdot 10^{-266}:\\
\;\;\;\;\left(t_0 \cdot t_2\right) \cdot t_1\\
\mathbf{elif}\;d \leq 1.65 \cdot 10^{-177}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;d \leq 9.6 \cdot 10^{+178}:\\
\;\;\;\;t_1 \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_2\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < 2.09999999999999997e-266Initial program 63.9%
associate-*l*63.9%
metadata-eval63.9%
unpow1/263.9%
metadata-eval63.9%
unpow1/263.9%
associate-*l*63.9%
metadata-eval63.9%
times-frac63.1%
Simplified63.1%
frac-times63.9%
associate-/r*63.9%
Applied egg-rr63.9%
associate-*r/64.9%
associate-/l/64.9%
Applied egg-rr64.9%
if 2.09999999999999997e-266 < d < 1.65e-177Initial program 39.5%
associate-*l*39.5%
metadata-eval39.5%
unpow1/239.5%
metadata-eval39.5%
unpow1/239.5%
associate-*l*39.5%
metadata-eval39.5%
times-frac39.5%
Simplified39.5%
sqrt-div92.0%
Applied egg-rr87.3%
if 1.65e-177 < d < 9.599999999999999e178Initial program 70.9%
associate-*l*70.9%
metadata-eval70.9%
unpow1/270.9%
metadata-eval70.9%
unpow1/270.9%
associate-*l*70.9%
metadata-eval70.9%
times-frac70.7%
Simplified70.7%
frac-times70.9%
associate-/r*70.9%
Applied egg-rr70.9%
associate-*r/73.8%
associate-/l/73.8%
Applied egg-rr73.8%
sqrt-div81.1%
Applied egg-rr85.2%
if 9.599999999999999e178 < d Initial program 62.4%
Taylor expanded in d around inf 95.9%
*-commutative95.9%
*-commutative95.9%
associate-/r*95.7%
Simplified95.7%
sqrt-div99.4%
Applied egg-rr99.4%
Final simplification76.3%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -1e-310)
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
(if (<= l 1.4e+189)
(*
(/ (sqrt d) (sqrt h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (/ (* h (pow (/ (* M D) (* d 2.0)) 2.0)) l)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1e-310) {
tmp = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (l <= 1.4e+189) {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h * pow(((M * D) / (d * 2.0)), 2.0)) / l))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-1d-310)) then
tmp = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
else if (l <= 1.4d+189) then
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((h * (((m * d_1) / (d * 2.0d0)) ** 2.0d0)) / l))))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1e-310) {
tmp = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (l <= 1.4e+189) {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * ((h * Math.pow(((M * D) / (d * 2.0)), 2.0)) / l))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -1e-310: tmp = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l)) elif l <= 1.4e+189: tmp = (math.sqrt(d) / math.sqrt(h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * ((h * math.pow(((M * D) / (d * 2.0)), 2.0)) / l)))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -1e-310) tmp = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l))); elseif (l <= 1.4e+189) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)) / l))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -1e-310)
tmp = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
elseif (l <= 1.4e+189)
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h * (((M * D) / (d * 2.0)) ^ 2.0)) / l))));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1e-310], N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.4e+189], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 1.4 \cdot 10^{+189}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 65.5%
associate-*r/67.2%
*-commutative67.2%
frac-times67.1%
div-inv67.1%
metadata-eval67.1%
metadata-eval67.1%
Applied egg-rr67.1%
if -9.999999999999969e-311 < l < 1.40000000000000003e189Initial program 66.2%
associate-*l*66.2%
metadata-eval66.2%
unpow1/266.2%
metadata-eval66.2%
unpow1/266.2%
associate-*l*66.2%
metadata-eval66.2%
times-frac65.3%
Simplified65.3%
frac-times66.2%
associate-/r*66.2%
Applied egg-rr66.2%
associate-*r/69.3%
associate-/l/69.3%
Applied egg-rr69.3%
sqrt-div88.0%
Applied egg-rr86.6%
if 1.40000000000000003e189 < l Initial program 45.9%
Taylor expanded in d around inf 59.3%
*-commutative59.3%
*-commutative59.3%
associate-/r*59.3%
Simplified59.3%
sqrt-div74.7%
Applied egg-rr74.7%
Final simplification75.7%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ d h) 0.5))
(t_1 (sqrt (/ d l)))
(t_2
(*
(sqrt (/ d h))
(*
t_1
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))))))
(if (<= d -1700.0)
(*
(* t_0 t_1)
(- 1.0 (* (* (* (/ D d) (/ D d)) (* M (/ (* h M) l))) 0.125)))
(if (<= d -8.5e-107)
(*
(* t_0 (pow (/ d l) 0.5))
(- 1.0 (* 0.125 (/ (* D (* (/ h d) (/ M (/ d M)))) (/ l D)))))
(if (<= d -1.55e-302)
t_2
(if (<= d 1.46e-168)
(* -0.125 (* (* (* D D) (* M (/ M d))) (sqrt (/ h (pow l 3.0)))))
(if (<= d 2e+170) t_2 (* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((d / h), 0.5);
double t_1 = sqrt((d / l));
double t_2 = sqrt((d / h)) * (t_1 * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.0)))));
double tmp;
if (d <= -1700.0) {
tmp = (t_0 * t_1) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125));
} else if (d <= -8.5e-107) {
tmp = (t_0 * pow((d / l), 0.5)) * (1.0 - (0.125 * ((D * ((h / d) * (M / (d / M)))) / (l / D))));
} else if (d <= -1.55e-302) {
tmp = t_2;
} else if (d <= 1.46e-168) {
tmp = -0.125 * (((D * D) * (M * (M / d))) * sqrt((h / pow(l, 3.0))));
} else if (d <= 2e+170) {
tmp = t_2;
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (d / h) ** 0.5d0
t_1 = sqrt((d / l))
t_2 = sqrt((d / h)) * (t_1 * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0)))))
if (d <= (-1700.0d0)) then
tmp = (t_0 * t_1) * (1.0d0 - ((((d_1 / d) * (d_1 / d)) * (m * ((h * m) / l))) * 0.125d0))
else if (d <= (-8.5d-107)) then
tmp = (t_0 * ((d / l) ** 0.5d0)) * (1.0d0 - (0.125d0 * ((d_1 * ((h / d) * (m / (d / m)))) / (l / d_1))))
else if (d <= (-1.55d-302)) then
tmp = t_2
else if (d <= 1.46d-168) then
tmp = (-0.125d0) * (((d_1 * d_1) * (m * (m / d))) * sqrt((h / (l ** 3.0d0))))
else if (d <= 2d+170) then
tmp = t_2
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((d / h), 0.5);
double t_1 = Math.sqrt((d / l));
double t_2 = Math.sqrt((d / h)) * (t_1 * (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0)))));
double tmp;
if (d <= -1700.0) {
tmp = (t_0 * t_1) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125));
} else if (d <= -8.5e-107) {
tmp = (t_0 * Math.pow((d / l), 0.5)) * (1.0 - (0.125 * ((D * ((h / d) * (M / (d / M)))) / (l / D))));
} else if (d <= -1.55e-302) {
tmp = t_2;
} else if (d <= 1.46e-168) {
tmp = -0.125 * (((D * D) * (M * (M / d))) * Math.sqrt((h / Math.pow(l, 3.0))));
} else if (d <= 2e+170) {
tmp = t_2;
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow((d / h), 0.5) t_1 = math.sqrt((d / l)) t_2 = math.sqrt((d / h)) * (t_1 * (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0))))) tmp = 0 if d <= -1700.0: tmp = (t_0 * t_1) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125)) elif d <= -8.5e-107: tmp = (t_0 * math.pow((d / l), 0.5)) * (1.0 - (0.125 * ((D * ((h / d) * (M / (d / M)))) / (l / D)))) elif d <= -1.55e-302: tmp = t_2 elif d <= 1.46e-168: tmp = -0.125 * (((D * D) * (M * (M / d))) * math.sqrt((h / math.pow(l, 3.0)))) elif d <= 2e+170: tmp = t_2 else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(d / h) ^ 0.5 t_1 = sqrt(Float64(d / l)) t_2 = Float64(sqrt(Float64(d / h)) * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)))))) tmp = 0.0 if (d <= -1700.0) tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 - Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(M * Float64(Float64(h * M) / l))) * 0.125))); elseif (d <= -8.5e-107) tmp = Float64(Float64(t_0 * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(0.125 * Float64(Float64(D * Float64(Float64(h / d) * Float64(M / Float64(d / M)))) / Float64(l / D))))); elseif (d <= -1.55e-302) tmp = t_2; elseif (d <= 1.46e-168) tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) * Float64(M * Float64(M / d))) * sqrt(Float64(h / (l ^ 3.0))))); elseif (d <= 2e+170) tmp = t_2; else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (d / h) ^ 0.5;
t_1 = sqrt((d / l));
t_2 = sqrt((d / h)) * (t_1 * (1.0 - (0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 2.0)))));
tmp = 0.0;
if (d <= -1700.0)
tmp = (t_0 * t_1) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125));
elseif (d <= -8.5e-107)
tmp = (t_0 * ((d / l) ^ 0.5)) * (1.0 - (0.125 * ((D * ((h / d) * (M / (d / M)))) / (l / D))));
elseif (d <= -1.55e-302)
tmp = t_2;
elseif (d <= 1.46e-168)
tmp = -0.125 * (((D * D) * (M * (M / d))) * sqrt((h / (l ^ 3.0))));
elseif (d <= 2e+170)
tmp = t_2;
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1700.0], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(M * N[(N[(h * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -8.5e-107], N[(N[(t$95$0 * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(D * N[(N[(h / d), $MachinePrecision] * N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.55e-302], t$95$2, If[LessEqual[d, 1.46e-168], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2e+170], t$95$2, N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{h}\right)}^{0.5}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{d}{h}} \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\right)\\
\mathbf{if}\;d \leq -1700:\\
\;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{h \cdot M}{\ell}\right)\right) \cdot 0.125\right)\\
\mathbf{elif}\;d \leq -8.5 \cdot 10^{-107}:\\
\;\;\;\;\left(t_0 \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - 0.125 \cdot \frac{D \cdot \left(\frac{h}{d} \cdot \frac{M}{\frac{d}{M}}\right)}{\frac{\ell}{D}}\right)\\
\mathbf{elif}\;d \leq -1.55 \cdot 10^{-302}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq 1.46 \cdot 10^{-168}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(D \cdot D\right) \cdot \left(M \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\\
\mathbf{elif}\;d \leq 2 \cdot 10^{+170}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1700Initial program 73.1%
Taylor expanded in M around 0 50.6%
associate-*r/50.6%
*-commutative50.6%
associate-*r/50.6%
*-commutative50.6%
times-frac50.6%
unpow250.6%
unpow250.6%
times-frac65.2%
associate-/l*61.5%
unpow261.5%
Simplified61.5%
Taylor expanded in M around 0 65.2%
associate-*r/61.5%
unpow261.5%
associate-*l*65.4%
associate-*r/65.5%
Simplified65.5%
*-un-lft-identity65.5%
metadata-eval65.5%
unpow1/265.5%
Applied egg-rr65.5%
*-lft-identity65.5%
Simplified65.5%
if -1700 < d < -8.49999999999999956e-107Initial program 74.0%
Taylor expanded in M around 0 60.9%
associate-*r/60.9%
*-commutative60.9%
associate-*r/60.9%
*-commutative60.9%
times-frac65.2%
unpow265.2%
associate-/l*73.5%
unpow273.5%
times-frac73.7%
unpow273.7%
Simplified73.7%
associate-*l/80.9%
associate-/l*81.0%
Applied egg-rr81.0%
if -8.49999999999999956e-107 < d < -1.54999999999999992e-302 or 1.46e-168 < d < 2.00000000000000007e170Initial program 64.9%
associate-*l*64.9%
metadata-eval64.9%
unpow1/264.9%
metadata-eval64.9%
unpow1/264.9%
associate-*l*64.9%
metadata-eval64.9%
times-frac64.7%
Simplified64.7%
if -1.54999999999999992e-302 < d < 1.46e-168Initial program 37.3%
Taylor expanded in d around 0 54.9%
associate-*l/55.0%
unpow255.0%
unpow255.0%
Simplified55.0%
Taylor expanded in D around 0 54.9%
unpow254.9%
unpow254.9%
*-rgt-identity54.9%
associate-*r/54.9%
unpow254.9%
unpow254.9%
associate-*l*54.5%
unpow254.5%
unpow254.5%
associate-*l*60.1%
associate-*r/60.1%
*-rgt-identity60.1%
Simplified60.1%
if 2.00000000000000007e170 < d Initial program 62.4%
Taylor expanded in d around inf 95.9%
*-commutative95.9%
*-commutative95.9%
associate-/r*95.7%
Simplified95.7%
sqrt-div99.4%
Applied egg-rr99.4%
Final simplification69.1%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -2.4e-302)
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
(if (<= d 1.85e-177)
(* -0.125 (* (* (* D D) (* M (/ M d))) (sqrt (/ h (pow l 3.0)))))
(if (<= d 1.45e+171)
(*
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (/ (* h (pow (/ (* M D) (* d 2.0)) 2.0)) l))))
(sqrt (/ d h)))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.4e-302) {
tmp = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (d <= 1.85e-177) {
tmp = -0.125 * (((D * D) * (M * (M / d))) * sqrt((h / pow(l, 3.0))));
} else if (d <= 1.45e+171) {
tmp = (sqrt((d / l)) * (1.0 - (0.5 * ((h * pow(((M * D) / (d * 2.0)), 2.0)) / l)))) * sqrt((d / h));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-2.4d-302)) then
tmp = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
else if (d <= 1.85d-177) then
tmp = (-0.125d0) * (((d_1 * d_1) * (m * (m / d))) * sqrt((h / (l ** 3.0d0))))
else if (d <= 1.45d+171) then
tmp = (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((h * (((m * d_1) / (d * 2.0d0)) ** 2.0d0)) / l)))) * sqrt((d / h))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.4e-302) {
tmp = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (d <= 1.85e-177) {
tmp = -0.125 * (((D * D) * (M * (M / d))) * Math.sqrt((h / Math.pow(l, 3.0))));
} else if (d <= 1.45e+171) {
tmp = (Math.sqrt((d / l)) * (1.0 - (0.5 * ((h * Math.pow(((M * D) / (d * 2.0)), 2.0)) / l)))) * Math.sqrt((d / h));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -2.4e-302: tmp = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l)) elif d <= 1.85e-177: tmp = -0.125 * (((D * D) * (M * (M / d))) * math.sqrt((h / math.pow(l, 3.0)))) elif d <= 1.45e+171: tmp = (math.sqrt((d / l)) * (1.0 - (0.5 * ((h * math.pow(((M * D) / (d * 2.0)), 2.0)) / l)))) * math.sqrt((d / h)) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -2.4e-302) tmp = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l))); elseif (d <= 1.85e-177) tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) * Float64(M * Float64(M / d))) * sqrt(Float64(h / (l ^ 3.0))))); elseif (d <= 1.45e+171) tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)) / l)))) * sqrt(Float64(d / h))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -2.4e-302)
tmp = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
elseif (d <= 1.85e-177)
tmp = -0.125 * (((D * D) * (M * (M / d))) * sqrt((h / (l ^ 3.0))));
elseif (d <= 1.45e+171)
tmp = (sqrt((d / l)) * (1.0 - (0.5 * ((h * (((M * D) / (d * 2.0)) ^ 2.0)) / l)))) * sqrt((d / h));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -2.4e-302], N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.85e-177], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.45e+171], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.4 \cdot 10^{-302}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq 1.85 \cdot 10^{-177}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(D \cdot D\right) \cdot \left(M \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\\
\mathbf{elif}\;d \leq 1.45 \cdot 10^{+171}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}{\ell}\right)\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.40000000000000022e-302Initial program 66.0%
associate-*r/67.8%
*-commutative67.8%
frac-times67.7%
div-inv67.7%
metadata-eval67.7%
metadata-eval67.7%
Applied egg-rr67.7%
if -2.40000000000000022e-302 < d < 1.84999999999999997e-177Initial program 37.3%
Taylor expanded in d around 0 54.9%
associate-*l/55.0%
unpow255.0%
unpow255.0%
Simplified55.0%
Taylor expanded in D around 0 54.9%
unpow254.9%
unpow254.9%
*-rgt-identity54.9%
associate-*r/54.9%
unpow254.9%
unpow254.9%
associate-*l*54.5%
unpow254.5%
unpow254.5%
associate-*l*60.1%
associate-*r/60.1%
*-rgt-identity60.1%
Simplified60.1%
if 1.84999999999999997e-177 < d < 1.44999999999999992e171Initial program 71.8%
associate-*l*71.8%
metadata-eval71.8%
unpow1/271.8%
metadata-eval71.8%
unpow1/271.8%
associate-*l*71.8%
metadata-eval71.8%
times-frac71.7%
Simplified71.7%
frac-times71.8%
associate-/r*71.8%
Applied egg-rr71.8%
associate-*r/74.7%
associate-/l/74.7%
Applied egg-rr74.7%
if 1.44999999999999992e171 < d Initial program 62.4%
Taylor expanded in d around inf 95.9%
*-commutative95.9%
*-commutative95.9%
associate-/r*95.7%
Simplified95.7%
sqrt-div99.4%
Applied egg-rr99.4%
Final simplification71.8%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 1.7e+136)
(*
(sqrt (/ d h))
(*
(- 1.0 (* 0.5 (* (pow (/ (/ (* M D) 2.0) d) 2.0) (/ h l))))
(sqrt (/ d l))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.7e+136) {
tmp = sqrt((d / h)) * ((1.0 - (0.5 * (pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * sqrt((d / l)));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 1.7d+136) then
tmp = sqrt((d / h)) * ((1.0d0 - (0.5d0 * (((((m * d_1) / 2.0d0) / d) ** 2.0d0) * (h / l)))) * sqrt((d / l)))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.7e+136) {
tmp = Math.sqrt((d / h)) * ((1.0 - (0.5 * (Math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * Math.sqrt((d / l)));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 1.7e+136: tmp = math.sqrt((d / h)) * ((1.0 - (0.5 * (math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * math.sqrt((d / l))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 1.7e+136) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0) * Float64(h / l)))) * sqrt(Float64(d / l)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 1.7e+136)
tmp = sqrt((d / h)) * ((1.0 - (0.5 * (((((M * D) / 2.0) / d) ^ 2.0) * (h / l)))) * sqrt((d / l)));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 1.7e+136], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.7 \cdot 10^{+136}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 1.69999999999999998e136Initial program 66.2%
associate-*l*66.2%
metadata-eval66.2%
unpow1/266.2%
metadata-eval66.2%
unpow1/266.2%
associate-*l*66.2%
metadata-eval66.2%
times-frac65.7%
Simplified65.7%
frac-times66.2%
associate-/r*66.2%
Applied egg-rr66.2%
if 1.69999999999999998e136 < l Initial program 48.4%
Taylor expanded in d around inf 58.7%
*-commutative58.7%
*-commutative58.7%
associate-/r*58.6%
Simplified58.6%
sqrt-div72.9%
Applied egg-rr72.9%
Final simplification67.2%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 3.3e+136)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (/ (* h (pow (* (* 0.5 M) (/ D d)) 2.0)) l)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.3e+136) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h * pow(((0.5 * M) * (D / d)), 2.0)) / l))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 3.3d+136) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((h * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0)) / l))))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.3e+136) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * ((h * Math.pow(((0.5 * M) * (D / d)), 2.0)) / l))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 3.3e+136: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * ((h * math.pow(((0.5 * M) * (D / d)), 2.0)) / l)))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 3.3e+136) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)) / l))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 3.3e+136)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h * (((0.5 * M) * (D / d)) ^ 2.0)) / l))));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 3.3e+136], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.3 \cdot 10^{+136}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 3.29999999999999992e136Initial program 66.2%
associate-*l*66.2%
metadata-eval66.2%
unpow1/266.2%
metadata-eval66.2%
unpow1/266.2%
associate-*l*66.2%
metadata-eval66.2%
times-frac65.7%
Simplified65.7%
associate-*r/67.7%
div-inv67.7%
metadata-eval67.7%
Applied egg-rr67.7%
if 3.29999999999999992e136 < l Initial program 48.4%
Taylor expanded in d around inf 58.7%
*-commutative58.7%
*-commutative58.7%
associate-/r*58.6%
Simplified58.6%
sqrt-div72.9%
Applied egg-rr72.9%
Final simplification68.5%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 5.8e+138)
(*
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (/ (* h (pow (/ (* M D) (* d 2.0)) 2.0)) l))))
(sqrt (/ d h)))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 5.8e+138) {
tmp = (sqrt((d / l)) * (1.0 - (0.5 * ((h * pow(((M * D) / (d * 2.0)), 2.0)) / l)))) * sqrt((d / h));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 5.8d+138) then
tmp = (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((h * (((m * d_1) / (d * 2.0d0)) ** 2.0d0)) / l)))) * sqrt((d / h))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 5.8e+138) {
tmp = (Math.sqrt((d / l)) * (1.0 - (0.5 * ((h * Math.pow(((M * D) / (d * 2.0)), 2.0)) / l)))) * Math.sqrt((d / h));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 5.8e+138: tmp = (math.sqrt((d / l)) * (1.0 - (0.5 * ((h * math.pow(((M * D) / (d * 2.0)), 2.0)) / l)))) * math.sqrt((d / h)) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 5.8e+138) tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)) / l)))) * sqrt(Float64(d / h))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 5.8e+138)
tmp = (sqrt((d / l)) * (1.0 - (0.5 * ((h * (((M * D) / (d * 2.0)) ^ 2.0)) / l)))) * sqrt((d / h));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 5.8e+138], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.8 \cdot 10^{+138}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}{\ell}\right)\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 5.80000000000000019e138Initial program 66.2%
associate-*l*66.2%
metadata-eval66.2%
unpow1/266.2%
metadata-eval66.2%
unpow1/266.2%
associate-*l*66.2%
metadata-eval66.2%
times-frac65.7%
Simplified65.7%
frac-times66.2%
associate-/r*66.2%
Applied egg-rr66.2%
associate-*r/68.2%
associate-/l/68.2%
Applied egg-rr68.2%
if 5.80000000000000019e138 < l Initial program 48.4%
Taylor expanded in d around inf 58.7%
*-commutative58.7%
*-commutative58.7%
associate-/r*58.6%
Simplified58.6%
sqrt-div72.9%
Applied egg-rr72.9%
Final simplification68.9%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1
(*
(* (pow (/ d h) 0.5) t_0)
(- 1.0 (* (* (* (/ D d) (/ D d)) (* M (/ (* h M) l))) 0.125)))))
(if (<= d -4.3e-131)
t_1
(if (<= d -8.5e-215)
(*
(sqrt (/ (/ d h) (/ l d)))
(+ 1.0 (/ -0.5 (/ (/ l h) (pow (* 0.5 (/ M (/ d D))) 2.0)))))
(if (<= d -1.55e-302)
(* t_0 (sqrt (/ d h)))
(if (<= d 1.55e-169)
(* -0.125 (* (* (* D D) (* M (/ M d))) (sqrt (/ h (pow l 3.0)))))
(if (<= d 2.35e+174) t_1 (* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (pow((d / h), 0.5) * t_0) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125));
double tmp;
if (d <= -4.3e-131) {
tmp = t_1;
} else if (d <= -8.5e-215) {
tmp = sqrt(((d / h) / (l / d))) * (1.0 + (-0.5 / ((l / h) / pow((0.5 * (M / (d / D))), 2.0))));
} else if (d <= -1.55e-302) {
tmp = t_0 * sqrt((d / h));
} else if (d <= 1.55e-169) {
tmp = -0.125 * (((D * D) * (M * (M / d))) * sqrt((h / pow(l, 3.0))));
} else if (d <= 2.35e+174) {
tmp = t_1;
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = (((d / h) ** 0.5d0) * t_0) * (1.0d0 - ((((d_1 / d) * (d_1 / d)) * (m * ((h * m) / l))) * 0.125d0))
if (d <= (-4.3d-131)) then
tmp = t_1
else if (d <= (-8.5d-215)) then
tmp = sqrt(((d / h) / (l / d))) * (1.0d0 + ((-0.5d0) / ((l / h) / ((0.5d0 * (m / (d / d_1))) ** 2.0d0))))
else if (d <= (-1.55d-302)) then
tmp = t_0 * sqrt((d / h))
else if (d <= 1.55d-169) then
tmp = (-0.125d0) * (((d_1 * d_1) * (m * (m / d))) * sqrt((h / (l ** 3.0d0))))
else if (d <= 2.35d+174) then
tmp = t_1
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = (Math.pow((d / h), 0.5) * t_0) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125));
double tmp;
if (d <= -4.3e-131) {
tmp = t_1;
} else if (d <= -8.5e-215) {
tmp = Math.sqrt(((d / h) / (l / d))) * (1.0 + (-0.5 / ((l / h) / Math.pow((0.5 * (M / (d / D))), 2.0))));
} else if (d <= -1.55e-302) {
tmp = t_0 * Math.sqrt((d / h));
} else if (d <= 1.55e-169) {
tmp = -0.125 * (((D * D) * (M * (M / d))) * Math.sqrt((h / Math.pow(l, 3.0))));
} else if (d <= 2.35e+174) {
tmp = t_1;
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = (math.pow((d / h), 0.5) * t_0) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125)) tmp = 0 if d <= -4.3e-131: tmp = t_1 elif d <= -8.5e-215: tmp = math.sqrt(((d / h) / (l / d))) * (1.0 + (-0.5 / ((l / h) / math.pow((0.5 * (M / (d / D))), 2.0)))) elif d <= -1.55e-302: tmp = t_0 * math.sqrt((d / h)) elif d <= 1.55e-169: tmp = -0.125 * (((D * D) * (M * (M / d))) * math.sqrt((h / math.pow(l, 3.0)))) elif d <= 2.35e+174: tmp = t_1 else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * t_0) * Float64(1.0 - Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(M * Float64(Float64(h * M) / l))) * 0.125))) tmp = 0.0 if (d <= -4.3e-131) tmp = t_1; elseif (d <= -8.5e-215) tmp = Float64(sqrt(Float64(Float64(d / h) / Float64(l / d))) * Float64(1.0 + Float64(-0.5 / Float64(Float64(l / h) / (Float64(0.5 * Float64(M / Float64(d / D))) ^ 2.0))))); elseif (d <= -1.55e-302) tmp = Float64(t_0 * sqrt(Float64(d / h))); elseif (d <= 1.55e-169) tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) * Float64(M * Float64(M / d))) * sqrt(Float64(h / (l ^ 3.0))))); elseif (d <= 2.35e+174) tmp = t_1; else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
t_1 = (((d / h) ^ 0.5) * t_0) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125));
tmp = 0.0;
if (d <= -4.3e-131)
tmp = t_1;
elseif (d <= -8.5e-215)
tmp = sqrt(((d / h) / (l / d))) * (1.0 + (-0.5 / ((l / h) / ((0.5 * (M / (d / D))) ^ 2.0))));
elseif (d <= -1.55e-302)
tmp = t_0 * sqrt((d / h));
elseif (d <= 1.55e-169)
tmp = -0.125 * (((D * D) * (M * (M / d))) * sqrt((h / (l ^ 3.0))));
elseif (d <= 2.35e+174)
tmp = t_1;
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(M * N[(N[(h * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.3e-131], t$95$1, If[LessEqual[d, -8.5e-215], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 / N[(N[(l / h), $MachinePrecision] / N[Power[N[(0.5 * N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.55e-302], N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.55e-169], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.35e+174], t$95$1, N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot t_0\right) \cdot \left(1 - \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{h \cdot M}{\ell}\right)\right) \cdot 0.125\right)\\
\mathbf{if}\;d \leq -4.3 \cdot 10^{-131}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -8.5 \cdot 10^{-215}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}} \cdot \left(1 + \frac{-0.5}{\frac{\frac{\ell}{h}}{{\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}}}\right)\\
\mathbf{elif}\;d \leq -1.55 \cdot 10^{-302}:\\
\;\;\;\;t_0 \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq 1.55 \cdot 10^{-169}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(D \cdot D\right) \cdot \left(M \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\\
\mathbf{elif}\;d \leq 2.35 \cdot 10^{+174}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -4.30000000000000019e-131 or 1.5500000000000001e-169 < d < 2.3499999999999998e174Initial program 73.6%
Taylor expanded in M around 0 51.7%
associate-*r/51.7%
*-commutative51.7%
associate-*r/51.7%
*-commutative51.7%
times-frac55.5%
unpow255.5%
unpow255.5%
times-frac63.8%
associate-/l*61.9%
unpow261.9%
Simplified61.9%
Taylor expanded in M around 0 63.8%
associate-*r/61.9%
unpow261.9%
associate-*l*65.2%
associate-*r/67.2%
Simplified67.2%
*-un-lft-identity67.2%
metadata-eval67.2%
unpow1/267.2%
Applied egg-rr67.2%
*-lft-identity67.2%
Simplified67.2%
if -4.30000000000000019e-131 < d < -8.4999999999999998e-215Initial program 73.0%
associate-*r/73.0%
*-commutative73.0%
frac-times73.0%
div-inv73.0%
metadata-eval73.0%
metadata-eval73.0%
Applied egg-rr73.0%
pow173.0%
Applied egg-rr61.9%
unpow161.9%
unpow1/261.9%
associate-*r/61.9%
associate-/l*61.9%
sub-neg61.9%
associate-/l*61.9%
distribute-neg-frac61.9%
metadata-eval61.9%
associate-*l*61.9%
associate-*r/61.9%
associate-/l*61.9%
Simplified61.9%
if -8.4999999999999998e-215 < d < -1.54999999999999992e-302Initial program 25.7%
associate-*l*25.7%
metadata-eval25.7%
unpow1/225.7%
metadata-eval25.7%
unpow1/225.7%
associate-*l*25.7%
metadata-eval25.7%
times-frac25.3%
Simplified25.3%
frac-times25.7%
associate-/r*25.7%
Applied egg-rr25.7%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in M around 0 17.2%
if -1.54999999999999992e-302 < d < 1.5500000000000001e-169Initial program 37.3%
Taylor expanded in d around 0 54.9%
associate-*l/55.0%
unpow255.0%
unpow255.0%
Simplified55.0%
Taylor expanded in D around 0 54.9%
unpow254.9%
unpow254.9%
*-rgt-identity54.9%
associate-*r/54.9%
unpow254.9%
unpow254.9%
associate-*l*54.5%
unpow254.5%
unpow254.5%
associate-*l*60.1%
associate-*r/60.1%
*-rgt-identity60.1%
Simplified60.1%
if 2.3499999999999998e174 < d Initial program 62.4%
Taylor expanded in d around inf 95.9%
*-commutative95.9%
*-commutative95.9%
associate-/r*95.7%
Simplified95.7%
sqrt-div99.4%
Applied egg-rr99.4%
Final simplification64.7%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ d h) 0.5))
(t_1
(*
(* t_0 (sqrt (/ d l)))
(- 1.0 (* (* (* (/ D d) (/ D d)) (* M (/ (* h M) l))) 0.125)))))
(if (<= d -1.2e-22)
t_1
(if (<= d 2.45e-266)
(*
(* t_0 (pow (/ d l) 0.5))
(- 1.0 (* 0.125 (* (/ D (/ l D)) (* (* M (/ M d)) (/ h d))))))
(if (<= d 9.6e-167)
(* (sqrt (/ h (pow l 3.0))) (/ (* -0.125 (* D D)) (/ (/ d M) M)))
(if (<= d 1.4e+178) t_1 (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((d / h), 0.5);
double t_1 = (t_0 * sqrt((d / l))) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125));
double tmp;
if (d <= -1.2e-22) {
tmp = t_1;
} else if (d <= 2.45e-266) {
tmp = (t_0 * pow((d / l), 0.5)) * (1.0 - (0.125 * ((D / (l / D)) * ((M * (M / d)) * (h / d)))));
} else if (d <= 9.6e-167) {
tmp = sqrt((h / pow(l, 3.0))) * ((-0.125 * (D * D)) / ((d / M) / M));
} else if (d <= 1.4e+178) {
tmp = t_1;
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (d / h) ** 0.5d0
t_1 = (t_0 * sqrt((d / l))) * (1.0d0 - ((((d_1 / d) * (d_1 / d)) * (m * ((h * m) / l))) * 0.125d0))
if (d <= (-1.2d-22)) then
tmp = t_1
else if (d <= 2.45d-266) then
tmp = (t_0 * ((d / l) ** 0.5d0)) * (1.0d0 - (0.125d0 * ((d_1 / (l / d_1)) * ((m * (m / d)) * (h / d)))))
else if (d <= 9.6d-167) then
tmp = sqrt((h / (l ** 3.0d0))) * (((-0.125d0) * (d_1 * d_1)) / ((d / m) / m))
else if (d <= 1.4d+178) then
tmp = t_1
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((d / h), 0.5);
double t_1 = (t_0 * Math.sqrt((d / l))) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125));
double tmp;
if (d <= -1.2e-22) {
tmp = t_1;
} else if (d <= 2.45e-266) {
tmp = (t_0 * Math.pow((d / l), 0.5)) * (1.0 - (0.125 * ((D / (l / D)) * ((M * (M / d)) * (h / d)))));
} else if (d <= 9.6e-167) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * ((-0.125 * (D * D)) / ((d / M) / M));
} else if (d <= 1.4e+178) {
tmp = t_1;
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow((d / h), 0.5) t_1 = (t_0 * math.sqrt((d / l))) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125)) tmp = 0 if d <= -1.2e-22: tmp = t_1 elif d <= 2.45e-266: tmp = (t_0 * math.pow((d / l), 0.5)) * (1.0 - (0.125 * ((D / (l / D)) * ((M * (M / d)) * (h / d))))) elif d <= 9.6e-167: tmp = math.sqrt((h / math.pow(l, 3.0))) * ((-0.125 * (D * D)) / ((d / M) / M)) elif d <= 1.4e+178: tmp = t_1 else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(d / h) ^ 0.5 t_1 = Float64(Float64(t_0 * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(M * Float64(Float64(h * M) / l))) * 0.125))) tmp = 0.0 if (d <= -1.2e-22) tmp = t_1; elseif (d <= 2.45e-266) tmp = Float64(Float64(t_0 * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(0.125 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M * Float64(M / d)) * Float64(h / d)))))); elseif (d <= 9.6e-167) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(Float64(-0.125 * Float64(D * D)) / Float64(Float64(d / M) / M))); elseif (d <= 1.4e+178) tmp = t_1; else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (d / h) ^ 0.5;
t_1 = (t_0 * sqrt((d / l))) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125));
tmp = 0.0;
if (d <= -1.2e-22)
tmp = t_1;
elseif (d <= 2.45e-266)
tmp = (t_0 * ((d / l) ^ 0.5)) * (1.0 - (0.125 * ((D / (l / D)) * ((M * (M / d)) * (h / d)))));
elseif (d <= 9.6e-167)
tmp = sqrt((h / (l ^ 3.0))) * ((-0.125 * (D * D)) / ((d / M) / M));
elseif (d <= 1.4e+178)
tmp = t_1;
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(M * N[(N[(h * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.2e-22], t$95$1, If[LessEqual[d, 2.45e-266], N[(N[(t$95$0 * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.6e-167], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(-0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.4e+178], t$95$1, N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{h}\right)}^{0.5}\\
t_1 := \left(t_0 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{h \cdot M}{\ell}\right)\right) \cdot 0.125\right)\\
\mathbf{if}\;d \leq -1.2 \cdot 10^{-22}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq 2.45 \cdot 10^{-266}:\\
\;\;\;\;\left(t_0 \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\left(M \cdot \frac{M}{d}\right) \cdot \frac{h}{d}\right)\right)\right)\\
\mathbf{elif}\;d \leq 9.6 \cdot 10^{-167}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125 \cdot \left(D \cdot D\right)}{\frac{\frac{d}{M}}{M}}\\
\mathbf{elif}\;d \leq 1.4 \cdot 10^{+178}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.20000000000000001e-22 or 9.59999999999999972e-167 < d < 1.39999999999999997e178Initial program 73.3%
Taylor expanded in M around 0 50.8%
associate-*r/50.8%
*-commutative50.8%
associate-*r/50.8%
*-commutative50.8%
times-frac52.3%
unpow252.3%
unpow252.3%
times-frac61.9%
associate-/l*60.4%
unpow260.4%
Simplified60.4%
Taylor expanded in M around 0 61.9%
associate-*r/60.4%
unpow260.4%
associate-*l*63.5%
associate-*r/65.0%
Simplified65.0%
*-un-lft-identity65.0%
metadata-eval65.0%
unpow1/265.0%
Applied egg-rr65.0%
*-lft-identity65.0%
Simplified65.0%
if -1.20000000000000001e-22 < d < 2.4500000000000001e-266Initial program 54.1%
Taylor expanded in M around 0 28.8%
associate-*r/28.8%
*-commutative28.8%
associate-*r/28.8%
*-commutative28.8%
times-frac37.3%
unpow237.3%
associate-/l*40.3%
unpow240.3%
times-frac44.7%
unpow244.7%
Simplified44.7%
Taylor expanded in M around 0 44.7%
unpow244.7%
associate-*l/46.1%
*-commutative46.1%
Simplified46.1%
if 2.4500000000000001e-266 < d < 9.59999999999999972e-167Initial program 38.1%
Taylor expanded in d around 0 69.1%
associate-*r*69.1%
*-commutative69.1%
associate-/l*69.1%
associate-*r/69.1%
unpow269.1%
unpow269.1%
associate-/r*72.9%
Simplified72.9%
if 1.39999999999999997e178 < d Initial program 62.4%
Taylor expanded in d around inf 95.9%
*-commutative95.9%
*-commutative95.9%
associate-/r*95.7%
Simplified95.7%
sqrt-div99.4%
Applied egg-rr99.4%
Final simplification64.0%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ d h) 0.5))
(t_1
(*
(* t_0 (sqrt (/ d l)))
(- 1.0 (* (* (* (/ D d) (/ D d)) (* M (/ (* h M) l))) 0.125)))))
(if (<= d -40000.0)
t_1
(if (<= d 9e-266)
(*
(* t_0 (pow (/ d l) 0.5))
(- 1.0 (* 0.125 (/ (* D (* (/ h d) (/ M (/ d M)))) (/ l D)))))
(if (<= d 3.3e-172)
(* (sqrt (/ h (pow l 3.0))) (/ (* -0.125 (* D D)) (/ (/ d M) M)))
(if (<= d 5.1e+169) t_1 (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((d / h), 0.5);
double t_1 = (t_0 * sqrt((d / l))) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125));
double tmp;
if (d <= -40000.0) {
tmp = t_1;
} else if (d <= 9e-266) {
tmp = (t_0 * pow((d / l), 0.5)) * (1.0 - (0.125 * ((D * ((h / d) * (M / (d / M)))) / (l / D))));
} else if (d <= 3.3e-172) {
tmp = sqrt((h / pow(l, 3.0))) * ((-0.125 * (D * D)) / ((d / M) / M));
} else if (d <= 5.1e+169) {
tmp = t_1;
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (d / h) ** 0.5d0
t_1 = (t_0 * sqrt((d / l))) * (1.0d0 - ((((d_1 / d) * (d_1 / d)) * (m * ((h * m) / l))) * 0.125d0))
if (d <= (-40000.0d0)) then
tmp = t_1
else if (d <= 9d-266) then
tmp = (t_0 * ((d / l) ** 0.5d0)) * (1.0d0 - (0.125d0 * ((d_1 * ((h / d) * (m / (d / m)))) / (l / d_1))))
else if (d <= 3.3d-172) then
tmp = sqrt((h / (l ** 3.0d0))) * (((-0.125d0) * (d_1 * d_1)) / ((d / m) / m))
else if (d <= 5.1d+169) then
tmp = t_1
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((d / h), 0.5);
double t_1 = (t_0 * Math.sqrt((d / l))) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125));
double tmp;
if (d <= -40000.0) {
tmp = t_1;
} else if (d <= 9e-266) {
tmp = (t_0 * Math.pow((d / l), 0.5)) * (1.0 - (0.125 * ((D * ((h / d) * (M / (d / M)))) / (l / D))));
} else if (d <= 3.3e-172) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * ((-0.125 * (D * D)) / ((d / M) / M));
} else if (d <= 5.1e+169) {
tmp = t_1;
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow((d / h), 0.5) t_1 = (t_0 * math.sqrt((d / l))) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125)) tmp = 0 if d <= -40000.0: tmp = t_1 elif d <= 9e-266: tmp = (t_0 * math.pow((d / l), 0.5)) * (1.0 - (0.125 * ((D * ((h / d) * (M / (d / M)))) / (l / D)))) elif d <= 3.3e-172: tmp = math.sqrt((h / math.pow(l, 3.0))) * ((-0.125 * (D * D)) / ((d / M) / M)) elif d <= 5.1e+169: tmp = t_1 else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(d / h) ^ 0.5 t_1 = Float64(Float64(t_0 * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(M * Float64(Float64(h * M) / l))) * 0.125))) tmp = 0.0 if (d <= -40000.0) tmp = t_1; elseif (d <= 9e-266) tmp = Float64(Float64(t_0 * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(0.125 * Float64(Float64(D * Float64(Float64(h / d) * Float64(M / Float64(d / M)))) / Float64(l / D))))); elseif (d <= 3.3e-172) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(Float64(-0.125 * Float64(D * D)) / Float64(Float64(d / M) / M))); elseif (d <= 5.1e+169) tmp = t_1; else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (d / h) ^ 0.5;
t_1 = (t_0 * sqrt((d / l))) * (1.0 - ((((D / d) * (D / d)) * (M * ((h * M) / l))) * 0.125));
tmp = 0.0;
if (d <= -40000.0)
tmp = t_1;
elseif (d <= 9e-266)
tmp = (t_0 * ((d / l) ^ 0.5)) * (1.0 - (0.125 * ((D * ((h / d) * (M / (d / M)))) / (l / D))));
elseif (d <= 3.3e-172)
tmp = sqrt((h / (l ^ 3.0))) * ((-0.125 * (D * D)) / ((d / M) / M));
elseif (d <= 5.1e+169)
tmp = t_1;
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(M * N[(N[(h * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -40000.0], t$95$1, If[LessEqual[d, 9e-266], N[(N[(t$95$0 * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(D * N[(N[(h / d), $MachinePrecision] * N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.3e-172], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(-0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.1e+169], t$95$1, N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{h}\right)}^{0.5}\\
t_1 := \left(t_0 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{h \cdot M}{\ell}\right)\right) \cdot 0.125\right)\\
\mathbf{if}\;d \leq -40000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq 9 \cdot 10^{-266}:\\
\;\;\;\;\left(t_0 \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - 0.125 \cdot \frac{D \cdot \left(\frac{h}{d} \cdot \frac{M}{\frac{d}{M}}\right)}{\frac{\ell}{D}}\right)\\
\mathbf{elif}\;d \leq 3.3 \cdot 10^{-172}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125 \cdot \left(D \cdot D\right)}{\frac{\frac{d}{M}}{M}}\\
\mathbf{elif}\;d \leq 5.1 \cdot 10^{+169}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -4e4 or 3.3e-172 < d < 5.10000000000000008e169Initial program 72.4%
Taylor expanded in M around 0 50.1%
associate-*r/50.1%
*-commutative50.1%
associate-*r/50.1%
*-commutative50.1%
times-frac52.4%
unpow252.4%
unpow252.4%
times-frac62.7%
associate-/l*61.0%
unpow261.0%
Simplified61.0%
Taylor expanded in M around 0 62.7%
associate-*r/61.0%
unpow261.0%
associate-*l*64.3%
associate-*r/66.0%
Simplified66.0%
*-un-lft-identity66.0%
metadata-eval66.0%
unpow1/266.0%
Applied egg-rr66.0%
*-lft-identity66.0%
Simplified66.0%
if -4e4 < d < 9.0000000000000006e-266Initial program 56.9%
Taylor expanded in M around 0 31.8%
associate-*r/31.8%
*-commutative31.8%
associate-*r/31.8%
*-commutative31.8%
times-frac39.3%
unpow239.3%
associate-/l*43.3%
unpow243.3%
times-frac47.3%
unpow247.3%
Simplified47.3%
associate-*l/49.4%
associate-/l*50.7%
Applied egg-rr50.7%
if 9.0000000000000006e-266 < d < 3.3e-172Initial program 39.5%
Taylor expanded in d around 0 71.7%
associate-*r*71.7%
*-commutative71.7%
associate-/l*71.7%
associate-*r/71.7%
unpow271.7%
unpow271.7%
associate-/r*75.7%
Simplified75.7%
if 5.10000000000000008e169 < d Initial program 62.4%
Taylor expanded in d around inf 95.9%
*-commutative95.9%
*-commutative95.9%
associate-/r*95.7%
Simplified95.7%
sqrt-div99.4%
Applied egg-rr99.4%
Final simplification65.5%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* h (/ (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0)) l))))))
(if (<= d -2.5e-257)
t_0
(if (<= d 6.2e-169)
(* (sqrt (/ h (pow l 3.0))) (/ (* -0.125 (* D D)) (/ (/ d M) M)))
(if (<= d 9.5e+164) t_0 (* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / h) * (d / l))) * (1.0 - (h * ((0.5 * pow(((0.5 * M) * (D / d)), 2.0)) / l)));
double tmp;
if (d <= -2.5e-257) {
tmp = t_0;
} else if (d <= 6.2e-169) {
tmp = sqrt((h / pow(l, 3.0))) * ((-0.125 * (D * D)) / ((d / M) / M));
} else if (d <= 9.5e+164) {
tmp = t_0;
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((d / h) * (d / l))) * (1.0d0 - (h * ((0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0)) / l)))
if (d <= (-2.5d-257)) then
tmp = t_0
else if (d <= 6.2d-169) then
tmp = sqrt((h / (l ** 3.0d0))) * (((-0.125d0) * (d_1 * d_1)) / ((d / m) / m))
else if (d <= 9.5d+164) then
tmp = t_0
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / h) * (d / l))) * (1.0 - (h * ((0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0)) / l)));
double tmp;
if (d <= -2.5e-257) {
tmp = t_0;
} else if (d <= 6.2e-169) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * ((-0.125 * (D * D)) / ((d / M) / M));
} else if (d <= 9.5e+164) {
tmp = t_0;
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d / h) * (d / l))) * (1.0 - (h * ((0.5 * math.pow(((0.5 * M) * (D / d)), 2.0)) / l))) tmp = 0 if d <= -2.5e-257: tmp = t_0 elif d <= 6.2e-169: tmp = math.sqrt((h / math.pow(l, 3.0))) * ((-0.125 * (D * D)) / ((d / M) / M)) elif d <= 9.5e+164: tmp = t_0 else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(h * Float64(Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)) / l)))) tmp = 0.0 if (d <= -2.5e-257) tmp = t_0; elseif (d <= 6.2e-169) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(Float64(-0.125 * Float64(D * D)) / Float64(Float64(d / M) / M))); elseif (d <= 9.5e+164) tmp = t_0; else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d / h) * (d / l))) * (1.0 - (h * ((0.5 * (((0.5 * M) * (D / d)) ^ 2.0)) / l)));
tmp = 0.0;
if (d <= -2.5e-257)
tmp = t_0;
elseif (d <= 6.2e-169)
tmp = sqrt((h / (l ^ 3.0))) * ((-0.125 * (D * D)) / ((d / M) / M));
elseif (d <= 9.5e+164)
tmp = t_0;
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(h * N[(N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.5e-257], t$95$0, If[LessEqual[d, 6.2e-169], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(-0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.5e+164], t$95$0, N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - h \cdot \frac{0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\\
\mathbf{if}\;d \leq -2.5 \cdot 10^{-257}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 6.2 \cdot 10^{-169}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125 \cdot \left(D \cdot D\right)}{\frac{\frac{d}{M}}{M}}\\
\mathbf{elif}\;d \leq 9.5 \cdot 10^{+164}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.49999999999999994e-257 or 6.2000000000000004e-169 < d < 9.49999999999999976e164Initial program 70.0%
associate-*r/72.3%
*-commutative72.3%
frac-times72.3%
div-inv72.3%
metadata-eval72.3%
metadata-eval72.3%
Applied egg-rr72.3%
pow172.3%
Applied egg-rr59.1%
unpow159.1%
unpow1/259.1%
associate-/r/61.9%
Simplified61.9%
if -2.49999999999999994e-257 < d < 6.2000000000000004e-169Initial program 34.4%
Taylor expanded in d around 0 44.0%
associate-*r*44.0%
*-commutative44.0%
associate-/l*43.8%
associate-*r/43.8%
unpow243.8%
unpow243.8%
associate-/r*48.2%
Simplified48.2%
if 9.49999999999999976e164 < d Initial program 65.2%
Taylor expanded in d around inf 96.1%
*-commutative96.1%
*-commutative96.1%
associate-/r*95.9%
Simplified95.9%
sqrt-div99.4%
Applied egg-rr99.4%
Final simplification63.5%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (sqrt (/ d l)) (sqrt (/ d h)))))
(if (<= d -5e-157)
t_0
(if (<= d -1.7e-225)
(* d (pow (pow (* l h) -3.0) 0.16666666666666666))
(if (<= d -1.55e-302)
t_0
(if (<= d 1.15e-169)
(* -0.125 (* (* (* D D) (* M (/ M d))) (sqrt (/ h (pow l 3.0)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l)) * sqrt((d / h));
double tmp;
if (d <= -5e-157) {
tmp = t_0;
} else if (d <= -1.7e-225) {
tmp = d * pow(pow((l * h), -3.0), 0.16666666666666666);
} else if (d <= -1.55e-302) {
tmp = t_0;
} else if (d <= 1.15e-169) {
tmp = -0.125 * (((D * D) * (M * (M / d))) * sqrt((h / pow(l, 3.0))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l)) * sqrt((d / h))
if (d <= (-5d-157)) then
tmp = t_0
else if (d <= (-1.7d-225)) then
tmp = d * (((l * h) ** (-3.0d0)) ** 0.16666666666666666d0)
else if (d <= (-1.55d-302)) then
tmp = t_0
else if (d <= 1.15d-169) then
tmp = (-0.125d0) * (((d_1 * d_1) * (m * (m / d))) * sqrt((h / (l ** 3.0d0))))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l)) * Math.sqrt((d / h));
double tmp;
if (d <= -5e-157) {
tmp = t_0;
} else if (d <= -1.7e-225) {
tmp = d * Math.pow(Math.pow((l * h), -3.0), 0.16666666666666666);
} else if (d <= -1.55e-302) {
tmp = t_0;
} else if (d <= 1.15e-169) {
tmp = -0.125 * (((D * D) * (M * (M / d))) * Math.sqrt((h / Math.pow(l, 3.0))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) * math.sqrt((d / h)) tmp = 0 if d <= -5e-157: tmp = t_0 elif d <= -1.7e-225: tmp = d * math.pow(math.pow((l * h), -3.0), 0.16666666666666666) elif d <= -1.55e-302: tmp = t_0 elif d <= 1.15e-169: tmp = -0.125 * (((D * D) * (M * (M / d))) * math.sqrt((h / math.pow(l, 3.0)))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) tmp = 0.0 if (d <= -5e-157) tmp = t_0; elseif (d <= -1.7e-225) tmp = Float64(d * ((Float64(l * h) ^ -3.0) ^ 0.16666666666666666)); elseif (d <= -1.55e-302) tmp = t_0; elseif (d <= 1.15e-169) tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) * Float64(M * Float64(M / d))) * sqrt(Float64(h / (l ^ 3.0))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l)) * sqrt((d / h));
tmp = 0.0;
if (d <= -5e-157)
tmp = t_0;
elseif (d <= -1.7e-225)
tmp = d * (((l * h) ^ -3.0) ^ 0.16666666666666666);
elseif (d <= -1.55e-302)
tmp = t_0;
elseif (d <= 1.15e-169)
tmp = -0.125 * (((D * D) * (M * (M / d))) * sqrt((h / (l ^ 3.0))));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5e-157], t$95$0, If[LessEqual[d, -1.7e-225], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], -3.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.55e-302], t$95$0, If[LessEqual[d, 1.15e-169], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{if}\;d \leq -5 \cdot 10^{-157}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -1.7 \cdot 10^{-225}:\\
\;\;\;\;d \cdot {\left({\left(\ell \cdot h\right)}^{-3}\right)}^{0.16666666666666666}\\
\mathbf{elif}\;d \leq -1.55 \cdot 10^{-302}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{-169}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(D \cdot D\right) \cdot \left(M \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -5.0000000000000002e-157 or -1.7e-225 < d < -1.54999999999999992e-302Initial program 67.3%
associate-*l*67.3%
metadata-eval67.3%
unpow1/267.3%
metadata-eval67.3%
unpow1/267.3%
associate-*l*67.3%
metadata-eval67.3%
times-frac67.2%
Simplified67.2%
frac-times67.3%
associate-/r*67.3%
Applied egg-rr67.3%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in M around 0 49.4%
if -5.0000000000000002e-157 < d < -1.7e-225Initial program 58.9%
Taylor expanded in d around inf 23.6%
pow1/223.6%
add-cbrt-cube33.9%
pow1/333.9%
pow-pow33.9%
pow333.9%
inv-pow33.9%
pow-pow33.9%
*-commutative33.9%
metadata-eval33.9%
metadata-eval33.9%
Applied egg-rr33.9%
if -1.54999999999999992e-302 < d < 1.15e-169Initial program 37.3%
Taylor expanded in d around 0 54.9%
associate-*l/55.0%
unpow255.0%
unpow255.0%
Simplified55.0%
Taylor expanded in D around 0 54.9%
unpow254.9%
unpow254.9%
*-rgt-identity54.9%
associate-*r/54.9%
unpow254.9%
unpow254.9%
associate-*l*54.5%
unpow254.5%
unpow254.5%
associate-*l*60.1%
associate-*r/60.1%
*-rgt-identity60.1%
Simplified60.1%
if 1.15e-169 < d Initial program 69.4%
Taylor expanded in d around inf 55.9%
*-commutative55.9%
*-commutative55.9%
associate-/r*55.8%
Simplified55.8%
sqrt-div65.4%
Applied egg-rr65.4%
Final simplification55.8%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (sqrt (/ d l)) (sqrt (/ d h)))))
(if (<= d -9.2e-157)
t_0
(if (<= d -1.25e-226)
(* d (sqrt (cbrt (* (/ 1.0 (* (* l l) (* h h))) (/ 1.0 (* l h))))))
(if (<= d -1.55e-302)
t_0
(if (<= d 2.45e-167)
(* -0.125 (* (* (* D D) (* M (/ M d))) (sqrt (/ h (pow l 3.0)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l)) * sqrt((d / h));
double tmp;
if (d <= -9.2e-157) {
tmp = t_0;
} else if (d <= -1.25e-226) {
tmp = d * sqrt(cbrt(((1.0 / ((l * l) * (h * h))) * (1.0 / (l * h)))));
} else if (d <= -1.55e-302) {
tmp = t_0;
} else if (d <= 2.45e-167) {
tmp = -0.125 * (((D * D) * (M * (M / d))) * sqrt((h / pow(l, 3.0))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l)) * Math.sqrt((d / h));
double tmp;
if (d <= -9.2e-157) {
tmp = t_0;
} else if (d <= -1.25e-226) {
tmp = d * Math.sqrt(Math.cbrt(((1.0 / ((l * l) * (h * h))) * (1.0 / (l * h)))));
} else if (d <= -1.55e-302) {
tmp = t_0;
} else if (d <= 2.45e-167) {
tmp = -0.125 * (((D * D) * (M * (M / d))) * Math.sqrt((h / Math.pow(l, 3.0))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) tmp = 0.0 if (d <= -9.2e-157) tmp = t_0; elseif (d <= -1.25e-226) tmp = Float64(d * sqrt(cbrt(Float64(Float64(1.0 / Float64(Float64(l * l) * Float64(h * h))) * Float64(1.0 / Float64(l * h)))))); elseif (d <= -1.55e-302) tmp = t_0; elseif (d <= 2.45e-167) tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) * Float64(M * Float64(M / d))) * sqrt(Float64(h / (l ^ 3.0))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -9.2e-157], t$95$0, If[LessEqual[d, -1.25e-226], N[(d * N[Sqrt[N[Power[N[(N[(1.0 / N[(N[(l * l), $MachinePrecision] * N[(h * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.55e-302], t$95$0, If[LessEqual[d, 2.45e-167], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{if}\;d \leq -9.2 \cdot 10^{-157}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -1.25 \cdot 10^{-226}:\\
\;\;\;\;d \cdot \sqrt{\sqrt[3]{\frac{1}{\left(\ell \cdot \ell\right) \cdot \left(h \cdot h\right)} \cdot \frac{1}{\ell \cdot h}}}\\
\mathbf{elif}\;d \leq -1.55 \cdot 10^{-302}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 2.45 \cdot 10^{-167}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(D \cdot D\right) \cdot \left(M \cdot \frac{M}{d}\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -9.19999999999999954e-157 or -1.2499999999999999e-226 < d < -1.54999999999999992e-302Initial program 67.3%
associate-*l*67.3%
metadata-eval67.3%
unpow1/267.3%
metadata-eval67.3%
unpow1/267.3%
associate-*l*67.3%
metadata-eval67.3%
times-frac67.2%
Simplified67.2%
frac-times67.3%
associate-/r*67.3%
Applied egg-rr67.3%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in M around 0 49.4%
if -9.19999999999999954e-157 < d < -1.2499999999999999e-226Initial program 58.9%
Taylor expanded in d around inf 23.6%
*-commutative23.6%
*-commutative23.6%
associate-/r*23.6%
Simplified23.6%
add-cbrt-cube33.9%
associate-/l/33.9%
associate-/l/33.9%
associate-/l/33.9%
Applied egg-rr33.9%
Taylor expanded in l around 0 38.8%
unpow238.8%
unpow238.8%
Simplified38.8%
if -1.54999999999999992e-302 < d < 2.45000000000000002e-167Initial program 37.3%
Taylor expanded in d around 0 54.9%
associate-*l/55.0%
unpow255.0%
unpow255.0%
Simplified55.0%
Taylor expanded in D around 0 54.9%
unpow254.9%
unpow254.9%
*-rgt-identity54.9%
associate-*r/54.9%
unpow254.9%
unpow254.9%
associate-*l*54.5%
unpow254.5%
unpow254.5%
associate-*l*60.1%
associate-*r/60.1%
*-rgt-identity60.1%
Simplified60.1%
if 2.45000000000000002e-167 < d Initial program 69.4%
Taylor expanded in d around inf 55.9%
*-commutative55.9%
*-commutative55.9%
associate-/r*55.8%
Simplified55.8%
sqrt-div65.4%
Applied egg-rr65.4%
Final simplification56.2%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l 1.05e-236) (* d (sqrt (/ (/ 1.0 h) l))) (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.05e-236) {
tmp = d * sqrt(((1.0 / h) / l));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 1.05d-236) then
tmp = d * sqrt(((1.0d0 / h) / l))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.05e-236) {
tmp = d * Math.sqrt(((1.0 / h) / l));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 1.05e-236: tmp = d * math.sqrt(((1.0 / h) / l)) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 1.05e-236) tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 1.05e-236)
tmp = d * sqrt(((1.0 / h) / l));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 1.05e-236], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.05 \cdot 10^{-236}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 1.04999999999999989e-236Initial program 63.9%
Taylor expanded in d around inf 11.3%
*-commutative11.3%
*-commutative11.3%
associate-/r*11.3%
Simplified11.3%
if 1.04999999999999989e-236 < l Initial program 62.9%
Taylor expanded in d around inf 46.9%
*-commutative46.9%
*-commutative46.9%
associate-/r*46.8%
Simplified46.8%
sqrt-div54.5%
Applied egg-rr54.5%
Final simplification32.2%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l 1.85e-243) (* (sqrt (/ d l)) (sqrt (/ d h))) (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.85e-243) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 1.85d-243) then
tmp = sqrt((d / l)) * sqrt((d / h))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.85e-243) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 1.85e-243: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 1.85e-243) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 1.85e-243)
tmp = sqrt((d / l)) * sqrt((d / h));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 1.85e-243], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.85 \cdot 10^{-243}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 1.85e-243Initial program 64.3%
associate-*l*64.3%
metadata-eval64.3%
unpow1/264.3%
metadata-eval64.3%
unpow1/264.3%
associate-*l*64.3%
metadata-eval64.3%
times-frac64.2%
Simplified64.2%
frac-times64.3%
associate-/r*64.3%
Applied egg-rr64.3%
sqrt-div2.3%
Applied egg-rr2.3%
Taylor expanded in M around 0 41.9%
if 1.85e-243 < l Initial program 62.5%
Taylor expanded in d around inf 47.3%
*-commutative47.3%
*-commutative47.3%
associate-/r*47.3%
Simplified47.3%
sqrt-div54.8%
Applied egg-rr54.8%
Final simplification48.2%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (sqrt (/ (/ 1.0 h) l))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt(((1.0 / h) / l));
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d * sqrt(((1.0d0 / h) / l))
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt(((1.0 / h) / l));
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(((1.0 / h) / l))
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(Float64(1.0 / h) / l))) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt(((1.0 / h) / l));
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}
\end{array}
Initial program 63.4%
Taylor expanded in d around inf 28.5%
*-commutative28.5%
*-commutative28.5%
associate-/r*28.5%
Simplified28.5%
Final simplification28.5%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (sqrt (/ (/ 1.0 l) h))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt(((1.0 / l) / h));
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d * sqrt(((1.0d0 / l) / h))
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt(((1.0 / l) / h));
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(((1.0 / l) / h))
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt(((1.0 / l) / h));
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}
\end{array}
Initial program 63.4%
Taylor expanded in d around inf 28.5%
*-commutative28.5%
*-commutative28.5%
associate-/r*28.5%
Simplified28.5%
add-cbrt-cube17.7%
associate-/l/17.7%
associate-/l/17.7%
associate-/l/17.7%
Applied egg-rr17.7%
Taylor expanded in l around 0 28.5%
associate-/r*28.5%
Simplified28.5%
Final simplification28.5%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (sqrt (/ 1.0 (* l h)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt((1.0 / (l * h)));
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d * sqrt((1.0d0 / (l * h)))
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt((1.0 / (l * h)));
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt((1.0 / (l * h)))
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt((1.0 / (l * h)));
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\end{array}
Initial program 63.4%
Taylor expanded in d around inf 28.5%
Final simplification28.5%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (pow (* l h) -0.5)))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * pow((l * h), -0.5);
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d * ((l * h) ** (-0.5d0))
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.pow((l * h), -0.5);
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.pow((l * h), -0.5)
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * (Float64(l * h) ^ -0.5)) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * ((l * h) ^ -0.5);
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 63.4%
Taylor expanded in d around inf 28.5%
expm1-log1p-u27.9%
expm1-udef17.6%
pow1/217.6%
inv-pow17.6%
pow-pow17.3%
*-commutative17.3%
metadata-eval17.3%
Applied egg-rr17.3%
expm1-def27.5%
expm1-log1p28.2%
Simplified28.2%
Final simplification28.2%
herbie shell --seed 2023254
(FPCore (d h l M D)
:name "Henrywood and Agarwal, Equation (12)"
:precision binary64
(* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))