
(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 26 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 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 (/ M (* 2.0 d))) 2.0))
(t_1
(* (* d (sqrt (/ 1.0 (* h l)))) (- -1.0 (* -0.5 (* (/ h l) t_0))))))
(if (<= d -6.7e+109)
t_1
(if (<= d -4.4e-56)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* (pow (/ 1.0 (/ (* 2.0 d) (* D M))) 2.0) (* (/ h l) 0.5))))
(if (<= d -4.8e-238)
t_1
(if (<= d 4.6e-303)
(* (sqrt (/ h (pow l 3.0))) (* 0.125 (* M (/ (* D M) (/ d D)))))
(*
(* (/ (sqrt d) (sqrt h)) (pow (/ d l) 0.5))
(- 1.0 (/ (* h (* 0.5 t_0)) l)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((D * (M / (2.0 * d))), 2.0);
double t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_0)));
double tmp;
if (d <= -6.7e+109) {
tmp = t_1;
} else if (d <= -4.4e-56) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)));
} else if (d <= -4.8e-238) {
tmp = t_1;
} else if (d <= 4.6e-303) {
tmp = sqrt((h / pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
} else {
tmp = ((sqrt(d) / sqrt(h)) * pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * t_0)) / l));
}
return tmp;
}
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_1 * (m / (2.0d0 * d))) ** 2.0d0
t_1 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * t_0)))
if (d <= (-6.7d+109)) then
tmp = t_1
else if (d <= (-4.4d-56)) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (((1.0d0 / ((2.0d0 * d) / (d_1 * m))) ** 2.0d0) * ((h / l) * 0.5d0)))
else if (d <= (-4.8d-238)) then
tmp = t_1
else if (d <= 4.6d-303) then
tmp = sqrt((h / (l ** 3.0d0))) * (0.125d0 * (m * ((d_1 * m) / (d / d_1))))
else
tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h * (0.5d0 * t_0)) / l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((D * (M / (2.0 * d))), 2.0);
double t_1 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_0)));
double tmp;
if (d <= -6.7e+109) {
tmp = t_1;
} else if (d <= -4.4e-56) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (Math.pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)));
} else if (d <= -4.8e-238) {
tmp = t_1;
} else if (d <= 4.6e-303) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
} else {
tmp = ((Math.sqrt(d) / Math.sqrt(h)) * Math.pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * t_0)) / l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow((D * (M / (2.0 * d))), 2.0) t_1 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_0))) tmp = 0 if d <= -6.7e+109: tmp = t_1 elif d <= -4.4e-56: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (math.pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5))) elif d <= -4.8e-238: tmp = t_1 elif d <= 4.6e-303: tmp = math.sqrt((h / math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D)))) else: tmp = ((math.sqrt(d) / math.sqrt(h)) * math.pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * t_0)) / l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0 t_1 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * t_0)))) tmp = 0.0 if (d <= -6.7e+109) tmp = t_1; elseif (d <= -4.4e-56) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64((Float64(1.0 / Float64(Float64(2.0 * d) / Float64(D * M))) ^ 2.0) * Float64(Float64(h / l) * 0.5)))); elseif (d <= -4.8e-238) tmp = t_1; elseif (d <= 4.6e-303) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(0.125 * Float64(M * Float64(Float64(D * M) / Float64(d / D))))); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * t_0)) / l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (D * (M / (2.0 * d))) ^ 2.0;
t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_0)));
tmp = 0.0;
if (d <= -6.7e+109)
tmp = t_1;
elseif (d <= -4.4e-56)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (((1.0 / ((2.0 * d) / (D * M))) ^ 2.0) * ((h / l) * 0.5)));
elseif (d <= -4.8e-238)
tmp = t_1;
elseif (d <= 4.6e-303)
tmp = sqrt((h / (l ^ 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
else
tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ^ 0.5)) * (1.0 - ((h * (0.5 * t_0)) / l));
end
tmp_2 = tmp;
end
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 * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -6.7e+109], t$95$1, If[LessEqual[d, -4.4e-56], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[Power[N[(1.0 / N[(N[(2.0 * d), $MachinePrecision] / N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.8e-238], t$95$1, If[LessEqual[d, 4.6e-303], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\\
t_1 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot t_0\right)\right)\\
\mathbf{if}\;d \leq -6.7 \cdot 10^{+109}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -4.4 \cdot 10^{-56}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{2 \cdot d}{D \cdot M}}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\\
\mathbf{elif}\;d \leq -4.8 \cdot 10^{-238}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq 4.6 \cdot 10^{-303}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot t_0\right)}{\ell}\right)\\
\end{array}
\end{array}
if d < -6.70000000000000036e109 or -4.40000000000000008e-56 < d < -4.7999999999999997e-238Initial program 67.6%
Applied egg-rr22.4%
expm1-def27.5%
expm1-log1p56.4%
Simplified56.4%
Taylor expanded in d around -inf 81.8%
mul-1-neg81.8%
distribute-rgt-neg-in81.8%
*-commutative81.8%
Simplified81.8%
if -6.70000000000000036e109 < d < -4.40000000000000008e-56Initial program 91.6%
metadata-eval91.6%
unpow1/291.6%
metadata-eval91.6%
unpow1/291.6%
*-commutative91.6%
associate-*l*91.6%
times-frac91.6%
metadata-eval91.6%
Simplified91.6%
frac-times91.6%
clear-num91.6%
*-commutative91.6%
Applied egg-rr91.6%
if -4.7999999999999997e-238 < d < 4.59999999999999991e-303Initial program 28.2%
Applied egg-rr5.6%
expm1-def5.6%
expm1-log1p22.7%
Simplified22.7%
Taylor expanded in d around -inf 33.8%
mul-1-neg33.8%
distribute-rgt-neg-in33.8%
*-commutative33.8%
Simplified33.8%
Taylor expanded in D around inf 61.9%
*-commutative61.9%
unpow261.9%
unpow261.9%
associate-*l/56.4%
*-commutative56.4%
associate-*l*56.4%
*-commutative56.4%
associate-*r*57.2%
*-commutative57.2%
associate-/l*57.1%
associate-*l/62.5%
Simplified62.5%
if 4.59999999999999991e-303 < d Initial program 66.0%
metadata-eval66.0%
pow1/266.0%
sqrt-div78.6%
Applied egg-rr78.6%
associate-*r/80.3%
metadata-eval80.3%
*-commutative80.3%
*-commutative80.3%
associate-*r/79.5%
Applied egg-rr79.5%
Final simplification80.6%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h -2e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0)))))
(*
(* (/ (sqrt d) (sqrt h)) (/ (sqrt d) (sqrt l)))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D M) (* 2.0 d)) 2.0)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -2e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
} else {
tmp = ((sqrt(d) / sqrt(h)) * (sqrt(d) / sqrt(l))) * (1.0 - ((h / l) * (0.5 * pow(((D * M) / (2.0 * d)), 2.0))));
}
return tmp;
}
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 (h <= (-2d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
else
tmp = ((sqrt(d) / sqrt(h)) * (sqrt(d) / sqrt(l))) * (1.0d0 - ((h / l) * (0.5d0 * (((d_1 * m) / (2.0d0 * d)) ** 2.0d0))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -2e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
} else {
tmp = ((Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt(d) / Math.sqrt(l))) * (1.0 - ((h / l) * (0.5 * Math.pow(((D * M) / (2.0 * d)), 2.0))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -2e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0)))) else: tmp = ((math.sqrt(d) / math.sqrt(h)) * (math.sqrt(d) / math.sqrt(l))) * (1.0 - ((h / l) * (0.5 * math.pow(((D * M) / (2.0 * d)), 2.0)))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -2e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0))))); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(d) / sqrt(l))) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= -2e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
else
tmp = ((sqrt(d) / sqrt(h)) * (sqrt(d) / sqrt(l))) * (1.0 - ((h / l) * (0.5 * (((D * M) / (2.0 * d)) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -2e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 69.2%
Applied egg-rr21.9%
expm1-def30.7%
expm1-log1p57.9%
Simplified57.9%
Taylor expanded in d around -inf 73.7%
mul-1-neg73.7%
distribute-rgt-neg-in73.7%
*-commutative73.7%
Simplified73.7%
if -1.999999999999994e-310 < h Initial program 65.5%
metadata-eval65.5%
pow1/265.5%
sqrt-div78.0%
Applied egg-rr78.0%
metadata-eval78.0%
pow1/278.0%
sqrt-div81.8%
Applied egg-rr81.8%
Final simplification77.8%
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)))
(t_1 (sqrt (/ d l)))
(t_2 (pow (* D (/ M (* 2.0 d))) 2.0))
(t_3
(* (* d (sqrt (/ 1.0 (* h l)))) (- -1.0 (* -0.5 (* (/ h l) t_2)))))
(t_4 (sqrt (/ h (pow l 3.0))))
(t_5 (* M (/ D d)))
(t_6 (* M (/ (* D M) (/ d D)))))
(if (<= d -2.45e+113)
t_3
(if (<= d -3.7e-56)
(* t_0 (* t_1 (- 1.0 (* 0.5 (* (* (/ h l) (* t_5 t_5)) 0.25)))))
(if (<= d -5.4e-238)
t_3
(if (<= d -2e-310)
(* t_4 (* 0.125 t_6))
(if (<= d 1.05e-112)
(* t_4 (* t_6 -0.125))
(if (<= d 9.5e+133)
(* t_0 (* t_1 (- 1.0 (* 0.5 (/ (* h t_2) l)))))
(* d (/ (pow h -0.5) (sqrt l)))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double t_2 = pow((D * (M / (2.0 * d))), 2.0);
double t_3 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_2)));
double t_4 = sqrt((h / pow(l, 3.0)));
double t_5 = M * (D / d);
double t_6 = M * ((D * M) / (d / D));
double tmp;
if (d <= -2.45e+113) {
tmp = t_3;
} else if (d <= -3.7e-56) {
tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_5 * t_5)) * 0.25))));
} else if (d <= -5.4e-238) {
tmp = t_3;
} else if (d <= -2e-310) {
tmp = t_4 * (0.125 * t_6);
} else if (d <= 1.05e-112) {
tmp = t_4 * (t_6 * -0.125);
} else if (d <= 9.5e+133) {
tmp = t_0 * (t_1 * (1.0 - (0.5 * ((h * t_2) / l))));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = sqrt((d / l))
t_2 = (d_1 * (m / (2.0d0 * d))) ** 2.0d0
t_3 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * t_2)))
t_4 = sqrt((h / (l ** 3.0d0)))
t_5 = m * (d_1 / d)
t_6 = m * ((d_1 * m) / (d / d_1))
if (d <= (-2.45d+113)) then
tmp = t_3
else if (d <= (-3.7d-56)) then
tmp = t_0 * (t_1 * (1.0d0 - (0.5d0 * (((h / l) * (t_5 * t_5)) * 0.25d0))))
else if (d <= (-5.4d-238)) then
tmp = t_3
else if (d <= (-2d-310)) then
tmp = t_4 * (0.125d0 * t_6)
else if (d <= 1.05d-112) then
tmp = t_4 * (t_6 * (-0.125d0))
else if (d <= 9.5d+133) then
tmp = t_0 * (t_1 * (1.0d0 - (0.5d0 * ((h * t_2) / l))))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double t_2 = Math.pow((D * (M / (2.0 * d))), 2.0);
double t_3 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_2)));
double t_4 = Math.sqrt((h / Math.pow(l, 3.0)));
double t_5 = M * (D / d);
double t_6 = M * ((D * M) / (d / D));
double tmp;
if (d <= -2.45e+113) {
tmp = t_3;
} else if (d <= -3.7e-56) {
tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_5 * t_5)) * 0.25))));
} else if (d <= -5.4e-238) {
tmp = t_3;
} else if (d <= -2e-310) {
tmp = t_4 * (0.125 * t_6);
} else if (d <= 1.05e-112) {
tmp = t_4 * (t_6 * -0.125);
} else if (d <= 9.5e+133) {
tmp = t_0 * (t_1 * (1.0 - (0.5 * ((h * t_2) / l))));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = math.sqrt((d / l)) t_2 = math.pow((D * (M / (2.0 * d))), 2.0) t_3 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_2))) t_4 = math.sqrt((h / math.pow(l, 3.0))) t_5 = M * (D / d) t_6 = M * ((D * M) / (d / D)) tmp = 0 if d <= -2.45e+113: tmp = t_3 elif d <= -3.7e-56: tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_5 * t_5)) * 0.25)))) elif d <= -5.4e-238: tmp = t_3 elif d <= -2e-310: tmp = t_4 * (0.125 * t_6) elif d <= 1.05e-112: tmp = t_4 * (t_6 * -0.125) elif d <= 9.5e+133: tmp = t_0 * (t_1 * (1.0 - (0.5 * ((h * t_2) / l)))) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0 t_3 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * t_2)))) t_4 = sqrt(Float64(h / (l ^ 3.0))) t_5 = Float64(M * Float64(D / d)) t_6 = Float64(M * Float64(Float64(D * M) / Float64(d / D))) tmp = 0.0 if (d <= -2.45e+113) tmp = t_3; elseif (d <= -3.7e-56) tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(Float64(h / l) * Float64(t_5 * t_5)) * 0.25))))); elseif (d <= -5.4e-238) tmp = t_3; elseif (d <= -2e-310) tmp = Float64(t_4 * Float64(0.125 * t_6)); elseif (d <= 1.05e-112) tmp = Float64(t_4 * Float64(t_6 * -0.125)); elseif (d <= 9.5e+133) tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(h * t_2) / l))))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
t_1 = sqrt((d / l));
t_2 = (D * (M / (2.0 * d))) ^ 2.0;
t_3 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_2)));
t_4 = sqrt((h / (l ^ 3.0)));
t_5 = M * (D / d);
t_6 = M * ((D * M) / (d / D));
tmp = 0.0;
if (d <= -2.45e+113)
tmp = t_3;
elseif (d <= -3.7e-56)
tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_5 * t_5)) * 0.25))));
elseif (d <= -5.4e-238)
tmp = t_3;
elseif (d <= -2e-310)
tmp = t_4 * (0.125 * t_6);
elseif (d <= 1.05e-112)
tmp = t_4 * (t_6 * -0.125);
elseif (d <= 9.5e+133)
tmp = t_0 * (t_1 * (1.0 - (0.5 * ((h * t_2) / l))));
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
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 / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.45e+113], t$95$3, If[LessEqual[d, -3.7e-56], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(N[(h / l), $MachinePrecision] * N[(t$95$5 * t$95$5), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.4e-238], t$95$3, If[LessEqual[d, -2e-310], N[(t$95$4 * N[(0.125 * t$95$6), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.05e-112], N[(t$95$4 * N[(t$95$6 * -0.125), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.5e+133], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(h * t$95$2), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\\
t_3 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot t_2\right)\right)\\
t_4 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_5 := M \cdot \frac{D}{d}\\
t_6 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -2.45 \cdot 10^{+113}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;d \leq -3.7 \cdot 10^{-56}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_5 \cdot t_5\right)\right) \cdot 0.25\right)\right)\right)\\
\mathbf{elif}\;d \leq -5.4 \cdot 10^{-238}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_4 \cdot \left(0.125 \cdot t_6\right)\\
\mathbf{elif}\;d \leq 1.05 \cdot 10^{-112}:\\
\;\;\;\;t_4 \cdot \left(t_6 \cdot -0.125\right)\\
\mathbf{elif}\;d \leq 9.5 \cdot 10^{+133}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \frac{h \cdot t_2}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.45000000000000011e113 or -3.7000000000000002e-56 < d < -5.39999999999999981e-238Initial program 67.6%
Applied egg-rr22.4%
expm1-def27.5%
expm1-log1p56.4%
Simplified56.4%
Taylor expanded in d around -inf 81.8%
mul-1-neg81.8%
distribute-rgt-neg-in81.8%
*-commutative81.8%
Simplified81.8%
if -2.45000000000000011e113 < d < -3.7000000000000002e-56Initial program 91.6%
associate-*l*91.6%
metadata-eval91.6%
unpow1/291.6%
metadata-eval91.6%
unpow1/291.6%
associate-*l*91.6%
metadata-eval91.6%
times-frac91.6%
Simplified91.6%
Taylor expanded in M around 0 80.1%
associate-*r/80.1%
*-commutative80.1%
associate-*r/80.1%
*-commutative80.1%
associate-*r*77.3%
*-commutative77.3%
*-commutative77.3%
times-frac80.2%
*-commutative80.2%
unpow280.2%
unpow280.2%
unswap-sqr88.7%
unpow288.7%
times-frac91.6%
associate-*r/91.6%
associate-*r/91.6%
Simplified91.6%
if -5.39999999999999981e-238 < d < -1.999999999999994e-310Initial program 29.9%
Applied egg-rr5.9%
expm1-def5.9%
expm1-log1p24.0%
Simplified24.0%
Taylor expanded in d around -inf 35.8%
mul-1-neg35.8%
distribute-rgt-neg-in35.8%
*-commutative35.8%
Simplified35.8%
Taylor expanded in D around inf 65.3%
*-commutative65.3%
unpow265.3%
unpow265.3%
associate-*l/59.5%
*-commutative59.5%
associate-*l*59.5%
*-commutative59.5%
associate-*r*60.3%
*-commutative60.3%
associate-/l*60.2%
associate-*l/65.9%
Simplified65.9%
if -1.999999999999994e-310 < d < 1.05e-112Initial program 35.1%
metadata-eval35.1%
unpow1/235.1%
metadata-eval35.1%
unpow1/235.1%
*-commutative35.1%
associate-*l*35.1%
times-frac35.2%
metadata-eval35.2%
Simplified35.2%
frac-times35.1%
clear-num35.2%
*-commutative35.2%
Applied egg-rr35.2%
associate-*r*35.2%
*-commutative35.2%
clear-num35.1%
*-commutative35.1%
metadata-eval35.1%
associate-*r/37.4%
metadata-eval37.4%
times-frac37.5%
Applied egg-rr37.5%
Taylor expanded in d around 0 40.1%
associate-*r*40.1%
*-commutative40.1%
unpow240.1%
unpow240.1%
associate-*l/39.9%
associate-*r*42.7%
*-commutative42.7%
associate-/l*48.0%
associate-*l/50.5%
Simplified50.5%
if 1.05e-112 < d < 9.49999999999999996e133Initial program 85.2%
associate-*l*85.1%
metadata-eval85.1%
unpow1/285.1%
metadata-eval85.1%
unpow1/285.1%
associate-*l*85.1%
metadata-eval85.1%
times-frac85.2%
Simplified85.2%
associate-*r/85.3%
frac-times85.2%
*-commutative85.2%
*-commutative85.2%
associate-*r/81.8%
Applied egg-rr81.8%
if 9.49999999999999996e133 < d Initial program 66.3%
Taylor expanded in d around inf 79.7%
*-commutative79.7%
*-commutative79.7%
associate-/r*79.7%
Simplified79.7%
sqrt-div90.7%
inv-pow90.7%
Applied egg-rr90.7%
sqr-pow90.7%
rem-sqrt-square90.7%
metadata-eval90.7%
sqr-pow90.8%
fabs-sqr90.8%
sqr-pow90.7%
Simplified90.7%
Final simplification78.6%
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)))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (/ h (pow l 3.0))))
(t_3
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0))))))
(t_4 (* M (/ D d)))
(t_5 (* M (/ (* D M) (/ d D)))))
(if (<= d -1.1e+109)
t_3
(if (<= d -4.4e-56)
(* t_0 (* t_1 (- 1.0 (* 0.5 (* (* (/ h l) (* t_4 t_4)) 0.25)))))
(if (<= d -4.4e-238)
t_3
(if (<= d -2e-310)
(* t_2 (* 0.125 t_5))
(if (<= d 7.2e-113)
(* t_2 (* t_5 -0.125))
(if (<= d 1.08e+134)
(*
(* t_0 t_1)
(- 1.0 (* (* (/ h l) 0.5) (pow (/ (/ (* D M) 2.0) d) 2.0))))
(* d (/ (pow h -0.5) (sqrt l)))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double t_2 = sqrt((h / pow(l, 3.0)));
double t_3 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
double t_4 = M * (D / d);
double t_5 = M * ((D * M) / (d / D));
double tmp;
if (d <= -1.1e+109) {
tmp = t_3;
} else if (d <= -4.4e-56) {
tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_4 * t_4)) * 0.25))));
} else if (d <= -4.4e-238) {
tmp = t_3;
} else if (d <= -2e-310) {
tmp = t_2 * (0.125 * t_5);
} else if (d <= 7.2e-113) {
tmp = t_2 * (t_5 * -0.125);
} else if (d <= 1.08e+134) {
tmp = (t_0 * t_1) * (1.0 - (((h / l) * 0.5) * pow((((D * M) / 2.0) / d), 2.0)));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = sqrt((d / l))
t_2 = sqrt((h / (l ** 3.0d0)))
t_3 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
t_4 = m * (d_1 / d)
t_5 = m * ((d_1 * m) / (d / d_1))
if (d <= (-1.1d+109)) then
tmp = t_3
else if (d <= (-4.4d-56)) then
tmp = t_0 * (t_1 * (1.0d0 - (0.5d0 * (((h / l) * (t_4 * t_4)) * 0.25d0))))
else if (d <= (-4.4d-238)) then
tmp = t_3
else if (d <= (-2d-310)) then
tmp = t_2 * (0.125d0 * t_5)
else if (d <= 7.2d-113) then
tmp = t_2 * (t_5 * (-0.125d0))
else if (d <= 1.08d+134) then
tmp = (t_0 * t_1) * (1.0d0 - (((h / l) * 0.5d0) * ((((d_1 * m) / 2.0d0) / d) ** 2.0d0)))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double t_2 = Math.sqrt((h / Math.pow(l, 3.0)));
double t_3 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
double t_4 = M * (D / d);
double t_5 = M * ((D * M) / (d / D));
double tmp;
if (d <= -1.1e+109) {
tmp = t_3;
} else if (d <= -4.4e-56) {
tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_4 * t_4)) * 0.25))));
} else if (d <= -4.4e-238) {
tmp = t_3;
} else if (d <= -2e-310) {
tmp = t_2 * (0.125 * t_5);
} else if (d <= 7.2e-113) {
tmp = t_2 * (t_5 * -0.125);
} else if (d <= 1.08e+134) {
tmp = (t_0 * t_1) * (1.0 - (((h / l) * 0.5) * Math.pow((((D * M) / 2.0) / d), 2.0)));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = math.sqrt((d / l)) t_2 = math.sqrt((h / math.pow(l, 3.0))) t_3 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0)))) t_4 = M * (D / d) t_5 = M * ((D * M) / (d / D)) tmp = 0 if d <= -1.1e+109: tmp = t_3 elif d <= -4.4e-56: tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_4 * t_4)) * 0.25)))) elif d <= -4.4e-238: tmp = t_3 elif d <= -2e-310: tmp = t_2 * (0.125 * t_5) elif d <= 7.2e-113: tmp = t_2 * (t_5 * -0.125) elif d <= 1.08e+134: tmp = (t_0 * t_1) * (1.0 - (((h / l) * 0.5) * math.pow((((D * M) / 2.0) / d), 2.0))) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(h / (l ^ 3.0))) t_3 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0))))) t_4 = Float64(M * Float64(D / d)) t_5 = Float64(M * Float64(Float64(D * M) / Float64(d / D))) tmp = 0.0 if (d <= -1.1e+109) tmp = t_3; elseif (d <= -4.4e-56) tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(Float64(h / l) * Float64(t_4 * t_4)) * 0.25))))); elseif (d <= -4.4e-238) tmp = t_3; elseif (d <= -2e-310) tmp = Float64(t_2 * Float64(0.125 * t_5)); elseif (d <= 7.2e-113) tmp = Float64(t_2 * Float64(t_5 * -0.125)); elseif (d <= 1.08e+134) tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 - Float64(Float64(Float64(h / l) * 0.5) * (Float64(Float64(Float64(D * M) / 2.0) / d) ^ 2.0)))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
t_1 = sqrt((d / l));
t_2 = sqrt((h / (l ^ 3.0)));
t_3 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
t_4 = M * (D / d);
t_5 = M * ((D * M) / (d / D));
tmp = 0.0;
if (d <= -1.1e+109)
tmp = t_3;
elseif (d <= -4.4e-56)
tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_4 * t_4)) * 0.25))));
elseif (d <= -4.4e-238)
tmp = t_3;
elseif (d <= -2e-310)
tmp = t_2 * (0.125 * t_5);
elseif (d <= 7.2e-113)
tmp = t_2 * (t_5 * -0.125);
elseif (d <= 1.08e+134)
tmp = (t_0 * t_1) * (1.0 - (((h / l) * 0.5) * ((((D * M) / 2.0) / d) ^ 2.0)));
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
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 / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.1e+109], t$95$3, If[LessEqual[d, -4.4e-56], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(N[(h / l), $MachinePrecision] * N[(t$95$4 * t$95$4), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.4e-238], t$95$3, If[LessEqual[d, -2e-310], N[(t$95$2 * N[(0.125 * t$95$5), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.2e-113], N[(t$95$2 * N[(t$95$5 * -0.125), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.08e+134], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * 0.5), $MachinePrecision] * N[Power[N[(N[(N[(D * M), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_3 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
t_4 := M \cdot \frac{D}{d}\\
t_5 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -1.1 \cdot 10^{+109}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;d \leq -4.4 \cdot 10^{-56}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_4 \cdot t_4\right)\right) \cdot 0.25\right)\right)\right)\\
\mathbf{elif}\;d \leq -4.4 \cdot 10^{-238}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_2 \cdot \left(0.125 \cdot t_5\right)\\
\mathbf{elif}\;d \leq 7.2 \cdot 10^{-113}:\\
\;\;\;\;t_2 \cdot \left(t_5 \cdot -0.125\right)\\
\mathbf{elif}\;d \leq 1.08 \cdot 10^{+134}:\\
\;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - \left(\frac{h}{\ell} \cdot 0.5\right) \cdot {\left(\frac{\frac{D \cdot M}{2}}{d}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.1e109 or -4.40000000000000008e-56 < d < -4.39999999999999982e-238Initial program 67.6%
Applied egg-rr22.4%
expm1-def27.5%
expm1-log1p56.4%
Simplified56.4%
Taylor expanded in d around -inf 81.8%
mul-1-neg81.8%
distribute-rgt-neg-in81.8%
*-commutative81.8%
Simplified81.8%
if -1.1e109 < d < -4.40000000000000008e-56Initial program 91.6%
associate-*l*91.6%
metadata-eval91.6%
unpow1/291.6%
metadata-eval91.6%
unpow1/291.6%
associate-*l*91.6%
metadata-eval91.6%
times-frac91.6%
Simplified91.6%
Taylor expanded in M around 0 80.1%
associate-*r/80.1%
*-commutative80.1%
associate-*r/80.1%
*-commutative80.1%
associate-*r*77.3%
*-commutative77.3%
*-commutative77.3%
times-frac80.2%
*-commutative80.2%
unpow280.2%
unpow280.2%
unswap-sqr88.7%
unpow288.7%
times-frac91.6%
associate-*r/91.6%
associate-*r/91.6%
Simplified91.6%
if -4.39999999999999982e-238 < d < -1.999999999999994e-310Initial program 29.9%
Applied egg-rr5.9%
expm1-def5.9%
expm1-log1p24.0%
Simplified24.0%
Taylor expanded in d around -inf 35.8%
mul-1-neg35.8%
distribute-rgt-neg-in35.8%
*-commutative35.8%
Simplified35.8%
Taylor expanded in D around inf 65.3%
*-commutative65.3%
unpow265.3%
unpow265.3%
associate-*l/59.5%
*-commutative59.5%
associate-*l*59.5%
*-commutative59.5%
associate-*r*60.3%
*-commutative60.3%
associate-/l*60.2%
associate-*l/65.9%
Simplified65.9%
if -1.999999999999994e-310 < d < 7.1999999999999995e-113Initial program 35.1%
metadata-eval35.1%
unpow1/235.1%
metadata-eval35.1%
unpow1/235.1%
*-commutative35.1%
associate-*l*35.1%
times-frac35.2%
metadata-eval35.2%
Simplified35.2%
frac-times35.1%
clear-num35.2%
*-commutative35.2%
Applied egg-rr35.2%
associate-*r*35.2%
*-commutative35.2%
clear-num35.1%
*-commutative35.1%
metadata-eval35.1%
associate-*r/37.4%
metadata-eval37.4%
times-frac37.5%
Applied egg-rr37.5%
Taylor expanded in d around 0 40.1%
associate-*r*40.1%
*-commutative40.1%
unpow240.1%
unpow240.1%
associate-*l/39.9%
associate-*r*42.7%
*-commutative42.7%
associate-/l*48.0%
associate-*l/50.5%
Simplified50.5%
if 7.1999999999999995e-113 < d < 1.0800000000000001e134Initial program 85.2%
metadata-eval85.2%
unpow1/285.2%
metadata-eval85.2%
unpow1/285.2%
*-commutative85.2%
associate-*l*85.2%
times-frac85.2%
metadata-eval85.2%
Simplified85.2%
frac-times87.0%
associate-/r*87.0%
Applied egg-rr85.2%
if 1.0800000000000001e134 < d Initial program 66.3%
Taylor expanded in d around inf 79.7%
*-commutative79.7%
*-commutative79.7%
associate-/r*79.7%
Simplified79.7%
sqrt-div90.7%
inv-pow90.7%
Applied egg-rr90.7%
sqr-pow90.7%
rem-sqrt-square90.7%
metadata-eval90.7%
sqr-pow90.8%
fabs-sqr90.8%
sqr-pow90.7%
Simplified90.7%
Final simplification79.4%
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)))
(t_1 (sqrt (/ d l)))
(t_2
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0))))))
(t_3 (* M (/ D d))))
(if (<= d -3.15e+111)
t_2
(if (<= d -5e-56)
(* t_0 (* t_1 (- 1.0 (* 0.5 (* (* (/ h l) (* t_3 t_3)) 0.25)))))
(if (<= d -4.4e-238)
t_2
(if (<= d -2e-310)
(* (sqrt (/ h (pow l 3.0))) (* 0.125 (* M (/ (* D M) (/ d D)))))
(if (<= d 4e-236)
(* -0.125 (* (/ (* D D) (/ d (* M M))) (/ (sqrt h) (pow l 1.5))))
(if (<= d 3.5e+134)
(*
(* t_0 t_1)
(- 1.0 (/ (* h (* 0.5 (pow (* (/ D d) (/ M 2.0)) 2.0))) l)))
(* d (/ (pow h -0.5) (sqrt l)))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double t_2 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
double t_3 = M * (D / d);
double tmp;
if (d <= -3.15e+111) {
tmp = t_2;
} else if (d <= -5e-56) {
tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25))));
} else if (d <= -4.4e-238) {
tmp = t_2;
} else if (d <= -2e-310) {
tmp = sqrt((h / pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
} else if (d <= 4e-236) {
tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / pow(l, 1.5)));
} else if (d <= 3.5e+134) {
tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * pow(((D / d) * (M / 2.0)), 2.0))) / l));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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) :: t_3
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = sqrt((d / l))
t_2 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
t_3 = m * (d_1 / d)
if (d <= (-3.15d+111)) then
tmp = t_2
else if (d <= (-5d-56)) then
tmp = t_0 * (t_1 * (1.0d0 - (0.5d0 * (((h / l) * (t_3 * t_3)) * 0.25d0))))
else if (d <= (-4.4d-238)) then
tmp = t_2
else if (d <= (-2d-310)) then
tmp = sqrt((h / (l ** 3.0d0))) * (0.125d0 * (m * ((d_1 * m) / (d / d_1))))
else if (d <= 4d-236) then
tmp = (-0.125d0) * (((d_1 * d_1) / (d / (m * m))) * (sqrt(h) / (l ** 1.5d0)))
else if (d <= 3.5d+134) then
tmp = (t_0 * t_1) * (1.0d0 - ((h * (0.5d0 * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0))) / l))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double t_2 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
double t_3 = M * (D / d);
double tmp;
if (d <= -3.15e+111) {
tmp = t_2;
} else if (d <= -5e-56) {
tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25))));
} else if (d <= -4.4e-238) {
tmp = t_2;
} else if (d <= -2e-310) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
} else if (d <= 4e-236) {
tmp = -0.125 * (((D * D) / (d / (M * M))) * (Math.sqrt(h) / Math.pow(l, 1.5)));
} else if (d <= 3.5e+134) {
tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * Math.pow(((D / d) * (M / 2.0)), 2.0))) / l));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = math.sqrt((d / l)) t_2 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0)))) t_3 = M * (D / d) tmp = 0 if d <= -3.15e+111: tmp = t_2 elif d <= -5e-56: tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25)))) elif d <= -4.4e-238: tmp = t_2 elif d <= -2e-310: tmp = math.sqrt((h / math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D)))) elif d <= 4e-236: tmp = -0.125 * (((D * D) / (d / (M * M))) * (math.sqrt(h) / math.pow(l, 1.5))) elif d <= 3.5e+134: tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * math.pow(((D / d) * (M / 2.0)), 2.0))) / l)) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0))))) t_3 = Float64(M * Float64(D / d)) tmp = 0.0 if (d <= -3.15e+111) tmp = t_2; elseif (d <= -5e-56) tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(Float64(h / l) * Float64(t_3 * t_3)) * 0.25))))); elseif (d <= -4.4e-238) tmp = t_2; elseif (d <= -2e-310) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(0.125 * Float64(M * Float64(Float64(D * M) / Float64(d / D))))); elseif (d <= 4e-236) tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d / Float64(M * M))) * Float64(sqrt(h) / (l ^ 1.5)))); elseif (d <= 3.5e+134) tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0))) / l))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
t_1 = sqrt((d / l));
t_2 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
t_3 = M * (D / d);
tmp = 0.0;
if (d <= -3.15e+111)
tmp = t_2;
elseif (d <= -5e-56)
tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25))));
elseif (d <= -4.4e-238)
tmp = t_2;
elseif (d <= -2e-310)
tmp = sqrt((h / (l ^ 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
elseif (d <= 4e-236)
tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / (l ^ 1.5)));
elseif (d <= 3.5e+134)
tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * (((D / d) * (M / 2.0)) ^ 2.0))) / l));
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
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 / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.15e+111], t$95$2, If[LessEqual[d, -5e-56], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(N[(h / l), $MachinePrecision] * N[(t$95$3 * t$95$3), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.4e-238], t$95$2, If[LessEqual[d, -2e-310], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4e-236], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.5e+134], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
t_3 := M \cdot \frac{D}{d}\\
\mathbf{if}\;d \leq -3.15 \cdot 10^{+111}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-56}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_3 \cdot t_3\right)\right) \cdot 0.25\right)\right)\right)\\
\mathbf{elif}\;d \leq -4.4 \cdot 10^{-238}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\
\mathbf{elif}\;d \leq 4 \cdot 10^{-236}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\
\mathbf{elif}\;d \leq 3.5 \cdot 10^{+134}:\\
\;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -3.1500000000000001e111 or -4.99999999999999997e-56 < d < -4.39999999999999982e-238Initial program 67.6%
Applied egg-rr22.4%
expm1-def27.5%
expm1-log1p56.4%
Simplified56.4%
Taylor expanded in d around -inf 81.8%
mul-1-neg81.8%
distribute-rgt-neg-in81.8%
*-commutative81.8%
Simplified81.8%
if -3.1500000000000001e111 < d < -4.99999999999999997e-56Initial program 91.6%
associate-*l*91.6%
metadata-eval91.6%
unpow1/291.6%
metadata-eval91.6%
unpow1/291.6%
associate-*l*91.6%
metadata-eval91.6%
times-frac91.6%
Simplified91.6%
Taylor expanded in M around 0 80.1%
associate-*r/80.1%
*-commutative80.1%
associate-*r/80.1%
*-commutative80.1%
associate-*r*77.3%
*-commutative77.3%
*-commutative77.3%
times-frac80.2%
*-commutative80.2%
unpow280.2%
unpow280.2%
unswap-sqr88.7%
unpow288.7%
times-frac91.6%
associate-*r/91.6%
associate-*r/91.6%
Simplified91.6%
if -4.39999999999999982e-238 < d < -1.999999999999994e-310Initial program 29.9%
Applied egg-rr5.9%
expm1-def5.9%
expm1-log1p24.0%
Simplified24.0%
Taylor expanded in d around -inf 35.8%
mul-1-neg35.8%
distribute-rgt-neg-in35.8%
*-commutative35.8%
Simplified35.8%
Taylor expanded in D around inf 65.3%
*-commutative65.3%
unpow265.3%
unpow265.3%
associate-*l/59.5%
*-commutative59.5%
associate-*l*59.5%
*-commutative59.5%
associate-*r*60.3%
*-commutative60.3%
associate-/l*60.2%
associate-*l/65.9%
Simplified65.9%
if -1.999999999999994e-310 < d < 4.0000000000000002e-236Initial program 33.4%
Taylor expanded in d around 0 49.2%
associate-/l*44.3%
unpow244.3%
unpow244.3%
Simplified44.3%
sqrt-div44.3%
Applied egg-rr44.3%
sqr-pow44.3%
rem-sqrt-square54.3%
sqr-pow54.3%
fabs-sqr54.3%
sqr-pow54.3%
metadata-eval54.3%
Simplified54.3%
if 4.0000000000000002e-236 < d < 3.50000000000000003e134Initial program 73.6%
metadata-eval73.6%
unpow1/273.6%
metadata-eval73.6%
unpow1/273.6%
*-commutative73.6%
associate-*l*73.6%
times-frac73.7%
metadata-eval73.7%
Simplified73.7%
frac-times73.6%
clear-num73.7%
*-commutative73.7%
Applied egg-rr73.7%
associate-*r*73.7%
*-commutative73.7%
clear-num73.6%
*-commutative73.6%
metadata-eval73.6%
associate-*r/76.2%
metadata-eval76.2%
times-frac76.3%
Applied egg-rr76.3%
if 3.50000000000000003e134 < d Initial program 66.3%
Taylor expanded in d around inf 79.7%
*-commutative79.7%
*-commutative79.7%
associate-/r*79.7%
Simplified79.7%
sqrt-div90.7%
inv-pow90.7%
Applied egg-rr90.7%
sqr-pow90.7%
rem-sqrt-square90.7%
metadata-eval90.7%
sqr-pow90.8%
fabs-sqr90.8%
sqr-pow90.7%
Simplified90.7%
Final simplification79.5%
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)))
(t_1 (sqrt (/ d l)))
(t_2
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0))))))
(t_3 (* M (/ D d))))
(if (<= d -8e+113)
t_2
(if (<= d -5.2e-56)
(* t_0 (* t_1 (- 1.0 (* 0.5 (* (* (/ h l) (* t_3 t_3)) 0.25)))))
(if (<= d -5.2e-238)
t_2
(if (<= d -2e-310)
(* (sqrt (/ h (pow l 3.0))) (* 0.125 (* M (/ (* D M) (/ d D)))))
(if (<= d 4e-236)
(* -0.125 (* (/ (* D D) (/ d (* M M))) (/ (sqrt h) (pow l 1.5))))
(if (<= d 1.9e+134)
(*
(* t_0 t_1)
(- 1.0 (/ (* h (* 0.5 (pow (/ (/ (* D M) 2.0) d) 2.0))) l)))
(* d (/ (pow h -0.5) (sqrt l)))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double t_2 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
double t_3 = M * (D / d);
double tmp;
if (d <= -8e+113) {
tmp = t_2;
} else if (d <= -5.2e-56) {
tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25))));
} else if (d <= -5.2e-238) {
tmp = t_2;
} else if (d <= -2e-310) {
tmp = sqrt((h / pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
} else if (d <= 4e-236) {
tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / pow(l, 1.5)));
} else if (d <= 1.9e+134) {
tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * pow((((D * M) / 2.0) / d), 2.0))) / l));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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) :: t_3
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = sqrt((d / l))
t_2 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
t_3 = m * (d_1 / d)
if (d <= (-8d+113)) then
tmp = t_2
else if (d <= (-5.2d-56)) then
tmp = t_0 * (t_1 * (1.0d0 - (0.5d0 * (((h / l) * (t_3 * t_3)) * 0.25d0))))
else if (d <= (-5.2d-238)) then
tmp = t_2
else if (d <= (-2d-310)) then
tmp = sqrt((h / (l ** 3.0d0))) * (0.125d0 * (m * ((d_1 * m) / (d / d_1))))
else if (d <= 4d-236) then
tmp = (-0.125d0) * (((d_1 * d_1) / (d / (m * m))) * (sqrt(h) / (l ** 1.5d0)))
else if (d <= 1.9d+134) then
tmp = (t_0 * t_1) * (1.0d0 - ((h * (0.5d0 * ((((d_1 * m) / 2.0d0) / d) ** 2.0d0))) / l))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double t_2 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
double t_3 = M * (D / d);
double tmp;
if (d <= -8e+113) {
tmp = t_2;
} else if (d <= -5.2e-56) {
tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25))));
} else if (d <= -5.2e-238) {
tmp = t_2;
} else if (d <= -2e-310) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
} else if (d <= 4e-236) {
tmp = -0.125 * (((D * D) / (d / (M * M))) * (Math.sqrt(h) / Math.pow(l, 1.5)));
} else if (d <= 1.9e+134) {
tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * Math.pow((((D * M) / 2.0) / d), 2.0))) / l));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = math.sqrt((d / l)) t_2 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0)))) t_3 = M * (D / d) tmp = 0 if d <= -8e+113: tmp = t_2 elif d <= -5.2e-56: tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25)))) elif d <= -5.2e-238: tmp = t_2 elif d <= -2e-310: tmp = math.sqrt((h / math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D)))) elif d <= 4e-236: tmp = -0.125 * (((D * D) / (d / (M * M))) * (math.sqrt(h) / math.pow(l, 1.5))) elif d <= 1.9e+134: tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * math.pow((((D * M) / 2.0) / d), 2.0))) / l)) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0))))) t_3 = Float64(M * Float64(D / d)) tmp = 0.0 if (d <= -8e+113) tmp = t_2; elseif (d <= -5.2e-56) tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(Float64(h / l) * Float64(t_3 * t_3)) * 0.25))))); elseif (d <= -5.2e-238) tmp = t_2; elseif (d <= -2e-310) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(0.125 * Float64(M * Float64(Float64(D * M) / Float64(d / D))))); elseif (d <= 4e-236) tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d / Float64(M * M))) * Float64(sqrt(h) / (l ^ 1.5)))); elseif (d <= 1.9e+134) tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(Float64(D * M) / 2.0) / d) ^ 2.0))) / l))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
t_1 = sqrt((d / l));
t_2 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
t_3 = M * (D / d);
tmp = 0.0;
if (d <= -8e+113)
tmp = t_2;
elseif (d <= -5.2e-56)
tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25))));
elseif (d <= -5.2e-238)
tmp = t_2;
elseif (d <= -2e-310)
tmp = sqrt((h / (l ^ 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
elseif (d <= 4e-236)
tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / (l ^ 1.5)));
elseif (d <= 1.9e+134)
tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * ((((D * M) / 2.0) / d) ^ 2.0))) / l));
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
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 / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8e+113], t$95$2, If[LessEqual[d, -5.2e-56], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(N[(h / l), $MachinePrecision] * N[(t$95$3 * t$95$3), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.2e-238], t$95$2, If[LessEqual[d, -2e-310], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4e-236], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.9e+134], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(N[(D * M), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
t_3 := M \cdot \frac{D}{d}\\
\mathbf{if}\;d \leq -8 \cdot 10^{+113}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq -5.2 \cdot 10^{-56}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_3 \cdot t_3\right)\right) \cdot 0.25\right)\right)\right)\\
\mathbf{elif}\;d \leq -5.2 \cdot 10^{-238}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\
\mathbf{elif}\;d \leq 4 \cdot 10^{-236}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\
\mathbf{elif}\;d \leq 1.9 \cdot 10^{+134}:\\
\;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{\frac{D \cdot M}{2}}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -8e113 or -5.19999999999999994e-56 < d < -5.2000000000000002e-238Initial program 67.6%
Applied egg-rr22.4%
expm1-def27.5%
expm1-log1p56.4%
Simplified56.4%
Taylor expanded in d around -inf 81.8%
mul-1-neg81.8%
distribute-rgt-neg-in81.8%
*-commutative81.8%
Simplified81.8%
if -8e113 < d < -5.19999999999999994e-56Initial program 91.6%
associate-*l*91.6%
metadata-eval91.6%
unpow1/291.6%
metadata-eval91.6%
unpow1/291.6%
associate-*l*91.6%
metadata-eval91.6%
times-frac91.6%
Simplified91.6%
Taylor expanded in M around 0 80.1%
associate-*r/80.1%
*-commutative80.1%
associate-*r/80.1%
*-commutative80.1%
associate-*r*77.3%
*-commutative77.3%
*-commutative77.3%
times-frac80.2%
*-commutative80.2%
unpow280.2%
unpow280.2%
unswap-sqr88.7%
unpow288.7%
times-frac91.6%
associate-*r/91.6%
associate-*r/91.6%
Simplified91.6%
if -5.2000000000000002e-238 < d < -1.999999999999994e-310Initial program 29.9%
Applied egg-rr5.9%
expm1-def5.9%
expm1-log1p24.0%
Simplified24.0%
Taylor expanded in d around -inf 35.8%
mul-1-neg35.8%
distribute-rgt-neg-in35.8%
*-commutative35.8%
Simplified35.8%
Taylor expanded in D around inf 65.3%
*-commutative65.3%
unpow265.3%
unpow265.3%
associate-*l/59.5%
*-commutative59.5%
associate-*l*59.5%
*-commutative59.5%
associate-*r*60.3%
*-commutative60.3%
associate-/l*60.2%
associate-*l/65.9%
Simplified65.9%
if -1.999999999999994e-310 < d < 4.0000000000000002e-236Initial program 33.4%
Taylor expanded in d around 0 49.2%
associate-/l*44.3%
unpow244.3%
unpow244.3%
Simplified44.3%
sqrt-div44.3%
Applied egg-rr44.3%
sqr-pow44.3%
rem-sqrt-square54.3%
sqr-pow54.3%
fabs-sqr54.3%
sqr-pow54.3%
metadata-eval54.3%
Simplified54.3%
if 4.0000000000000002e-236 < d < 1.89999999999999999e134Initial program 73.6%
metadata-eval73.6%
unpow1/273.6%
metadata-eval73.6%
unpow1/273.6%
*-commutative73.6%
associate-*l*73.6%
times-frac73.7%
metadata-eval73.7%
Simplified73.7%
frac-times73.6%
clear-num73.7%
*-commutative73.7%
Applied egg-rr73.7%
associate-*r*73.7%
*-commutative73.7%
clear-num73.6%
*-commutative73.6%
metadata-eval73.6%
associate-*r/76.2%
metadata-eval76.2%
times-frac76.3%
Applied egg-rr76.3%
frac-times76.2%
associate-/r*76.2%
Applied egg-rr76.2%
if 1.89999999999999999e134 < d Initial program 66.3%
Taylor expanded in d around inf 79.7%
*-commutative79.7%
*-commutative79.7%
associate-/r*79.7%
Simplified79.7%
sqrt-div90.7%
inv-pow90.7%
Applied egg-rr90.7%
sqr-pow90.7%
rem-sqrt-square90.7%
metadata-eval90.7%
sqr-pow90.8%
fabs-sqr90.8%
sqr-pow90.7%
Simplified90.7%
Final simplification79.5%
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)) (sqrt (/ d l))))
(t_1
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0)))))))
(if (<= d -8e+113)
t_1
(if (<= d -3.5e-56)
(*
t_0
(- 1.0 (* (pow (/ 1.0 (/ (* 2.0 d) (* D M))) 2.0) (* (/ h l) 0.5))))
(if (<= d -5.1e-238)
t_1
(if (<= d -2e-310)
(* (sqrt (/ h (pow l 3.0))) (* 0.125 (* M (/ (* D M) (/ d D)))))
(if (<= d 6.8e-239)
(* -0.125 (* (/ (* D D) (/ d (* M M))) (/ (sqrt h) (pow l 1.5))))
(if (<= d 2e+134)
(*
t_0
(- 1.0 (/ (* h (* 0.5 (pow (/ (/ (* D M) 2.0) d) 2.0))) l)))
(* d (/ (pow h -0.5) (sqrt l)))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h)) * sqrt((d / l));
double t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
double tmp;
if (d <= -8e+113) {
tmp = t_1;
} else if (d <= -3.5e-56) {
tmp = t_0 * (1.0 - (pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)));
} else if (d <= -5.1e-238) {
tmp = t_1;
} else if (d <= -2e-310) {
tmp = sqrt((h / pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
} else if (d <= 6.8e-239) {
tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / pow(l, 1.5)));
} else if (d <= 2e+134) {
tmp = t_0 * (1.0 - ((h * (0.5 * pow((((D * M) / 2.0) / d), 2.0))) / l));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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 / h)) * sqrt((d / l))
t_1 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
if (d <= (-8d+113)) then
tmp = t_1
else if (d <= (-3.5d-56)) then
tmp = t_0 * (1.0d0 - (((1.0d0 / ((2.0d0 * d) / (d_1 * m))) ** 2.0d0) * ((h / l) * 0.5d0)))
else if (d <= (-5.1d-238)) then
tmp = t_1
else if (d <= (-2d-310)) then
tmp = sqrt((h / (l ** 3.0d0))) * (0.125d0 * (m * ((d_1 * m) / (d / d_1))))
else if (d <= 6.8d-239) then
tmp = (-0.125d0) * (((d_1 * d_1) / (d / (m * m))) * (sqrt(h) / (l ** 1.5d0)))
else if (d <= 2d+134) then
tmp = t_0 * (1.0d0 - ((h * (0.5d0 * ((((d_1 * m) / 2.0d0) / d) ** 2.0d0))) / l))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h)) * Math.sqrt((d / l));
double t_1 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
double tmp;
if (d <= -8e+113) {
tmp = t_1;
} else if (d <= -3.5e-56) {
tmp = t_0 * (1.0 - (Math.pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)));
} else if (d <= -5.1e-238) {
tmp = t_1;
} else if (d <= -2e-310) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
} else if (d <= 6.8e-239) {
tmp = -0.125 * (((D * D) / (d / (M * M))) * (Math.sqrt(h) / Math.pow(l, 1.5)));
} else if (d <= 2e+134) {
tmp = t_0 * (1.0 - ((h * (0.5 * Math.pow((((D * M) / 2.0) / d), 2.0))) / l));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) * math.sqrt((d / l)) t_1 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0)))) tmp = 0 if d <= -8e+113: tmp = t_1 elif d <= -3.5e-56: tmp = t_0 * (1.0 - (math.pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5))) elif d <= -5.1e-238: tmp = t_1 elif d <= -2e-310: tmp = math.sqrt((h / math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D)))) elif d <= 6.8e-239: tmp = -0.125 * (((D * D) / (d / (M * M))) * (math.sqrt(h) / math.pow(l, 1.5))) elif d <= 2e+134: tmp = t_0 * (1.0 - ((h * (0.5 * math.pow((((D * M) / 2.0) / d), 2.0))) / l)) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) t_1 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0))))) tmp = 0.0 if (d <= -8e+113) tmp = t_1; elseif (d <= -3.5e-56) tmp = Float64(t_0 * Float64(1.0 - Float64((Float64(1.0 / Float64(Float64(2.0 * d) / Float64(D * M))) ^ 2.0) * Float64(Float64(h / l) * 0.5)))); elseif (d <= -5.1e-238) tmp = t_1; elseif (d <= -2e-310) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(0.125 * Float64(M * Float64(Float64(D * M) / Float64(d / D))))); elseif (d <= 6.8e-239) tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d / Float64(M * M))) * Float64(sqrt(h) / (l ^ 1.5)))); elseif (d <= 2e+134) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(Float64(D * M) / 2.0) / d) ^ 2.0))) / l))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h)) * sqrt((d / l));
t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
tmp = 0.0;
if (d <= -8e+113)
tmp = t_1;
elseif (d <= -3.5e-56)
tmp = t_0 * (1.0 - (((1.0 / ((2.0 * d) / (D * M))) ^ 2.0) * ((h / l) * 0.5)));
elseif (d <= -5.1e-238)
tmp = t_1;
elseif (d <= -2e-310)
tmp = sqrt((h / (l ^ 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
elseif (d <= 6.8e-239)
tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / (l ^ 1.5)));
elseif (d <= 2e+134)
tmp = t_0 * (1.0 - ((h * (0.5 * ((((D * M) / 2.0) / d) ^ 2.0))) / l));
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
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 / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8e+113], t$95$1, If[LessEqual[d, -3.5e-56], N[(t$95$0 * N[(1.0 - N[(N[Power[N[(1.0 / N[(N[(2.0 * d), $MachinePrecision] / N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.1e-238], t$95$1, If[LessEqual[d, -2e-310], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.8e-239], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2e+134], N[(t$95$0 * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(N[(D * M), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
t_1 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
\mathbf{if}\;d \leq -8 \cdot 10^{+113}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -3.5 \cdot 10^{-56}:\\
\;\;\;\;t_0 \cdot \left(1 - {\left(\frac{1}{\frac{2 \cdot d}{D \cdot M}}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\\
\mathbf{elif}\;d \leq -5.1 \cdot 10^{-238}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\
\mathbf{elif}\;d \leq 6.8 \cdot 10^{-239}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\
\mathbf{elif}\;d \leq 2 \cdot 10^{+134}:\\
\;\;\;\;t_0 \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{\frac{D \cdot M}{2}}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -8e113 or -3.4999999999999998e-56 < d < -5.1000000000000001e-238Initial program 67.6%
Applied egg-rr22.4%
expm1-def27.5%
expm1-log1p56.4%
Simplified56.4%
Taylor expanded in d around -inf 81.8%
mul-1-neg81.8%
distribute-rgt-neg-in81.8%
*-commutative81.8%
Simplified81.8%
if -8e113 < d < -3.4999999999999998e-56Initial program 91.6%
metadata-eval91.6%
unpow1/291.6%
metadata-eval91.6%
unpow1/291.6%
*-commutative91.6%
associate-*l*91.6%
times-frac91.6%
metadata-eval91.6%
Simplified91.6%
frac-times91.6%
clear-num91.6%
*-commutative91.6%
Applied egg-rr91.6%
if -5.1000000000000001e-238 < d < -1.999999999999994e-310Initial program 29.9%
Applied egg-rr5.9%
expm1-def5.9%
expm1-log1p24.0%
Simplified24.0%
Taylor expanded in d around -inf 35.8%
mul-1-neg35.8%
distribute-rgt-neg-in35.8%
*-commutative35.8%
Simplified35.8%
Taylor expanded in D around inf 65.3%
*-commutative65.3%
unpow265.3%
unpow265.3%
associate-*l/59.5%
*-commutative59.5%
associate-*l*59.5%
*-commutative59.5%
associate-*r*60.3%
*-commutative60.3%
associate-/l*60.2%
associate-*l/65.9%
Simplified65.9%
if -1.999999999999994e-310 < d < 6.8e-239Initial program 33.4%
Taylor expanded in d around 0 49.2%
associate-/l*44.3%
unpow244.3%
unpow244.3%
Simplified44.3%
sqrt-div44.3%
Applied egg-rr44.3%
sqr-pow44.3%
rem-sqrt-square54.3%
sqr-pow54.3%
fabs-sqr54.3%
sqr-pow54.3%
metadata-eval54.3%
Simplified54.3%
if 6.8e-239 < d < 1.99999999999999984e134Initial program 73.6%
metadata-eval73.6%
unpow1/273.6%
metadata-eval73.6%
unpow1/273.6%
*-commutative73.6%
associate-*l*73.6%
times-frac73.7%
metadata-eval73.7%
Simplified73.7%
frac-times73.6%
clear-num73.7%
*-commutative73.7%
Applied egg-rr73.7%
associate-*r*73.7%
*-commutative73.7%
clear-num73.6%
*-commutative73.6%
metadata-eval73.6%
associate-*r/76.2%
metadata-eval76.2%
times-frac76.3%
Applied egg-rr76.3%
frac-times76.2%
associate-/r*76.2%
Applied egg-rr76.2%
if 1.99999999999999984e134 < d Initial program 66.3%
Taylor expanded in d around inf 79.7%
*-commutative79.7%
*-commutative79.7%
associate-/r*79.7%
Simplified79.7%
sqrt-div90.7%
inv-pow90.7%
Applied egg-rr90.7%
sqr-pow90.7%
rem-sqrt-square90.7%
metadata-eval90.7%
sqr-pow90.8%
fabs-sqr90.8%
sqr-pow90.7%
Simplified90.7%
Final simplification79.5%
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
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0))))))
(t_1 (* M (/ D d))))
(if (<= d -1.15e+115)
t_0
(if (<= d -3.5e-56)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* (pow (/ 1.0 (/ (* 2.0 d) (* D M))) 2.0) (* (/ h l) 0.5))))
(if (<= d -5.9e-238)
t_0
(if (<= d 4.6e-303)
(* (sqrt (/ h (pow l 3.0))) (* 0.125 (* M (/ (* D M) (/ d D)))))
(*
(* (/ (sqrt d) (sqrt h)) (pow (/ d l) 0.5))
(- 1.0 (* 0.125 (* (/ h l) (* t_1 t_1)))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
double t_1 = M * (D / d);
double tmp;
if (d <= -1.15e+115) {
tmp = t_0;
} else if (d <= -3.5e-56) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)));
} else if (d <= -5.9e-238) {
tmp = t_0;
} else if (d <= 4.6e-303) {
tmp = sqrt((h / pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
} else {
tmp = ((sqrt(d) / sqrt(h)) * pow((d / l), 0.5)) * (1.0 - (0.125 * ((h / l) * (t_1 * t_1))));
}
return tmp;
}
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 * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
t_1 = m * (d_1 / d)
if (d <= (-1.15d+115)) then
tmp = t_0
else if (d <= (-3.5d-56)) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (((1.0d0 / ((2.0d0 * d) / (d_1 * m))) ** 2.0d0) * ((h / l) * 0.5d0)))
else if (d <= (-5.9d-238)) then
tmp = t_0
else if (d <= 4.6d-303) then
tmp = sqrt((h / (l ** 3.0d0))) * (0.125d0 * (m * ((d_1 * m) / (d / d_1))))
else
tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ** 0.5d0)) * (1.0d0 - (0.125d0 * ((h / l) * (t_1 * t_1))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
double t_1 = M * (D / d);
double tmp;
if (d <= -1.15e+115) {
tmp = t_0;
} else if (d <= -3.5e-56) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (Math.pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)));
} else if (d <= -5.9e-238) {
tmp = t_0;
} else if (d <= 4.6e-303) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
} else {
tmp = ((Math.sqrt(d) / Math.sqrt(h)) * Math.pow((d / l), 0.5)) * (1.0 - (0.125 * ((h / l) * (t_1 * t_1))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0)))) t_1 = M * (D / d) tmp = 0 if d <= -1.15e+115: tmp = t_0 elif d <= -3.5e-56: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (math.pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5))) elif d <= -5.9e-238: tmp = t_0 elif d <= 4.6e-303: tmp = math.sqrt((h / math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D)))) else: tmp = ((math.sqrt(d) / math.sqrt(h)) * math.pow((d / l), 0.5)) * (1.0 - (0.125 * ((h / l) * (t_1 * t_1)))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0))))) t_1 = Float64(M * Float64(D / d)) tmp = 0.0 if (d <= -1.15e+115) tmp = t_0; elseif (d <= -3.5e-56) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64((Float64(1.0 / Float64(Float64(2.0 * d) / Float64(D * M))) ^ 2.0) * Float64(Float64(h / l) * 0.5)))); elseif (d <= -5.9e-238) tmp = t_0; elseif (d <= 4.6e-303) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(0.125 * Float64(M * Float64(Float64(D * M) / Float64(d / D))))); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(0.125 * Float64(Float64(h / l) * Float64(t_1 * t_1))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
t_1 = M * (D / d);
tmp = 0.0;
if (d <= -1.15e+115)
tmp = t_0;
elseif (d <= -3.5e-56)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (((1.0 / ((2.0 * d) / (D * M))) ^ 2.0) * ((h / l) * 0.5)));
elseif (d <= -5.9e-238)
tmp = t_0;
elseif (d <= 4.6e-303)
tmp = sqrt((h / (l ^ 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
else
tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ^ 0.5)) * (1.0 - (0.125 * ((h / l) * (t_1 * t_1))));
end
tmp_2 = tmp;
end
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[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.15e+115], t$95$0, If[LessEqual[d, -3.5e-56], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[Power[N[(1.0 / N[(N[(2.0 * d), $MachinePrecision] / N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.9e-238], t$95$0, If[LessEqual[d, 4.6e-303], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(h / l), $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
t_1 := M \cdot \frac{D}{d}\\
\mathbf{if}\;d \leq -1.15 \cdot 10^{+115}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -3.5 \cdot 10^{-56}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{2 \cdot d}{D \cdot M}}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\\
\mathbf{elif}\;d \leq -5.9 \cdot 10^{-238}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 4.6 \cdot 10^{-303}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \left(t_1 \cdot t_1\right)\right)\right)\\
\end{array}
\end{array}
if d < -1.15000000000000002e115 or -3.4999999999999998e-56 < d < -5.8999999999999998e-238Initial program 67.6%
Applied egg-rr22.4%
expm1-def27.5%
expm1-log1p56.4%
Simplified56.4%
Taylor expanded in d around -inf 81.8%
mul-1-neg81.8%
distribute-rgt-neg-in81.8%
*-commutative81.8%
Simplified81.8%
if -1.15000000000000002e115 < d < -3.4999999999999998e-56Initial program 91.6%
metadata-eval91.6%
unpow1/291.6%
metadata-eval91.6%
unpow1/291.6%
*-commutative91.6%
associate-*l*91.6%
times-frac91.6%
metadata-eval91.6%
Simplified91.6%
frac-times91.6%
clear-num91.6%
*-commutative91.6%
Applied egg-rr91.6%
if -5.8999999999999998e-238 < d < 4.59999999999999991e-303Initial program 28.2%
Applied egg-rr5.6%
expm1-def5.6%
expm1-log1p22.7%
Simplified22.7%
Taylor expanded in d around -inf 33.8%
mul-1-neg33.8%
distribute-rgt-neg-in33.8%
*-commutative33.8%
Simplified33.8%
Taylor expanded in D around inf 61.9%
*-commutative61.9%
unpow261.9%
unpow261.9%
associate-*l/56.4%
*-commutative56.4%
associate-*l*56.4%
*-commutative56.4%
associate-*r*57.2%
*-commutative57.2%
associate-/l*57.1%
associate-*l/62.5%
Simplified62.5%
if 4.59999999999999991e-303 < d Initial program 66.0%
metadata-eval66.0%
pow1/266.0%
sqrt-div78.6%
Applied egg-rr78.6%
Taylor expanded in M around 0 44.8%
associate-*r/38.0%
*-commutative38.0%
associate-*r/38.0%
associate-*r*41.9%
*-commutative41.9%
*-commutative41.9%
times-frac42.7%
*-commutative42.7%
unpow242.7%
unpow242.7%
unswap-sqr57.2%
unpow257.2%
times-frac66.0%
associate-*r/65.2%
associate-*r/66.0%
Simplified78.7%
Final simplification80.2%
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 (/ h (pow l 3.0))))
(t_1
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0))))))
(t_2 (* M (/ D d)))
(t_3
(*
(sqrt (/ d h))
(* (sqrt (/ d l)) (- 1.0 (* 0.5 (* (* (/ h l) (* t_2 t_2)) 0.25))))))
(t_4 (* M (/ (* D M) (/ d D)))))
(if (<= d -3.35e+112)
t_1
(if (<= d -4.1e-56)
t_3
(if (<= d -5.6e-238)
t_1
(if (<= d -2e-310)
(* t_0 (* 0.125 t_4))
(if (<= d 7.8e-113)
(* t_0 (* t_4 -0.125))
(if (<= d 1.28e+134) t_3 (* d (/ (pow h -0.5) (sqrt l)))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h / pow(l, 3.0)));
double t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
double t_2 = M * (D / d);
double t_3 = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (((h / l) * (t_2 * t_2)) * 0.25))));
double t_4 = M * ((D * M) / (d / D));
double tmp;
if (d <= -3.35e+112) {
tmp = t_1;
} else if (d <= -4.1e-56) {
tmp = t_3;
} else if (d <= -5.6e-238) {
tmp = t_1;
} else if (d <= -2e-310) {
tmp = t_0 * (0.125 * t_4);
} else if (d <= 7.8e-113) {
tmp = t_0 * (t_4 * -0.125);
} else if (d <= 1.28e+134) {
tmp = t_3;
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = sqrt((h / (l ** 3.0d0)))
t_1 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
t_2 = m * (d_1 / d)
t_3 = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * (((h / l) * (t_2 * t_2)) * 0.25d0))))
t_4 = m * ((d_1 * m) / (d / d_1))
if (d <= (-3.35d+112)) then
tmp = t_1
else if (d <= (-4.1d-56)) then
tmp = t_3
else if (d <= (-5.6d-238)) then
tmp = t_1
else if (d <= (-2d-310)) then
tmp = t_0 * (0.125d0 * t_4)
else if (d <= 7.8d-113) then
tmp = t_0 * (t_4 * (-0.125d0))
else if (d <= 1.28d+134) then
tmp = t_3
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h / Math.pow(l, 3.0)));
double t_1 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
double t_2 = M * (D / d);
double t_3 = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (((h / l) * (t_2 * t_2)) * 0.25))));
double t_4 = M * ((D * M) / (d / D));
double tmp;
if (d <= -3.35e+112) {
tmp = t_1;
} else if (d <= -4.1e-56) {
tmp = t_3;
} else if (d <= -5.6e-238) {
tmp = t_1;
} else if (d <= -2e-310) {
tmp = t_0 * (0.125 * t_4);
} else if (d <= 7.8e-113) {
tmp = t_0 * (t_4 * -0.125);
} else if (d <= 1.28e+134) {
tmp = t_3;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h / math.pow(l, 3.0))) t_1 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0)))) t_2 = M * (D / d) t_3 = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (((h / l) * (t_2 * t_2)) * 0.25)))) t_4 = M * ((D * M) / (d / D)) tmp = 0 if d <= -3.35e+112: tmp = t_1 elif d <= -4.1e-56: tmp = t_3 elif d <= -5.6e-238: tmp = t_1 elif d <= -2e-310: tmp = t_0 * (0.125 * t_4) elif d <= 7.8e-113: tmp = t_0 * (t_4 * -0.125) elif d <= 1.28e+134: tmp = t_3 else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h / (l ^ 3.0))) t_1 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0))))) t_2 = Float64(M * Float64(D / d)) t_3 = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(Float64(h / l) * Float64(t_2 * t_2)) * 0.25))))) t_4 = Float64(M * Float64(Float64(D * M) / Float64(d / D))) tmp = 0.0 if (d <= -3.35e+112) tmp = t_1; elseif (d <= -4.1e-56) tmp = t_3; elseif (d <= -5.6e-238) tmp = t_1; elseif (d <= -2e-310) tmp = Float64(t_0 * Float64(0.125 * t_4)); elseif (d <= 7.8e-113) tmp = Float64(t_0 * Float64(t_4 * -0.125)); elseif (d <= 1.28e+134) tmp = t_3; else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h / (l ^ 3.0)));
t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
t_2 = M * (D / d);
t_3 = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (((h / l) * (t_2 * t_2)) * 0.25))));
t_4 = M * ((D * M) / (d / D));
tmp = 0.0;
if (d <= -3.35e+112)
tmp = t_1;
elseif (d <= -4.1e-56)
tmp = t_3;
elseif (d <= -5.6e-238)
tmp = t_1;
elseif (d <= -2e-310)
tmp = t_0 * (0.125 * t_4);
elseif (d <= 7.8e-113)
tmp = t_0 * (t_4 * -0.125);
elseif (d <= 1.28e+134)
tmp = t_3;
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
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[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(N[(h / l), $MachinePrecision] * N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.35e+112], t$95$1, If[LessEqual[d, -4.1e-56], t$95$3, If[LessEqual[d, -5.6e-238], t$95$1, If[LessEqual[d, -2e-310], N[(t$95$0 * N[(0.125 * t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.8e-113], N[(t$95$0 * N[(t$95$4 * -0.125), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.28e+134], t$95$3, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
t_2 := M \cdot \frac{D}{d}\\
t_3 := \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_2 \cdot t_2\right)\right) \cdot 0.25\right)\right)\right)\\
t_4 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -3.35 \cdot 10^{+112}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -4.1 \cdot 10^{-56}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;d \leq -5.6 \cdot 10^{-238}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(0.125 \cdot t_4\right)\\
\mathbf{elif}\;d \leq 7.8 \cdot 10^{-113}:\\
\;\;\;\;t_0 \cdot \left(t_4 \cdot -0.125\right)\\
\mathbf{elif}\;d \leq 1.28 \cdot 10^{+134}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -3.3499999999999999e112 or -4.1000000000000001e-56 < d < -5.60000000000000008e-238Initial program 67.6%
Applied egg-rr22.4%
expm1-def27.5%
expm1-log1p56.4%
Simplified56.4%
Taylor expanded in d around -inf 81.8%
mul-1-neg81.8%
distribute-rgt-neg-in81.8%
*-commutative81.8%
Simplified81.8%
if -3.3499999999999999e112 < d < -4.1000000000000001e-56 or 7.7999999999999997e-113 < d < 1.27999999999999999e134Initial program 87.6%
associate-*l*87.6%
metadata-eval87.6%
unpow1/287.6%
metadata-eval87.6%
unpow1/287.6%
associate-*l*87.6%
metadata-eval87.6%
times-frac87.6%
Simplified87.6%
Taylor expanded in M around 0 65.4%
associate-*r/65.4%
*-commutative65.4%
associate-*r/65.4%
*-commutative65.4%
associate-*r*65.4%
*-commutative65.4%
*-commutative65.4%
times-frac68.7%
*-commutative68.7%
unpow268.7%
unpow268.7%
unswap-sqr85.4%
unpow285.4%
times-frac87.6%
associate-*r/87.6%
associate-*r/87.6%
Simplified87.6%
if -5.60000000000000008e-238 < d < -1.999999999999994e-310Initial program 29.9%
Applied egg-rr5.9%
expm1-def5.9%
expm1-log1p24.0%
Simplified24.0%
Taylor expanded in d around -inf 35.8%
mul-1-neg35.8%
distribute-rgt-neg-in35.8%
*-commutative35.8%
Simplified35.8%
Taylor expanded in D around inf 65.3%
*-commutative65.3%
unpow265.3%
unpow265.3%
associate-*l/59.5%
*-commutative59.5%
associate-*l*59.5%
*-commutative59.5%
associate-*r*60.3%
*-commutative60.3%
associate-/l*60.2%
associate-*l/65.9%
Simplified65.9%
if -1.999999999999994e-310 < d < 7.7999999999999997e-113Initial program 35.1%
metadata-eval35.1%
unpow1/235.1%
metadata-eval35.1%
unpow1/235.1%
*-commutative35.1%
associate-*l*35.1%
times-frac35.2%
metadata-eval35.2%
Simplified35.2%
frac-times35.1%
clear-num35.2%
*-commutative35.2%
Applied egg-rr35.2%
associate-*r*35.2%
*-commutative35.2%
clear-num35.1%
*-commutative35.1%
metadata-eval35.1%
associate-*r/37.4%
metadata-eval37.4%
times-frac37.5%
Applied egg-rr37.5%
Taylor expanded in d around 0 40.1%
associate-*r*40.1%
*-commutative40.1%
unpow240.1%
unpow240.1%
associate-*l/39.9%
associate-*r*42.7%
*-commutative42.7%
associate-/l*48.0%
associate-*l/50.5%
Simplified50.5%
if 1.27999999999999999e134 < d Initial program 66.3%
Taylor expanded in d around inf 79.7%
*-commutative79.7%
*-commutative79.7%
associate-/r*79.7%
Simplified79.7%
sqrt-div90.7%
inv-pow90.7%
Applied egg-rr90.7%
sqr-pow90.7%
rem-sqrt-square90.7%
metadata-eval90.7%
sqr-pow90.8%
fabs-sqr90.8%
sqr-pow90.7%
Simplified90.7%
Final simplification79.4%
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 (/ h (pow l 3.0))))
(t_1
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0))))))
(t_2 (* M (/ D d)))
(t_3 (* (/ h l) (* t_2 t_2)))
(t_4 (* M (/ (* D M) (/ d D)))))
(if (<= d -4.9e+115)
t_1
(if (<= d -3.6e-56)
(* (sqrt (/ d h)) (* (sqrt (/ d l)) (- 1.0 (* 0.5 (* t_3 0.25)))))
(if (<= d -4.5e-238)
t_1
(if (<= d -2e-310)
(* t_0 (* 0.125 t_4))
(if (<= d 7.2e-113)
(* t_0 (* t_4 -0.125))
(if (<= d 2.6e+133)
(*
(- 1.0 (* 0.125 t_3))
(* (pow (/ d l) 0.5) (pow (/ d h) 0.5)))
(* d (/ (pow h -0.5) (sqrt l)))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h / pow(l, 3.0)));
double t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
double t_2 = M * (D / d);
double t_3 = (h / l) * (t_2 * t_2);
double t_4 = M * ((D * M) / (d / D));
double tmp;
if (d <= -4.9e+115) {
tmp = t_1;
} else if (d <= -3.6e-56) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (t_3 * 0.25))));
} else if (d <= -4.5e-238) {
tmp = t_1;
} else if (d <= -2e-310) {
tmp = t_0 * (0.125 * t_4);
} else if (d <= 7.2e-113) {
tmp = t_0 * (t_4 * -0.125);
} else if (d <= 2.6e+133) {
tmp = (1.0 - (0.125 * t_3)) * (pow((d / l), 0.5) * pow((d / h), 0.5));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = sqrt((h / (l ** 3.0d0)))
t_1 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
t_2 = m * (d_1 / d)
t_3 = (h / l) * (t_2 * t_2)
t_4 = m * ((d_1 * m) / (d / d_1))
if (d <= (-4.9d+115)) then
tmp = t_1
else if (d <= (-3.6d-56)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * (t_3 * 0.25d0))))
else if (d <= (-4.5d-238)) then
tmp = t_1
else if (d <= (-2d-310)) then
tmp = t_0 * (0.125d0 * t_4)
else if (d <= 7.2d-113) then
tmp = t_0 * (t_4 * (-0.125d0))
else if (d <= 2.6d+133) then
tmp = (1.0d0 - (0.125d0 * t_3)) * (((d / l) ** 0.5d0) * ((d / h) ** 0.5d0))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h / Math.pow(l, 3.0)));
double t_1 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
double t_2 = M * (D / d);
double t_3 = (h / l) * (t_2 * t_2);
double t_4 = M * ((D * M) / (d / D));
double tmp;
if (d <= -4.9e+115) {
tmp = t_1;
} else if (d <= -3.6e-56) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (t_3 * 0.25))));
} else if (d <= -4.5e-238) {
tmp = t_1;
} else if (d <= -2e-310) {
tmp = t_0 * (0.125 * t_4);
} else if (d <= 7.2e-113) {
tmp = t_0 * (t_4 * -0.125);
} else if (d <= 2.6e+133) {
tmp = (1.0 - (0.125 * t_3)) * (Math.pow((d / l), 0.5) * Math.pow((d / h), 0.5));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h / math.pow(l, 3.0))) t_1 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0)))) t_2 = M * (D / d) t_3 = (h / l) * (t_2 * t_2) t_4 = M * ((D * M) / (d / D)) tmp = 0 if d <= -4.9e+115: tmp = t_1 elif d <= -3.6e-56: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (t_3 * 0.25)))) elif d <= -4.5e-238: tmp = t_1 elif d <= -2e-310: tmp = t_0 * (0.125 * t_4) elif d <= 7.2e-113: tmp = t_0 * (t_4 * -0.125) elif d <= 2.6e+133: tmp = (1.0 - (0.125 * t_3)) * (math.pow((d / l), 0.5) * math.pow((d / h), 0.5)) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h / (l ^ 3.0))) t_1 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0))))) t_2 = Float64(M * Float64(D / d)) t_3 = Float64(Float64(h / l) * Float64(t_2 * t_2)) t_4 = Float64(M * Float64(Float64(D * M) / Float64(d / D))) tmp = 0.0 if (d <= -4.9e+115) tmp = t_1; elseif (d <= -3.6e-56) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(t_3 * 0.25))))); elseif (d <= -4.5e-238) tmp = t_1; elseif (d <= -2e-310) tmp = Float64(t_0 * Float64(0.125 * t_4)); elseif (d <= 7.2e-113) tmp = Float64(t_0 * Float64(t_4 * -0.125)); elseif (d <= 2.6e+133) tmp = Float64(Float64(1.0 - Float64(0.125 * t_3)) * Float64((Float64(d / l) ^ 0.5) * (Float64(d / h) ^ 0.5))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h / (l ^ 3.0)));
t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
t_2 = M * (D / d);
t_3 = (h / l) * (t_2 * t_2);
t_4 = M * ((D * M) / (d / D));
tmp = 0.0;
if (d <= -4.9e+115)
tmp = t_1;
elseif (d <= -3.6e-56)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (t_3 * 0.25))));
elseif (d <= -4.5e-238)
tmp = t_1;
elseif (d <= -2e-310)
tmp = t_0 * (0.125 * t_4);
elseif (d <= 7.2e-113)
tmp = t_0 * (t_4 * -0.125);
elseif (d <= 2.6e+133)
tmp = (1.0 - (0.125 * t_3)) * (((d / l) ^ 0.5) * ((d / h) ^ 0.5));
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
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[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(h / l), $MachinePrecision] * N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.9e+115], t$95$1, If[LessEqual[d, -3.6e-56], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(t$95$3 * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.5e-238], t$95$1, If[LessEqual[d, -2e-310], N[(t$95$0 * N[(0.125 * t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.2e-113], N[(t$95$0 * N[(t$95$4 * -0.125), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.6e+133], N[(N[(1.0 - N[(0.125 * t$95$3), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
t_2 := M \cdot \frac{D}{d}\\
t_3 := \frac{h}{\ell} \cdot \left(t_2 \cdot t_2\right)\\
t_4 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -4.9 \cdot 10^{+115}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -3.6 \cdot 10^{-56}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(t_3 \cdot 0.25\right)\right)\right)\\
\mathbf{elif}\;d \leq -4.5 \cdot 10^{-238}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(0.125 \cdot t_4\right)\\
\mathbf{elif}\;d \leq 7.2 \cdot 10^{-113}:\\
\;\;\;\;t_0 \cdot \left(t_4 \cdot -0.125\right)\\
\mathbf{elif}\;d \leq 2.6 \cdot 10^{+133}:\\
\;\;\;\;\left(1 - 0.125 \cdot t_3\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{0.5} \cdot {\left(\frac{d}{h}\right)}^{0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -4.89999999999999964e115 or -3.59999999999999978e-56 < d < -4.49999999999999996e-238Initial program 67.6%
Applied egg-rr22.4%
expm1-def27.5%
expm1-log1p56.4%
Simplified56.4%
Taylor expanded in d around -inf 81.8%
mul-1-neg81.8%
distribute-rgt-neg-in81.8%
*-commutative81.8%
Simplified81.8%
if -4.89999999999999964e115 < d < -3.59999999999999978e-56Initial program 91.6%
associate-*l*91.6%
metadata-eval91.6%
unpow1/291.6%
metadata-eval91.6%
unpow1/291.6%
associate-*l*91.6%
metadata-eval91.6%
times-frac91.6%
Simplified91.6%
Taylor expanded in M around 0 80.1%
associate-*r/80.1%
*-commutative80.1%
associate-*r/80.1%
*-commutative80.1%
associate-*r*77.3%
*-commutative77.3%
*-commutative77.3%
times-frac80.2%
*-commutative80.2%
unpow280.2%
unpow280.2%
unswap-sqr88.7%
unpow288.7%
times-frac91.6%
associate-*r/91.6%
associate-*r/91.6%
Simplified91.6%
if -4.49999999999999996e-238 < d < -1.999999999999994e-310Initial program 29.9%
Applied egg-rr5.9%
expm1-def5.9%
expm1-log1p24.0%
Simplified24.0%
Taylor expanded in d around -inf 35.8%
mul-1-neg35.8%
distribute-rgt-neg-in35.8%
*-commutative35.8%
Simplified35.8%
Taylor expanded in D around inf 65.3%
*-commutative65.3%
unpow265.3%
unpow265.3%
associate-*l/59.5%
*-commutative59.5%
associate-*l*59.5%
*-commutative59.5%
associate-*r*60.3%
*-commutative60.3%
associate-/l*60.2%
associate-*l/65.9%
Simplified65.9%
if -1.999999999999994e-310 < d < 7.1999999999999995e-113Initial program 35.1%
metadata-eval35.1%
unpow1/235.1%
metadata-eval35.1%
unpow1/235.1%
*-commutative35.1%
associate-*l*35.1%
times-frac35.2%
metadata-eval35.2%
Simplified35.2%
frac-times35.1%
clear-num35.2%
*-commutative35.2%
Applied egg-rr35.2%
associate-*r*35.2%
*-commutative35.2%
clear-num35.1%
*-commutative35.1%
metadata-eval35.1%
associate-*r/37.4%
metadata-eval37.4%
times-frac37.5%
Applied egg-rr37.5%
Taylor expanded in d around 0 40.1%
associate-*r*40.1%
*-commutative40.1%
unpow240.1%
unpow240.1%
associate-*l/39.9%
associate-*r*42.7%
*-commutative42.7%
associate-/l*48.0%
associate-*l/50.5%
Simplified50.5%
if 7.1999999999999995e-113 < d < 2.5999999999999998e133Initial program 85.2%
Taylor expanded in M around 0 56.4%
associate-*r/56.4%
*-commutative56.4%
associate-*r/56.4%
associate-*r*58.2%
*-commutative58.2%
*-commutative58.2%
times-frac61.7%
*-commutative61.7%
unpow261.7%
unpow261.7%
unswap-sqr83.5%
unpow283.5%
times-frac85.2%
associate-*r/85.2%
associate-*r/85.2%
Simplified85.2%
if 2.5999999999999998e133 < d Initial program 66.3%
Taylor expanded in d around inf 79.7%
*-commutative79.7%
*-commutative79.7%
associate-/r*79.7%
Simplified79.7%
sqrt-div90.7%
inv-pow90.7%
Applied egg-rr90.7%
sqr-pow90.7%
rem-sqrt-square90.7%
metadata-eval90.7%
sqr-pow90.8%
fabs-sqr90.8%
sqr-pow90.7%
Simplified90.7%
Final simplification79.4%
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 (/ h (pow l 3.0))))
(t_1 (* 0.25 (* (/ D d) (/ D d))))
(t_2 (sqrt (/ 1.0 (* h l))))
(t_3 (* d t_2))
(t_4 (* M (/ (* D M) (/ d D)))))
(if (<= d -3.1e+233)
(* t_2 (- d))
(if (<= d -2.3e+110)
(* t_3 (- -1.0 (* -0.5 (* t_1 (/ (* M (* h M)) l)))))
(if (<= d -8.2e-63)
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* h (/ (* 0.5 (pow (* (/ M d) (/ D 2.0)) 2.0)) l))))
(if (<= d -1.85e-200)
(* t_3 (- -1.0 (* -0.5 (* t_1 (/ (* M M) (/ l h))))))
(if (<= d -2e-310)
(* t_0 (* 0.125 t_4))
(if (<= d 1.4e-112)
(* t_0 (* t_4 -0.125))
(* d (/ (pow h -0.5) (sqrt l)))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h / pow(l, 3.0)));
double t_1 = 0.25 * ((D / d) * (D / d));
double t_2 = sqrt((1.0 / (h * l)));
double t_3 = d * t_2;
double t_4 = M * ((D * M) / (d / D));
double tmp;
if (d <= -3.1e+233) {
tmp = t_2 * -d;
} else if (d <= -2.3e+110) {
tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * (h * M)) / l))));
} else if (d <= -8.2e-63) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (h * ((0.5 * pow(((M / d) * (D / 2.0)), 2.0)) / l)));
} else if (d <= -1.85e-200) {
tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * M) / (l / h)))));
} else if (d <= -2e-310) {
tmp = t_0 * (0.125 * t_4);
} else if (d <= 1.4e-112) {
tmp = t_0 * (t_4 * -0.125);
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = sqrt((h / (l ** 3.0d0)))
t_1 = 0.25d0 * ((d_1 / d) * (d_1 / d))
t_2 = sqrt((1.0d0 / (h * l)))
t_3 = d * t_2
t_4 = m * ((d_1 * m) / (d / d_1))
if (d <= (-3.1d+233)) then
tmp = t_2 * -d
else if (d <= (-2.3d+110)) then
tmp = t_3 * ((-1.0d0) - ((-0.5d0) * (t_1 * ((m * (h * m)) / l))))
else if (d <= (-8.2d-63)) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (h * ((0.5d0 * (((m / d) * (d_1 / 2.0d0)) ** 2.0d0)) / l)))
else if (d <= (-1.85d-200)) then
tmp = t_3 * ((-1.0d0) - ((-0.5d0) * (t_1 * ((m * m) / (l / h)))))
else if (d <= (-2d-310)) then
tmp = t_0 * (0.125d0 * t_4)
else if (d <= 1.4d-112) then
tmp = t_0 * (t_4 * (-0.125d0))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h / Math.pow(l, 3.0)));
double t_1 = 0.25 * ((D / d) * (D / d));
double t_2 = Math.sqrt((1.0 / (h * l)));
double t_3 = d * t_2;
double t_4 = M * ((D * M) / (d / D));
double tmp;
if (d <= -3.1e+233) {
tmp = t_2 * -d;
} else if (d <= -2.3e+110) {
tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * (h * M)) / l))));
} else if (d <= -8.2e-63) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (h * ((0.5 * Math.pow(((M / d) * (D / 2.0)), 2.0)) / l)));
} else if (d <= -1.85e-200) {
tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * M) / (l / h)))));
} else if (d <= -2e-310) {
tmp = t_0 * (0.125 * t_4);
} else if (d <= 1.4e-112) {
tmp = t_0 * (t_4 * -0.125);
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h / math.pow(l, 3.0))) t_1 = 0.25 * ((D / d) * (D / d)) t_2 = math.sqrt((1.0 / (h * l))) t_3 = d * t_2 t_4 = M * ((D * M) / (d / D)) tmp = 0 if d <= -3.1e+233: tmp = t_2 * -d elif d <= -2.3e+110: tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * (h * M)) / l)))) elif d <= -8.2e-63: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (h * ((0.5 * math.pow(((M / d) * (D / 2.0)), 2.0)) / l))) elif d <= -1.85e-200: tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * M) / (l / h))))) elif d <= -2e-310: tmp = t_0 * (0.125 * t_4) elif d <= 1.4e-112: tmp = t_0 * (t_4 * -0.125) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h / (l ^ 3.0))) t_1 = Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) t_2 = sqrt(Float64(1.0 / Float64(h * l))) t_3 = Float64(d * t_2) t_4 = Float64(M * Float64(Float64(D * M) / Float64(d / D))) tmp = 0.0 if (d <= -3.1e+233) tmp = Float64(t_2 * Float64(-d)); elseif (d <= -2.3e+110) tmp = Float64(t_3 * Float64(-1.0 - Float64(-0.5 * Float64(t_1 * Float64(Float64(M * Float64(h * M)) / l))))); elseif (d <= -8.2e-63) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(h * Float64(Float64(0.5 * (Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0)) / l)))); elseif (d <= -1.85e-200) tmp = Float64(t_3 * Float64(-1.0 - Float64(-0.5 * Float64(t_1 * Float64(Float64(M * M) / Float64(l / h)))))); elseif (d <= -2e-310) tmp = Float64(t_0 * Float64(0.125 * t_4)); elseif (d <= 1.4e-112) tmp = Float64(t_0 * Float64(t_4 * -0.125)); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h / (l ^ 3.0)));
t_1 = 0.25 * ((D / d) * (D / d));
t_2 = sqrt((1.0 / (h * l)));
t_3 = d * t_2;
t_4 = M * ((D * M) / (d / D));
tmp = 0.0;
if (d <= -3.1e+233)
tmp = t_2 * -d;
elseif (d <= -2.3e+110)
tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * (h * M)) / l))));
elseif (d <= -8.2e-63)
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (h * ((0.5 * (((M / d) * (D / 2.0)) ^ 2.0)) / l)));
elseif (d <= -1.85e-200)
tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * M) / (l / h)))));
elseif (d <= -2e-310)
tmp = t_0 * (0.125 * t_4);
elseif (d <= 1.4e-112)
tmp = t_0 * (t_4 * -0.125);
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
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[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(d * t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.1e+233], N[(t$95$2 * (-d)), $MachinePrecision], If[LessEqual[d, -2.3e+110], N[(t$95$3 * N[(-1.0 - N[(-0.5 * N[(t$95$1 * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -8.2e-63], 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[(M / d), $MachinePrecision] * N[(D / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.85e-200], N[(t$95$3 * N[(-1.0 - N[(-0.5 * N[(t$95$1 * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], N[(t$95$0 * N[(0.125 * t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.4e-112], N[(t$95$0 * N[(t$95$4 * -0.125), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := 0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\\
t_2 := \sqrt{\frac{1}{h \cdot \ell}}\\
t_3 := d \cdot t_2\\
t_4 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -3.1 \cdot 10^{+233}:\\
\;\;\;\;t_2 \cdot \left(-d\right)\\
\mathbf{elif}\;d \leq -2.3 \cdot 10^{+110}:\\
\;\;\;\;t_3 \cdot \left(-1 - -0.5 \cdot \left(t_1 \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq -8.2 \cdot 10^{-63}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - h \cdot \frac{0.5 \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;d \leq -1.85 \cdot 10^{-200}:\\
\;\;\;\;t_3 \cdot \left(-1 - -0.5 \cdot \left(t_1 \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(0.125 \cdot t_4\right)\\
\mathbf{elif}\;d \leq 1.4 \cdot 10^{-112}:\\
\;\;\;\;t_0 \cdot \left(t_4 \cdot -0.125\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -3.10000000000000016e233Initial program 66.8%
Applied egg-rr48.6%
expm1-def48.6%
expm1-log1p66.8%
Simplified66.8%
Taylor expanded in d around -inf 88.2%
mul-1-neg88.2%
distribute-rgt-neg-in88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in D around 0 82.3%
associate-/l/82.2%
associate-*r*82.2%
*-commutative82.2%
associate-/l/82.3%
*-commutative82.3%
mul-1-neg82.3%
Simplified82.3%
if -3.10000000000000016e233 < d < -2.3e110Initial program 63.7%
Applied egg-rr18.6%
expm1-def18.6%
expm1-log1p53.5%
Simplified53.5%
Taylor expanded in d around -inf 78.5%
mul-1-neg78.5%
distribute-rgt-neg-in78.5%
*-commutative78.5%
Simplified78.5%
Taylor expanded in h around 0 55.3%
times-frac56.2%
*-commutative56.2%
associate-*r*56.2%
unpow256.2%
unpow256.2%
times-frac84.0%
associate-/l*73.0%
unpow273.0%
Simplified73.0%
Taylor expanded in M around 0 84.0%
unpow284.0%
associate-*l*94.0%
Simplified94.0%
if -2.3e110 < d < -8.1999999999999995e-63Initial program 89.6%
metadata-eval89.6%
unpow1/289.6%
metadata-eval89.6%
unpow1/289.6%
*-commutative89.6%
associate-*l*89.6%
times-frac89.6%
metadata-eval89.6%
Simplified89.6%
frac-times89.6%
clear-num89.5%
*-commutative89.5%
Applied egg-rr89.5%
associate-*r*89.5%
*-commutative89.5%
clear-num89.6%
*-commutative89.6%
metadata-eval89.6%
associate-*r/89.6%
metadata-eval89.6%
times-frac89.6%
Applied egg-rr89.6%
frac-times89.6%
associate-/r*89.6%
Applied egg-rr89.6%
pow189.6%
sqrt-unprod76.8%
associate-/l*76.8%
associate-/l/76.8%
Applied egg-rr76.8%
unpow176.8%
associate-/r/76.8%
times-frac76.8%
Simplified76.8%
if -8.1999999999999995e-63 < d < -1.85000000000000005e-200Initial program 74.3%
Applied egg-rr15.4%
expm1-def23.0%
expm1-log1p56.0%
Simplified56.0%
Taylor expanded in d around -inf 80.9%
mul-1-neg80.9%
distribute-rgt-neg-in80.9%
*-commutative80.9%
Simplified80.9%
Taylor expanded in h around 0 65.0%
times-frac61.1%
*-commutative61.1%
associate-*r*61.1%
unpow261.1%
unpow261.1%
times-frac73.2%
associate-/l*77.0%
unpow277.0%
Simplified77.0%
if -1.85000000000000005e-200 < d < -1.999999999999994e-310Initial program 42.8%
Applied egg-rr7.9%
expm1-def7.9%
expm1-log1p32.3%
Simplified32.3%
Taylor expanded in d around -inf 55.6%
mul-1-neg55.6%
distribute-rgt-neg-in55.6%
*-commutative55.6%
Simplified55.6%
Taylor expanded in D around inf 69.1%
*-commutative69.1%
unpow269.1%
unpow269.1%
associate-*l/62.1%
*-commutative62.1%
associate-*l*62.1%
*-commutative62.1%
associate-*r*63.1%
*-commutative63.1%
associate-/l*63.1%
associate-*l/66.6%
Simplified66.6%
if -1.999999999999994e-310 < d < 1.40000000000000011e-112Initial program 35.1%
metadata-eval35.1%
unpow1/235.1%
metadata-eval35.1%
unpow1/235.1%
*-commutative35.1%
associate-*l*35.1%
times-frac35.2%
metadata-eval35.2%
Simplified35.2%
frac-times35.1%
clear-num35.2%
*-commutative35.2%
Applied egg-rr35.2%
associate-*r*35.2%
*-commutative35.2%
clear-num35.1%
*-commutative35.1%
metadata-eval35.1%
associate-*r/37.4%
metadata-eval37.4%
times-frac37.5%
Applied egg-rr37.5%
Taylor expanded in d around 0 40.1%
associate-*r*40.1%
*-commutative40.1%
unpow240.1%
unpow240.1%
associate-*l/39.9%
associate-*r*42.7%
*-commutative42.7%
associate-/l*48.0%
associate-*l/50.5%
Simplified50.5%
if 1.40000000000000011e-112 < d Initial program 78.1%
Taylor expanded in d around inf 60.1%
*-commutative60.1%
*-commutative60.1%
associate-/r*60.1%
Simplified60.1%
sqrt-div72.4%
inv-pow72.4%
Applied egg-rr72.4%
sqr-pow72.5%
rem-sqrt-square72.5%
metadata-eval72.5%
sqr-pow72.3%
fabs-sqr72.3%
sqr-pow72.5%
Simplified72.5%
Final simplification71.8%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -9e+119)
(* (sqrt (/ (/ 1.0 l) h)) (- d))
(if (<= l -7.8e-131)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M (* h M)) l)))))
(if (<= l 4.8e-39)
(*
(+ 1.0 (* -0.5 (/ (* h (pow (* (/ D d) (/ M 2.0)) 2.0)) l)))
(sqrt (* (/ d h) (/ d l))))
(if (<= l 6.8e+58)
(* d (/ 1.0 (sqrt (* h l))))
(if (<= l 4e+96)
(* -0.125 (/ (* (sqrt (/ h (pow l 3.0))) (* D (* D (* M M)))) d))
(* d (/ (pow h -0.5) (sqrt l)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -9e+119) {
tmp = sqrt(((1.0 / l) / h)) * -d;
} else if (l <= -7.8e-131) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
} else if (l <= 4.8e-39) {
tmp = (1.0 + (-0.5 * ((h * pow(((D / d) * (M / 2.0)), 2.0)) / l))) * sqrt(((d / h) * (d / l)));
} else if (l <= 6.8e+58) {
tmp = d * (1.0 / sqrt((h * l)));
} else if (l <= 4e+96) {
tmp = -0.125 * ((sqrt((h / pow(l, 3.0))) * (D * (D * (M * M)))) / d);
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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 <= (-9d+119)) then
tmp = sqrt(((1.0d0 / l) / h)) * -d
else if (l <= (-7.8d-131)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * (h * m)) / l))))
else if (l <= 4.8d-39) then
tmp = (1.0d0 + ((-0.5d0) * ((h * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0)) / l))) * sqrt(((d / h) * (d / l)))
else if (l <= 6.8d+58) then
tmp = d * (1.0d0 / sqrt((h * l)))
else if (l <= 4d+96) then
tmp = (-0.125d0) * ((sqrt((h / (l ** 3.0d0))) * (d_1 * (d_1 * (m * m)))) / d)
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -9e+119) {
tmp = Math.sqrt(((1.0 / l) / h)) * -d;
} else if (l <= -7.8e-131) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
} else if (l <= 4.8e-39) {
tmp = (1.0 + (-0.5 * ((h * Math.pow(((D / d) * (M / 2.0)), 2.0)) / l))) * Math.sqrt(((d / h) * (d / l)));
} else if (l <= 6.8e+58) {
tmp = d * (1.0 / Math.sqrt((h * l)));
} else if (l <= 4e+96) {
tmp = -0.125 * ((Math.sqrt((h / Math.pow(l, 3.0))) * (D * (D * (M * M)))) / d);
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -9e+119: tmp = math.sqrt(((1.0 / l) / h)) * -d elif l <= -7.8e-131: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l)))) elif l <= 4.8e-39: tmp = (1.0 + (-0.5 * ((h * math.pow(((D / d) * (M / 2.0)), 2.0)) / l))) * math.sqrt(((d / h) * (d / l))) elif l <= 6.8e+58: tmp = d * (1.0 / math.sqrt((h * l))) elif l <= 4e+96: tmp = -0.125 * ((math.sqrt((h / math.pow(l, 3.0))) * (D * (D * (M * M)))) / d) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -9e+119) tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * Float64(-d)); elseif (l <= -7.8e-131) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * Float64(h * M)) / l))))); elseif (l <= 4.8e-39) tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)) / l))) * sqrt(Float64(Float64(d / h) * Float64(d / l)))); elseif (l <= 6.8e+58) tmp = Float64(d * Float64(1.0 / sqrt(Float64(h * l)))); elseif (l <= 4e+96) tmp = Float64(-0.125 * Float64(Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(D * Float64(D * Float64(M * M)))) / d)); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -9e+119)
tmp = sqrt(((1.0 / l) / h)) * -d;
elseif (l <= -7.8e-131)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
elseif (l <= 4.8e-39)
tmp = (1.0 + (-0.5 * ((h * (((D / d) * (M / 2.0)) ^ 2.0)) / l))) * sqrt(((d / h) * (d / l)));
elseif (l <= 6.8e+58)
tmp = d * (1.0 / sqrt((h * l)));
elseif (l <= 4e+96)
tmp = -0.125 * ((sqrt((h / (l ^ 3.0))) * (D * (D * (M * M)))) / d);
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -9e+119], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[l, -7.8e-131], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.8e-39], N[(N[(1.0 + N[(-0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.8e+58], N[(d * N[(1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4e+96], N[(-0.125 * N[(N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9 \cdot 10^{+119}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\
\mathbf{elif}\;\ell \leq -7.8 \cdot 10^{-131}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{-39}:\\
\;\;\;\;\left(1 + -0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 6.8 \cdot 10^{+58}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 4 \cdot 10^{+96}:\\
\;\;\;\;-0.125 \cdot \frac{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(D \cdot \left(D \cdot \left(M \cdot M\right)\right)\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -9.00000000000000039e119Initial program 55.2%
Applied egg-rr28.7%
expm1-def46.7%
expm1-log1p50.5%
Simplified50.5%
Taylor expanded in d around -inf 64.0%
mul-1-neg64.0%
distribute-rgt-neg-in64.0%
*-commutative64.0%
Simplified64.0%
Taylor expanded in h around 0 41.7%
times-frac38.9%
*-commutative38.9%
associate-*r*38.9%
unpow238.9%
unpow238.9%
times-frac47.3%
associate-/l*47.3%
unpow247.3%
Simplified47.3%
Taylor expanded in D around 0 67.4%
associate-/l/67.4%
unpow-167.4%
associate-*r*67.4%
*-commutative67.4%
mul-1-neg67.4%
unpow-167.4%
associate-/l/67.4%
associate-/r*67.4%
Simplified67.4%
if -9.00000000000000039e119 < l < -7.80000000000000039e-131Initial program 71.0%
Applied egg-rr14.8%
expm1-def21.3%
expm1-log1p49.5%
Simplified49.5%
Taylor expanded in d around -inf 76.9%
mul-1-neg76.9%
distribute-rgt-neg-in76.9%
*-commutative76.9%
Simplified76.9%
Taylor expanded in h around 0 56.5%
times-frac55.0%
*-commutative55.0%
associate-*r*55.0%
unpow255.0%
unpow255.0%
times-frac63.5%
associate-/l*66.8%
unpow266.8%
Simplified66.8%
Taylor expanded in M around 0 63.5%
unpow263.5%
associate-*l*68.3%
Simplified68.3%
if -7.80000000000000039e-131 < l < 4.80000000000000031e-39Initial program 76.7%
Applied egg-rr24.5%
expm1-def29.2%
expm1-log1p68.6%
Simplified68.6%
associate-*l/72.4%
associate-*r/72.4%
*-commutative72.4%
times-frac71.2%
Applied egg-rr71.2%
if 4.80000000000000031e-39 < l < 6.8000000000000001e58Initial program 70.5%
Taylor expanded in d around inf 62.6%
sqrt-div62.8%
*-commutative62.8%
metadata-eval62.8%
Applied egg-rr62.8%
if 6.8000000000000001e58 < l < 4.0000000000000002e96Initial program 30.9%
metadata-eval30.9%
unpow1/230.9%
metadata-eval30.9%
unpow1/230.9%
*-commutative30.9%
associate-*l*30.9%
times-frac31.1%
metadata-eval31.1%
Simplified31.1%
frac-times30.9%
clear-num30.9%
*-commutative30.9%
Applied egg-rr30.9%
associate-*r*30.9%
*-commutative30.9%
clear-num30.9%
*-commutative30.9%
metadata-eval30.9%
associate-*r/30.9%
metadata-eval30.9%
times-frac31.1%
Applied egg-rr31.1%
frac-times30.9%
associate-/r*30.9%
Applied egg-rr30.9%
Taylor expanded in d around 0 72.0%
associate-*l/72.2%
unpow272.2%
unpow272.2%
associate-*l*72.6%
Simplified72.6%
if 4.0000000000000002e96 < l Initial program 61.4%
Taylor expanded in d around inf 60.7%
*-commutative60.7%
*-commutative60.7%
associate-/r*60.7%
Simplified60.7%
sqrt-div75.5%
inv-pow75.5%
Applied egg-rr75.5%
sqr-pow75.6%
rem-sqrt-square75.6%
metadata-eval75.6%
sqr-pow75.4%
fabs-sqr75.4%
sqr-pow75.6%
Simplified75.6%
Final simplification70.5%
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 (/ h (pow l 3.0)))) (t_1 (* M (/ (* D M) (/ d D)))))
(if (<= d -5.2e-238)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0)))))
(if (<= d -2e-310)
(* t_0 (* 0.125 t_1))
(if (<= d 1.3e-111)
(* t_0 (* t_1 -0.125))
(* d (/ (pow h -0.5) (sqrt l))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h / pow(l, 3.0)));
double t_1 = M * ((D * M) / (d / D));
double tmp;
if (d <= -5.2e-238) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
} else if (d <= -2e-310) {
tmp = t_0 * (0.125 * t_1);
} else if (d <= 1.3e-111) {
tmp = t_0 * (t_1 * -0.125);
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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((h / (l ** 3.0d0)))
t_1 = m * ((d_1 * m) / (d / d_1))
if (d <= (-5.2d-238)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
else if (d <= (-2d-310)) then
tmp = t_0 * (0.125d0 * t_1)
else if (d <= 1.3d-111) then
tmp = t_0 * (t_1 * (-0.125d0))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h / Math.pow(l, 3.0)));
double t_1 = M * ((D * M) / (d / D));
double tmp;
if (d <= -5.2e-238) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
} else if (d <= -2e-310) {
tmp = t_0 * (0.125 * t_1);
} else if (d <= 1.3e-111) {
tmp = t_0 * (t_1 * -0.125);
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h / math.pow(l, 3.0))) t_1 = M * ((D * M) / (d / D)) tmp = 0 if d <= -5.2e-238: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0)))) elif d <= -2e-310: tmp = t_0 * (0.125 * t_1) elif d <= 1.3e-111: tmp = t_0 * (t_1 * -0.125) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h / (l ^ 3.0))) t_1 = Float64(M * Float64(Float64(D * M) / Float64(d / D))) tmp = 0.0 if (d <= -5.2e-238) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0))))); elseif (d <= -2e-310) tmp = Float64(t_0 * Float64(0.125 * t_1)); elseif (d <= 1.3e-111) tmp = Float64(t_0 * Float64(t_1 * -0.125)); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h / (l ^ 3.0)));
t_1 = M * ((D * M) / (d / D));
tmp = 0.0;
if (d <= -5.2e-238)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
elseif (d <= -2e-310)
tmp = t_0 * (0.125 * t_1);
elseif (d <= 1.3e-111)
tmp = t_0 * (t_1 * -0.125);
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
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[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5.2e-238], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], N[(t$95$0 * N[(0.125 * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.3e-111], N[(t$95$0 * N[(t$95$1 * -0.125), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -5.2 \cdot 10^{-238}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(0.125 \cdot t_1\right)\\
\mathbf{elif}\;d \leq 1.3 \cdot 10^{-111}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot -0.125\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -5.2000000000000002e-238Initial program 75.2%
Applied egg-rr24.3%
expm1-def34.6%
expm1-log1p63.1%
Simplified63.1%
Taylor expanded in d around -inf 79.6%
mul-1-neg79.6%
distribute-rgt-neg-in79.6%
*-commutative79.6%
Simplified79.6%
if -5.2000000000000002e-238 < d < -1.999999999999994e-310Initial program 29.9%
Applied egg-rr5.9%
expm1-def5.9%
expm1-log1p24.0%
Simplified24.0%
Taylor expanded in d around -inf 35.8%
mul-1-neg35.8%
distribute-rgt-neg-in35.8%
*-commutative35.8%
Simplified35.8%
Taylor expanded in D around inf 65.3%
*-commutative65.3%
unpow265.3%
unpow265.3%
associate-*l/59.5%
*-commutative59.5%
associate-*l*59.5%
*-commutative59.5%
associate-*r*60.3%
*-commutative60.3%
associate-/l*60.2%
associate-*l/65.9%
Simplified65.9%
if -1.999999999999994e-310 < d < 1.29999999999999991e-111Initial program 35.1%
metadata-eval35.1%
unpow1/235.1%
metadata-eval35.1%
unpow1/235.1%
*-commutative35.1%
associate-*l*35.1%
times-frac35.2%
metadata-eval35.2%
Simplified35.2%
frac-times35.1%
clear-num35.2%
*-commutative35.2%
Applied egg-rr35.2%
associate-*r*35.2%
*-commutative35.2%
clear-num35.1%
*-commutative35.1%
metadata-eval35.1%
associate-*r/37.4%
metadata-eval37.4%
times-frac37.5%
Applied egg-rr37.5%
Taylor expanded in d around 0 40.1%
associate-*r*40.1%
*-commutative40.1%
unpow240.1%
unpow240.1%
associate-*l/39.9%
associate-*r*42.7%
*-commutative42.7%
associate-/l*48.0%
associate-*l/50.5%
Simplified50.5%
if 1.29999999999999991e-111 < d Initial program 78.1%
Taylor expanded in d around inf 60.1%
*-commutative60.1%
*-commutative60.1%
associate-/r*60.1%
Simplified60.1%
sqrt-div72.4%
inv-pow72.4%
Applied egg-rr72.4%
sqr-pow72.5%
rem-sqrt-square72.5%
metadata-eval72.5%
sqr-pow72.3%
fabs-sqr72.3%
sqr-pow72.5%
Simplified72.5%
Final simplification71.8%
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 (/ h (pow l 3.0)))) (t_1 (sqrt (/ 1.0 (* h l)))))
(if (<= d -2.85e+236)
(* t_1 (- d))
(if (<= d -1.9e-193)
(*
(* d t_1)
(- -1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M (* h M)) l)))))
(if (<= d -3e-301)
(* M (* t_0 (/ (* D D) (/ (/ d M) 0.125))))
(if (<= d 1.4e-112)
(* -0.125 (/ (* t_0 (* D (* D (* M M)))) d))
(* d (/ (pow h -0.5) (sqrt l)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h / pow(l, 3.0)));
double t_1 = sqrt((1.0 / (h * l)));
double tmp;
if (d <= -2.85e+236) {
tmp = t_1 * -d;
} else if (d <= -1.9e-193) {
tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
} else if (d <= -3e-301) {
tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125)));
} else if (d <= 1.4e-112) {
tmp = -0.125 * ((t_0 * (D * (D * (M * M)))) / d);
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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((h / (l ** 3.0d0)))
t_1 = sqrt((1.0d0 / (h * l)))
if (d <= (-2.85d+236)) then
tmp = t_1 * -d
else if (d <= (-1.9d-193)) then
tmp = (d * t_1) * ((-1.0d0) - ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * (h * m)) / l))))
else if (d <= (-3d-301)) then
tmp = m * (t_0 * ((d_1 * d_1) / ((d / m) / 0.125d0)))
else if (d <= 1.4d-112) then
tmp = (-0.125d0) * ((t_0 * (d_1 * (d_1 * (m * m)))) / d)
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h / Math.pow(l, 3.0)));
double t_1 = Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -2.85e+236) {
tmp = t_1 * -d;
} else if (d <= -1.9e-193) {
tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
} else if (d <= -3e-301) {
tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125)));
} else if (d <= 1.4e-112) {
tmp = -0.125 * ((t_0 * (D * (D * (M * M)))) / d);
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h / math.pow(l, 3.0))) t_1 = math.sqrt((1.0 / (h * l))) tmp = 0 if d <= -2.85e+236: tmp = t_1 * -d elif d <= -1.9e-193: tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l)))) elif d <= -3e-301: tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125))) elif d <= 1.4e-112: tmp = -0.125 * ((t_0 * (D * (D * (M * M)))) / d) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h / (l ^ 3.0))) t_1 = sqrt(Float64(1.0 / Float64(h * l))) tmp = 0.0 if (d <= -2.85e+236) tmp = Float64(t_1 * Float64(-d)); elseif (d <= -1.9e-193) tmp = Float64(Float64(d * t_1) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * Float64(h * M)) / l))))); elseif (d <= -3e-301) tmp = Float64(M * Float64(t_0 * Float64(Float64(D * D) / Float64(Float64(d / M) / 0.125)))); elseif (d <= 1.4e-112) tmp = Float64(-0.125 * Float64(Float64(t_0 * Float64(D * Float64(D * Float64(M * M)))) / d)); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h / (l ^ 3.0)));
t_1 = sqrt((1.0 / (h * l)));
tmp = 0.0;
if (d <= -2.85e+236)
tmp = t_1 * -d;
elseif (d <= -1.9e-193)
tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
elseif (d <= -3e-301)
tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125)));
elseif (d <= 1.4e-112)
tmp = -0.125 * ((t_0 * (D * (D * (M * M)))) / d);
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
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[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2.85e+236], N[(t$95$1 * (-d)), $MachinePrecision], If[LessEqual[d, -1.9e-193], N[(N[(d * t$95$1), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3e-301], N[(M * N[(t$95$0 * N[(N[(D * D), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] / 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.4e-112], N[(-0.125 * N[(N[(t$95$0 * N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq -2.85 \cdot 10^{+236}:\\
\;\;\;\;t_1 \cdot \left(-d\right)\\
\mathbf{elif}\;d \leq -1.9 \cdot 10^{-193}:\\
\;\;\;\;\left(d \cdot t_1\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq -3 \cdot 10^{-301}:\\
\;\;\;\;M \cdot \left(t_0 \cdot \frac{D \cdot D}{\frac{\frac{d}{M}}{0.125}}\right)\\
\mathbf{elif}\;d \leq 1.4 \cdot 10^{-112}:\\
\;\;\;\;-0.125 \cdot \frac{t_0 \cdot \left(D \cdot \left(D \cdot \left(M \cdot M\right)\right)\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.8499999999999998e236Initial program 66.8%
Applied egg-rr48.6%
expm1-def48.6%
expm1-log1p66.8%
Simplified66.8%
Taylor expanded in d around -inf 88.2%
mul-1-neg88.2%
distribute-rgt-neg-in88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in D around 0 82.3%
associate-/l/82.2%
associate-*r*82.2%
*-commutative82.2%
associate-/l/82.3%
*-commutative82.3%
mul-1-neg82.3%
Simplified82.3%
if -2.8499999999999998e236 < d < -1.90000000000000002e-193Initial program 79.1%
Applied egg-rr21.2%
expm1-def35.1%
expm1-log1p65.2%
Simplified65.2%
Taylor expanded in d around -inf 77.2%
mul-1-neg77.2%
distribute-rgt-neg-in77.2%
*-commutative77.2%
Simplified77.2%
Taylor expanded in h around 0 61.0%
times-frac60.0%
*-commutative60.0%
associate-*r*60.0%
unpow260.0%
unpow260.0%
times-frac71.1%
associate-/l*71.0%
unpow271.0%
Simplified71.0%
Taylor expanded in M around 0 71.1%
unpow271.1%
associate-*l*74.6%
Simplified74.6%
if -1.90000000000000002e-193 < d < -2.99999999999999999e-301Initial program 42.3%
Applied egg-rr8.5%
expm1-def8.5%
expm1-log1p34.7%
Simplified34.7%
Taylor expanded in d around -inf 59.7%
mul-1-neg59.7%
distribute-rgt-neg-in59.7%
*-commutative59.7%
Simplified59.7%
Taylor expanded in h around 0 44.6%
times-frac44.6%
*-commutative44.6%
associate-*r*44.6%
unpow244.6%
unpow244.6%
times-frac48.3%
associate-/l*48.3%
unpow248.3%
Simplified48.3%
Taylor expanded in D around inf 70.4%
associate-*r*70.4%
unpow270.4%
associate-/l*70.3%
associate-*r/70.3%
unpow270.3%
associate-/r*71.2%
associate-/r/71.2%
*-commutative71.2%
associate-*l*71.2%
*-commutative71.2%
unpow271.2%
*-commutative71.2%
associate-/l*71.2%
unpow271.2%
Simplified71.2%
if -2.99999999999999999e-301 < d < 1.40000000000000011e-112Initial program 35.8%
metadata-eval35.8%
unpow1/235.8%
metadata-eval35.8%
unpow1/235.8%
*-commutative35.8%
associate-*l*35.8%
times-frac35.9%
metadata-eval35.9%
Simplified35.9%
frac-times35.8%
clear-num35.9%
*-commutative35.9%
Applied egg-rr35.9%
associate-*r*35.9%
*-commutative35.9%
clear-num35.8%
*-commutative35.8%
metadata-eval35.8%
associate-*r/38.1%
metadata-eval38.1%
times-frac38.1%
Applied egg-rr38.1%
frac-times38.1%
associate-/r*38.1%
Applied egg-rr38.1%
Taylor expanded in d around 0 40.6%
associate-*l/42.9%
unpow242.9%
unpow242.9%
associate-*l*50.5%
Simplified50.5%
if 1.40000000000000011e-112 < d Initial program 78.1%
Taylor expanded in d around inf 60.1%
*-commutative60.1%
*-commutative60.1%
associate-/r*60.1%
Simplified60.1%
sqrt-div72.4%
inv-pow72.4%
Applied egg-rr72.4%
sqr-pow72.5%
rem-sqrt-square72.5%
metadata-eval72.5%
sqr-pow72.3%
fabs-sqr72.3%
sqr-pow72.5%
Simplified72.5%
Final simplification70.2%
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 (/ h (pow l 3.0)))) (t_1 (sqrt (/ 1.0 (* h l)))))
(if (<= d -1.45e+234)
(* t_1 (- d))
(if (<= d -1.6e-198)
(*
(* d t_1)
(- -1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M (* h M)) l)))))
(if (<= d -3e-301)
(* M (* t_0 (/ (* D D) (/ (/ d M) 0.125))))
(if (<= d 8e-113)
(* t_0 (* (* M (/ (* D M) (/ d D))) -0.125))
(* d (/ (pow h -0.5) (sqrt l)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h / pow(l, 3.0)));
double t_1 = sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.45e+234) {
tmp = t_1 * -d;
} else if (d <= -1.6e-198) {
tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
} else if (d <= -3e-301) {
tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125)));
} else if (d <= 8e-113) {
tmp = t_0 * ((M * ((D * M) / (d / D))) * -0.125);
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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((h / (l ** 3.0d0)))
t_1 = sqrt((1.0d0 / (h * l)))
if (d <= (-1.45d+234)) then
tmp = t_1 * -d
else if (d <= (-1.6d-198)) then
tmp = (d * t_1) * ((-1.0d0) - ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * (h * m)) / l))))
else if (d <= (-3d-301)) then
tmp = m * (t_0 * ((d_1 * d_1) / ((d / m) / 0.125d0)))
else if (d <= 8d-113) then
tmp = t_0 * ((m * ((d_1 * m) / (d / d_1))) * (-0.125d0))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h / Math.pow(l, 3.0)));
double t_1 = Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.45e+234) {
tmp = t_1 * -d;
} else if (d <= -1.6e-198) {
tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
} else if (d <= -3e-301) {
tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125)));
} else if (d <= 8e-113) {
tmp = t_0 * ((M * ((D * M) / (d / D))) * -0.125);
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h / math.pow(l, 3.0))) t_1 = math.sqrt((1.0 / (h * l))) tmp = 0 if d <= -1.45e+234: tmp = t_1 * -d elif d <= -1.6e-198: tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l)))) elif d <= -3e-301: tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125))) elif d <= 8e-113: tmp = t_0 * ((M * ((D * M) / (d / D))) * -0.125) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h / (l ^ 3.0))) t_1 = sqrt(Float64(1.0 / Float64(h * l))) tmp = 0.0 if (d <= -1.45e+234) tmp = Float64(t_1 * Float64(-d)); elseif (d <= -1.6e-198) tmp = Float64(Float64(d * t_1) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * Float64(h * M)) / l))))); elseif (d <= -3e-301) tmp = Float64(M * Float64(t_0 * Float64(Float64(D * D) / Float64(Float64(d / M) / 0.125)))); elseif (d <= 8e-113) tmp = Float64(t_0 * Float64(Float64(M * Float64(Float64(D * M) / Float64(d / D))) * -0.125)); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h / (l ^ 3.0)));
t_1 = sqrt((1.0 / (h * l)));
tmp = 0.0;
if (d <= -1.45e+234)
tmp = t_1 * -d;
elseif (d <= -1.6e-198)
tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
elseif (d <= -3e-301)
tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125)));
elseif (d <= 8e-113)
tmp = t_0 * ((M * ((D * M) / (d / D))) * -0.125);
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
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[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.45e+234], N[(t$95$1 * (-d)), $MachinePrecision], If[LessEqual[d, -1.6e-198], N[(N[(d * t$95$1), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3e-301], N[(M * N[(t$95$0 * N[(N[(D * D), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] / 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8e-113], N[(t$95$0 * N[(N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq -1.45 \cdot 10^{+234}:\\
\;\;\;\;t_1 \cdot \left(-d\right)\\
\mathbf{elif}\;d \leq -1.6 \cdot 10^{-198}:\\
\;\;\;\;\left(d \cdot t_1\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq -3 \cdot 10^{-301}:\\
\;\;\;\;M \cdot \left(t_0 \cdot \frac{D \cdot D}{\frac{\frac{d}{M}}{0.125}}\right)\\
\mathbf{elif}\;d \leq 8 \cdot 10^{-113}:\\
\;\;\;\;t_0 \cdot \left(\left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right) \cdot -0.125\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.44999999999999993e234Initial program 66.8%
Applied egg-rr48.6%
expm1-def48.6%
expm1-log1p66.8%
Simplified66.8%
Taylor expanded in d around -inf 88.2%
mul-1-neg88.2%
distribute-rgt-neg-in88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in D around 0 82.3%
associate-/l/82.2%
associate-*r*82.2%
*-commutative82.2%
associate-/l/82.3%
*-commutative82.3%
mul-1-neg82.3%
Simplified82.3%
if -1.44999999999999993e234 < d < -1.59999999999999997e-198Initial program 79.1%
Applied egg-rr21.2%
expm1-def35.1%
expm1-log1p65.2%
Simplified65.2%
Taylor expanded in d around -inf 77.2%
mul-1-neg77.2%
distribute-rgt-neg-in77.2%
*-commutative77.2%
Simplified77.2%
Taylor expanded in h around 0 61.0%
times-frac60.0%
*-commutative60.0%
associate-*r*60.0%
unpow260.0%
unpow260.0%
times-frac71.1%
associate-/l*71.0%
unpow271.0%
Simplified71.0%
Taylor expanded in M around 0 71.1%
unpow271.1%
associate-*l*74.6%
Simplified74.6%
if -1.59999999999999997e-198 < d < -2.99999999999999999e-301Initial program 42.3%
Applied egg-rr8.5%
expm1-def8.5%
expm1-log1p34.7%
Simplified34.7%
Taylor expanded in d around -inf 59.7%
mul-1-neg59.7%
distribute-rgt-neg-in59.7%
*-commutative59.7%
Simplified59.7%
Taylor expanded in h around 0 44.6%
times-frac44.6%
*-commutative44.6%
associate-*r*44.6%
unpow244.6%
unpow244.6%
times-frac48.3%
associate-/l*48.3%
unpow248.3%
Simplified48.3%
Taylor expanded in D around inf 70.4%
associate-*r*70.4%
unpow270.4%
associate-/l*70.3%
associate-*r/70.3%
unpow270.3%
associate-/r*71.2%
associate-/r/71.2%
*-commutative71.2%
associate-*l*71.2%
*-commutative71.2%
unpow271.2%
*-commutative71.2%
associate-/l*71.2%
unpow271.2%
Simplified71.2%
if -2.99999999999999999e-301 < d < 7.99999999999999983e-113Initial program 35.8%
metadata-eval35.8%
unpow1/235.8%
metadata-eval35.8%
unpow1/235.8%
*-commutative35.8%
associate-*l*35.8%
times-frac35.9%
metadata-eval35.9%
Simplified35.9%
frac-times35.8%
clear-num35.9%
*-commutative35.9%
Applied egg-rr35.9%
associate-*r*35.9%
*-commutative35.9%
clear-num35.8%
*-commutative35.8%
metadata-eval35.8%
associate-*r/38.1%
metadata-eval38.1%
times-frac38.1%
Applied egg-rr38.1%
Taylor expanded in d around 0 40.6%
associate-*r*40.6%
*-commutative40.6%
unpow240.6%
unpow240.6%
associate-*l/40.4%
associate-*r*43.1%
*-commutative43.1%
associate-/l*48.1%
associate-*l/50.5%
Simplified50.5%
if 7.99999999999999983e-113 < d Initial program 78.1%
Taylor expanded in d around inf 60.1%
*-commutative60.1%
*-commutative60.1%
associate-/r*60.1%
Simplified60.1%
sqrt-div72.4%
inv-pow72.4%
Applied egg-rr72.4%
sqr-pow72.5%
rem-sqrt-square72.5%
metadata-eval72.5%
sqr-pow72.3%
fabs-sqr72.3%
sqr-pow72.5%
Simplified72.5%
Final simplification70.2%
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 (/ h (pow l 3.0))))
(t_1 (sqrt (/ 1.0 (* h l))))
(t_2 (* M (/ (* D M) (/ d D)))))
(if (<= d -1.4e+236)
(* t_1 (- d))
(if (<= d -2.05e-188)
(*
(* d t_1)
(- -1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M (* h M)) l)))))
(if (<= d -2e-310)
(* t_0 (* 0.125 t_2))
(if (<= d 1.5e-112)
(* t_0 (* t_2 -0.125))
(* d (/ (pow h -0.5) (sqrt l)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h / pow(l, 3.0)));
double t_1 = sqrt((1.0 / (h * l)));
double t_2 = M * ((D * M) / (d / D));
double tmp;
if (d <= -1.4e+236) {
tmp = t_1 * -d;
} else if (d <= -2.05e-188) {
tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
} else if (d <= -2e-310) {
tmp = t_0 * (0.125 * t_2);
} else if (d <= 1.5e-112) {
tmp = t_0 * (t_2 * -0.125);
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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((h / (l ** 3.0d0)))
t_1 = sqrt((1.0d0 / (h * l)))
t_2 = m * ((d_1 * m) / (d / d_1))
if (d <= (-1.4d+236)) then
tmp = t_1 * -d
else if (d <= (-2.05d-188)) then
tmp = (d * t_1) * ((-1.0d0) - ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * (h * m)) / l))))
else if (d <= (-2d-310)) then
tmp = t_0 * (0.125d0 * t_2)
else if (d <= 1.5d-112) then
tmp = t_0 * (t_2 * (-0.125d0))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h / Math.pow(l, 3.0)));
double t_1 = Math.sqrt((1.0 / (h * l)));
double t_2 = M * ((D * M) / (d / D));
double tmp;
if (d <= -1.4e+236) {
tmp = t_1 * -d;
} else if (d <= -2.05e-188) {
tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
} else if (d <= -2e-310) {
tmp = t_0 * (0.125 * t_2);
} else if (d <= 1.5e-112) {
tmp = t_0 * (t_2 * -0.125);
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h / math.pow(l, 3.0))) t_1 = math.sqrt((1.0 / (h * l))) t_2 = M * ((D * M) / (d / D)) tmp = 0 if d <= -1.4e+236: tmp = t_1 * -d elif d <= -2.05e-188: tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l)))) elif d <= -2e-310: tmp = t_0 * (0.125 * t_2) elif d <= 1.5e-112: tmp = t_0 * (t_2 * -0.125) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h / (l ^ 3.0))) t_1 = sqrt(Float64(1.0 / Float64(h * l))) t_2 = Float64(M * Float64(Float64(D * M) / Float64(d / D))) tmp = 0.0 if (d <= -1.4e+236) tmp = Float64(t_1 * Float64(-d)); elseif (d <= -2.05e-188) tmp = Float64(Float64(d * t_1) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * Float64(h * M)) / l))))); elseif (d <= -2e-310) tmp = Float64(t_0 * Float64(0.125 * t_2)); elseif (d <= 1.5e-112) tmp = Float64(t_0 * Float64(t_2 * -0.125)); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h / (l ^ 3.0)));
t_1 = sqrt((1.0 / (h * l)));
t_2 = M * ((D * M) / (d / D));
tmp = 0.0;
if (d <= -1.4e+236)
tmp = t_1 * -d;
elseif (d <= -2.05e-188)
tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
elseif (d <= -2e-310)
tmp = t_0 * (0.125 * t_2);
elseif (d <= 1.5e-112)
tmp = t_0 * (t_2 * -0.125);
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
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[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.4e+236], N[(t$95$1 * (-d)), $MachinePrecision], If[LessEqual[d, -2.05e-188], N[(N[(d * t$95$1), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], N[(t$95$0 * N[(0.125 * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.5e-112], N[(t$95$0 * N[(t$95$2 * -0.125), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := \sqrt{\frac{1}{h \cdot \ell}}\\
t_2 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -1.4 \cdot 10^{+236}:\\
\;\;\;\;t_1 \cdot \left(-d\right)\\
\mathbf{elif}\;d \leq -2.05 \cdot 10^{-188}:\\
\;\;\;\;\left(d \cdot t_1\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(0.125 \cdot t_2\right)\\
\mathbf{elif}\;d \leq 1.5 \cdot 10^{-112}:\\
\;\;\;\;t_0 \cdot \left(t_2 \cdot -0.125\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.39999999999999996e236Initial program 66.8%
Applied egg-rr48.6%
expm1-def48.6%
expm1-log1p66.8%
Simplified66.8%
Taylor expanded in d around -inf 88.2%
mul-1-neg88.2%
distribute-rgt-neg-in88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in D around 0 82.3%
associate-/l/82.2%
associate-*r*82.2%
*-commutative82.2%
associate-/l/82.3%
*-commutative82.3%
mul-1-neg82.3%
Simplified82.3%
if -1.39999999999999996e236 < d < -2.04999999999999991e-188Initial program 79.1%
Applied egg-rr21.2%
expm1-def35.1%
expm1-log1p65.2%
Simplified65.2%
Taylor expanded in d around -inf 77.2%
mul-1-neg77.2%
distribute-rgt-neg-in77.2%
*-commutative77.2%
Simplified77.2%
Taylor expanded in h around 0 61.0%
times-frac60.0%
*-commutative60.0%
associate-*r*60.0%
unpow260.0%
unpow260.0%
times-frac71.1%
associate-/l*71.0%
unpow271.0%
Simplified71.0%
Taylor expanded in M around 0 71.1%
unpow271.1%
associate-*l*74.6%
Simplified74.6%
if -2.04999999999999991e-188 < d < -1.999999999999994e-310Initial program 42.8%
Applied egg-rr7.9%
expm1-def7.9%
expm1-log1p32.3%
Simplified32.3%
Taylor expanded in d around -inf 55.6%
mul-1-neg55.6%
distribute-rgt-neg-in55.6%
*-commutative55.6%
Simplified55.6%
Taylor expanded in D around inf 69.1%
*-commutative69.1%
unpow269.1%
unpow269.1%
associate-*l/62.1%
*-commutative62.1%
associate-*l*62.1%
*-commutative62.1%
associate-*r*63.1%
*-commutative63.1%
associate-/l*63.1%
associate-*l/66.6%
Simplified66.6%
if -1.999999999999994e-310 < d < 1.5e-112Initial program 35.1%
metadata-eval35.1%
unpow1/235.1%
metadata-eval35.1%
unpow1/235.1%
*-commutative35.1%
associate-*l*35.1%
times-frac35.2%
metadata-eval35.2%
Simplified35.2%
frac-times35.1%
clear-num35.2%
*-commutative35.2%
Applied egg-rr35.2%
associate-*r*35.2%
*-commutative35.2%
clear-num35.1%
*-commutative35.1%
metadata-eval35.1%
associate-*r/37.4%
metadata-eval37.4%
times-frac37.5%
Applied egg-rr37.5%
Taylor expanded in d around 0 40.1%
associate-*r*40.1%
*-commutative40.1%
unpow240.1%
unpow240.1%
associate-*l/39.9%
associate-*r*42.7%
*-commutative42.7%
associate-/l*48.0%
associate-*l/50.5%
Simplified50.5%
if 1.5e-112 < d Initial program 78.1%
Taylor expanded in d around inf 60.1%
*-commutative60.1%
*-commutative60.1%
associate-/r*60.1%
Simplified60.1%
sqrt-div72.4%
inv-pow72.4%
Applied egg-rr72.4%
sqr-pow72.5%
rem-sqrt-square72.5%
metadata-eval72.5%
sqr-pow72.3%
fabs-sqr72.3%
sqr-pow72.5%
Simplified72.5%
Final simplification69.9%
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 (/ 1.0 (* h l)))))
(if (<= d -5.5e+231)
(* t_0 (- d))
(if (<= d -5.4e-304)
(*
(* d t_0)
(- -1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M (* h M)) l)))))
(if (<= d 7.2e-113)
(* -0.125 (* (/ (* D D) (/ d (* M M))) (/ (sqrt h) (pow l 1.5))))
(* d (/ (pow h -0.5) (sqrt l))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (h * l)));
double tmp;
if (d <= -5.5e+231) {
tmp = t_0 * -d;
} else if (d <= -5.4e-304) {
tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
} else if (d <= 7.2e-113) {
tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / pow(l, 1.5)));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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((1.0d0 / (h * l)))
if (d <= (-5.5d+231)) then
tmp = t_0 * -d
else if (d <= (-5.4d-304)) then
tmp = (d * t_0) * ((-1.0d0) - ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * (h * m)) / l))))
else if (d <= 7.2d-113) then
tmp = (-0.125d0) * (((d_1 * d_1) / (d / (m * m))) * (sqrt(h) / (l ** 1.5d0)))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -5.5e+231) {
tmp = t_0 * -d;
} else if (d <= -5.4e-304) {
tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
} else if (d <= 7.2e-113) {
tmp = -0.125 * (((D * D) / (d / (M * M))) * (Math.sqrt(h) / Math.pow(l, 1.5)));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((1.0 / (h * l))) tmp = 0 if d <= -5.5e+231: tmp = t_0 * -d elif d <= -5.4e-304: tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l)))) elif d <= 7.2e-113: tmp = -0.125 * (((D * D) / (d / (M * M))) * (math.sqrt(h) / math.pow(l, 1.5))) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(h * l))) tmp = 0.0 if (d <= -5.5e+231) tmp = Float64(t_0 * Float64(-d)); elseif (d <= -5.4e-304) tmp = Float64(Float64(d * t_0) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * Float64(h * M)) / l))))); elseif (d <= 7.2e-113) tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d / Float64(M * M))) * Float64(sqrt(h) / (l ^ 1.5)))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((1.0 / (h * l)));
tmp = 0.0;
if (d <= -5.5e+231)
tmp = t_0 * -d;
elseif (d <= -5.4e-304)
tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
elseif (d <= 7.2e-113)
tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / (l ^ 1.5)));
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
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[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -5.5e+231], N[(t$95$0 * (-d)), $MachinePrecision], If[LessEqual[d, -5.4e-304], N[(N[(d * t$95$0), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.2e-113], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq -5.5 \cdot 10^{+231}:\\
\;\;\;\;t_0 \cdot \left(-d\right)\\
\mathbf{elif}\;d \leq -5.4 \cdot 10^{-304}:\\
\;\;\;\;\left(d \cdot t_0\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq 7.2 \cdot 10^{-113}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -5.5e231Initial program 66.8%
Applied egg-rr48.6%
expm1-def48.6%
expm1-log1p66.8%
Simplified66.8%
Taylor expanded in d around -inf 88.2%
mul-1-neg88.2%
distribute-rgt-neg-in88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in D around 0 82.3%
associate-/l/82.2%
associate-*r*82.2%
*-commutative82.2%
associate-/l/82.3%
*-commutative82.3%
mul-1-neg82.3%
Simplified82.3%
if -5.5e231 < d < -5.40000000000000021e-304Initial program 70.2%
Applied egg-rr17.9%
expm1-def28.2%
expm1-log1p57.1%
Simplified57.1%
Taylor expanded in d around -inf 72.1%
mul-1-neg72.1%
distribute-rgt-neg-in72.1%
*-commutative72.1%
Simplified72.1%
Taylor expanded in h around 0 56.4%
times-frac55.6%
*-commutative55.6%
associate-*r*55.6%
unpow255.6%
unpow255.6%
times-frac65.7%
associate-/l*65.6%
unpow265.6%
Simplified65.6%
Taylor expanded in M around 0 65.7%
unpow265.7%
associate-*l*68.3%
Simplified68.3%
if -5.40000000000000021e-304 < d < 7.1999999999999995e-113Initial program 34.2%
Taylor expanded in d around 0 39.1%
associate-/l*36.6%
unpow236.6%
unpow236.6%
Simplified36.6%
sqrt-div36.6%
Applied egg-rr36.6%
sqr-pow36.6%
rem-sqrt-square44.1%
sqr-pow44.1%
fabs-sqr44.1%
sqr-pow44.1%
metadata-eval44.1%
Simplified44.1%
if 7.1999999999999995e-113 < d Initial program 78.1%
Taylor expanded in d around inf 60.1%
*-commutative60.1%
*-commutative60.1%
associate-/r*60.1%
Simplified60.1%
sqrt-div72.4%
inv-pow72.4%
Applied egg-rr72.4%
sqr-pow72.5%
rem-sqrt-square72.5%
metadata-eval72.5%
sqr-pow72.3%
fabs-sqr72.3%
sqr-pow72.5%
Simplified72.5%
Final simplification67.0%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h -2e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M (* h M)) l)))))
(if (<= h 7.2e+266)
(* d (/ (pow h -0.5) (sqrt l)))
(* -0.125 (* D (/ (* D (sqrt (/ h (pow l 3.0)))) (/ d (* M M))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -2e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
} else if (h <= 7.2e+266) {
tmp = d * (pow(h, -0.5) / sqrt(l));
} else {
tmp = -0.125 * (D * ((D * sqrt((h / pow(l, 3.0)))) / (d / (M * M))));
}
return tmp;
}
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 (h <= (-2d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * (h * m)) / l))))
else if (h <= 7.2d+266) then
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
else
tmp = (-0.125d0) * (d_1 * ((d_1 * sqrt((h / (l ** 3.0d0)))) / (d / (m * m))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -2e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
} else if (h <= 7.2e+266) {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
} else {
tmp = -0.125 * (D * ((D * Math.sqrt((h / Math.pow(l, 3.0)))) / (d / (M * M))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -2e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l)))) elif h <= 7.2e+266: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) else: tmp = -0.125 * (D * ((D * math.sqrt((h / math.pow(l, 3.0)))) / (d / (M * M)))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -2e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * Float64(h * M)) / l))))); elseif (h <= 7.2e+266) tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); else tmp = Float64(-0.125 * Float64(D * Float64(Float64(D * sqrt(Float64(h / (l ^ 3.0)))) / Float64(d / Float64(M * M))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= -2e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
elseif (h <= 7.2e+266)
tmp = d * ((h ^ -0.5) / sqrt(l));
else
tmp = -0.125 * (D * ((D * sqrt((h / (l ^ 3.0)))) / (d / (M * M))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -2e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 7.2e+266], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.125 * N[(D * N[(N[(D * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\
\mathbf{elif}\;h \leq 7.2 \cdot 10^{+266}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(D \cdot \frac{D \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{\frac{d}{M \cdot M}}\right)\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 69.2%
Applied egg-rr21.9%
expm1-def30.7%
expm1-log1p57.9%
Simplified57.9%
Taylor expanded in d around -inf 73.7%
mul-1-neg73.7%
distribute-rgt-neg-in73.7%
*-commutative73.7%
Simplified73.7%
Taylor expanded in h around 0 53.9%
times-frac51.6%
*-commutative51.6%
associate-*r*51.6%
unpow251.6%
unpow251.6%
times-frac64.3%
associate-/l*64.2%
unpow264.2%
Simplified64.2%
Taylor expanded in M around 0 64.3%
unpow264.3%
associate-*l*67.2%
Simplified67.2%
if -1.999999999999994e-310 < h < 7.19999999999999976e266Initial program 67.0%
Taylor expanded in d around inf 54.1%
*-commutative54.1%
*-commutative54.1%
associate-/r*54.1%
Simplified54.1%
sqrt-div63.4%
inv-pow63.4%
Applied egg-rr63.4%
sqr-pow63.5%
rem-sqrt-square63.5%
metadata-eval63.5%
sqr-pow63.3%
fabs-sqr63.3%
sqr-pow63.5%
Simplified63.5%
if 7.19999999999999976e266 < h Initial program 44.3%
Taylor expanded in d around 0 57.2%
associate-/l*57.2%
unpow257.2%
unpow257.2%
Simplified57.2%
Taylor expanded in D around 0 57.2%
unpow257.2%
unpow257.2%
associate-/l*57.2%
associate-*l/57.2%
*-lft-identity57.2%
associate-*l*57.2%
times-frac57.2%
/-rgt-identity57.2%
Simplified57.2%
Final simplification65.1%
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 (/ 1.0 (* h l)))))
(if (<= d -4.7e+236)
(* t_0 (- d))
(if (<= d -5.4e-304)
(*
(* d t_0)
(- -1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M (* h M)) l)))))
(* d (/ (pow h -0.5) (sqrt l)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (h * l)));
double tmp;
if (d <= -4.7e+236) {
tmp = t_0 * -d;
} else if (d <= -5.4e-304) {
tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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((1.0d0 / (h * l)))
if (d <= (-4.7d+236)) then
tmp = t_0 * -d
else if (d <= (-5.4d-304)) then
tmp = (d * t_0) * ((-1.0d0) - ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * (h * m)) / l))))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -4.7e+236) {
tmp = t_0 * -d;
} else if (d <= -5.4e-304) {
tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((1.0 / (h * l))) tmp = 0 if d <= -4.7e+236: tmp = t_0 * -d elif d <= -5.4e-304: tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l)))) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(h * l))) tmp = 0.0 if (d <= -4.7e+236) tmp = Float64(t_0 * Float64(-d)); elseif (d <= -5.4e-304) tmp = Float64(Float64(d * t_0) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * Float64(h * M)) / l))))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((1.0 / (h * l)));
tmp = 0.0;
if (d <= -4.7e+236)
tmp = t_0 * -d;
elseif (d <= -5.4e-304)
tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
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[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -4.7e+236], N[(t$95$0 * (-d)), $MachinePrecision], If[LessEqual[d, -5.4e-304], N[(N[(d * t$95$0), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq -4.7 \cdot 10^{+236}:\\
\;\;\;\;t_0 \cdot \left(-d\right)\\
\mathbf{elif}\;d \leq -5.4 \cdot 10^{-304}:\\
\;\;\;\;\left(d \cdot t_0\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -4.69999999999999963e236Initial program 66.8%
Applied egg-rr48.6%
expm1-def48.6%
expm1-log1p66.8%
Simplified66.8%
Taylor expanded in d around -inf 88.2%
mul-1-neg88.2%
distribute-rgt-neg-in88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in D around 0 82.3%
associate-/l/82.2%
associate-*r*82.2%
*-commutative82.2%
associate-/l/82.3%
*-commutative82.3%
mul-1-neg82.3%
Simplified82.3%
if -4.69999999999999963e236 < d < -5.40000000000000021e-304Initial program 70.2%
Applied egg-rr17.9%
expm1-def28.2%
expm1-log1p57.1%
Simplified57.1%
Taylor expanded in d around -inf 72.1%
mul-1-neg72.1%
distribute-rgt-neg-in72.1%
*-commutative72.1%
Simplified72.1%
Taylor expanded in h around 0 56.4%
times-frac55.6%
*-commutative55.6%
associate-*r*55.6%
unpow255.6%
unpow255.6%
times-frac65.7%
associate-/l*65.6%
unpow265.6%
Simplified65.6%
Taylor expanded in M around 0 65.7%
unpow265.7%
associate-*l*68.3%
Simplified68.3%
if -5.40000000000000021e-304 < d Initial program 65.0%
Taylor expanded in d around inf 50.1%
*-commutative50.1%
*-commutative50.1%
associate-/r*50.1%
Simplified50.1%
sqrt-div59.4%
inv-pow59.4%
Applied egg-rr59.4%
sqr-pow59.5%
rem-sqrt-square59.5%
metadata-eval59.5%
sqr-pow59.4%
fabs-sqr59.4%
sqr-pow59.5%
Simplified59.5%
Final simplification64.8%
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 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M M) (/ l h))))))
(if (<= l -2.8e+119)
(* (sqrt (/ (/ 1.0 l) h)) (- d))
(if (<= l -3.2e-134)
(* (* d (sqrt (/ 1.0 (* h l)))) (- -1.0 t_0))
(if (<= l 1.5e-166)
(* (sqrt (* (/ d h) (/ d l))) (+ 1.0 t_0))
(* d (/ 1.0 (sqrt (* h l)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = -0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h)));
double tmp;
if (l <= -2.8e+119) {
tmp = sqrt(((1.0 / l) / h)) * -d;
} else if (l <= -3.2e-134) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - t_0);
} else if (l <= 1.5e-166) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + t_0);
} else {
tmp = d * (1.0 / sqrt((h * l)));
}
return tmp;
}
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 = (-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * m) / (l / h)))
if (l <= (-2.8d+119)) then
tmp = sqrt(((1.0d0 / l) / h)) * -d
else if (l <= (-3.2d-134)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - t_0)
else if (l <= 1.5d-166) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + t_0)
else
tmp = d * (1.0d0 / sqrt((h * l)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = -0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h)));
double tmp;
if (l <= -2.8e+119) {
tmp = Math.sqrt(((1.0 / l) / h)) * -d;
} else if (l <= -3.2e-134) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - t_0);
} else if (l <= 1.5e-166) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + t_0);
} else {
tmp = d * (1.0 / Math.sqrt((h * l)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = -0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h))) tmp = 0 if l <= -2.8e+119: tmp = math.sqrt(((1.0 / l) / h)) * -d elif l <= -3.2e-134: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - t_0) elif l <= 1.5e-166: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + t_0) else: tmp = d * (1.0 / math.sqrt((h * l))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * M) / Float64(l / h)))) tmp = 0.0 if (l <= -2.8e+119) tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * Float64(-d)); elseif (l <= -3.2e-134) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - t_0)); elseif (l <= 1.5e-166) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + t_0)); else tmp = Float64(d * Float64(1.0 / sqrt(Float64(h * l)))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = -0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h)));
tmp = 0.0;
if (l <= -2.8e+119)
tmp = sqrt(((1.0 / l) / h)) * -d;
elseif (l <= -3.2e-134)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - t_0);
elseif (l <= 1.5e-166)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + t_0);
else
tmp = d * (1.0 / sqrt((h * l)));
end
tmp_2 = tmp;
end
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[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.8e+119], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[l, -3.2e-134], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e-166], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\\
\mathbf{if}\;\ell \leq -2.8 \cdot 10^{+119}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\
\mathbf{elif}\;\ell \leq -3.2 \cdot 10^{-134}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - t_0\right)\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-166}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + t_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if l < -2.80000000000000013e119Initial program 55.2%
Applied egg-rr28.7%
expm1-def46.7%
expm1-log1p50.5%
Simplified50.5%
Taylor expanded in d around -inf 64.0%
mul-1-neg64.0%
distribute-rgt-neg-in64.0%
*-commutative64.0%
Simplified64.0%
Taylor expanded in h around 0 41.7%
times-frac38.9%
*-commutative38.9%
associate-*r*38.9%
unpow238.9%
unpow238.9%
times-frac47.3%
associate-/l*47.3%
unpow247.3%
Simplified47.3%
Taylor expanded in D around 0 67.4%
associate-/l/67.4%
unpow-167.4%
associate-*r*67.4%
*-commutative67.4%
mul-1-neg67.4%
unpow-167.4%
associate-/l/67.4%
associate-/r*67.4%
Simplified67.4%
if -2.80000000000000013e119 < l < -3.2000000000000001e-134Initial program 71.0%
Applied egg-rr14.8%
expm1-def21.3%
expm1-log1p49.5%
Simplified49.5%
Taylor expanded in d around -inf 76.9%
mul-1-neg76.9%
distribute-rgt-neg-in76.9%
*-commutative76.9%
Simplified76.9%
Taylor expanded in h around 0 56.5%
times-frac55.0%
*-commutative55.0%
associate-*r*55.0%
unpow255.0%
unpow255.0%
times-frac63.5%
associate-/l*66.8%
unpow266.8%
Simplified66.8%
if -3.2000000000000001e-134 < l < 1.5000000000000001e-166Initial program 76.3%
Applied egg-rr23.7%
expm1-def26.7%
expm1-log1p71.9%
Simplified71.9%
Taylor expanded in h around 0 46.7%
times-frac30.5%
*-commutative30.5%
associate-*r*30.5%
unpow230.5%
unpow230.5%
times-frac43.3%
associate-/l*39.9%
unpow239.9%
Simplified65.3%
if 1.5000000000000001e-166 < l Initial program 63.8%
Taylor expanded in d around inf 56.0%
sqrt-div56.0%
*-commutative56.0%
metadata-eval56.0%
Applied egg-rr56.0%
Final simplification62.4%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -2.4e+67)
(* (sqrt (/ (/ 1.0 l) h)) (- d))
(if (<= l 2.7e-167)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M M) (/ l h))))))
(* d (/ 1.0 (sqrt (* h l)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.4e+67) {
tmp = sqrt(((1.0 / l) / h)) * -d;
} else if (l <= 2.7e-167) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h)))));
} else {
tmp = d * (1.0 / sqrt((h * l)));
}
return tmp;
}
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 <= (-2.4d+67)) then
tmp = sqrt(((1.0d0 / l) / h)) * -d
else if (l <= 2.7d-167) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * m) / (l / h)))))
else
tmp = d * (1.0d0 / sqrt((h * l)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.4e+67) {
tmp = Math.sqrt(((1.0 / l) / h)) * -d;
} else if (l <= 2.7e-167) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h)))));
} else {
tmp = d * (1.0 / Math.sqrt((h * l)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -2.4e+67: tmp = math.sqrt(((1.0 / l) / h)) * -d elif l <= 2.7e-167: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h))))) else: tmp = d * (1.0 / math.sqrt((h * l))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -2.4e+67) tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * Float64(-d)); elseif (l <= 2.7e-167) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * M) / Float64(l / h)))))); else tmp = Float64(d * Float64(1.0 / sqrt(Float64(h * l)))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -2.4e+67)
tmp = sqrt(((1.0 / l) / h)) * -d;
elseif (l <= 2.7e-167)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h)))));
else
tmp = d * (1.0 / sqrt((h * l)));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.4e+67], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[l, 2.7e-167], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{+67}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\
\mathbf{elif}\;\ell \leq 2.7 \cdot 10^{-167}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if l < -2.40000000000000002e67Initial program 59.5%
Applied egg-rr25.7%
expm1-def38.9%
expm1-log1p44.0%
Simplified44.0%
Taylor expanded in d around -inf 67.4%
mul-1-neg67.4%
distribute-rgt-neg-in67.4%
*-commutative67.4%
Simplified67.4%
Taylor expanded in h around 0 47.1%
times-frac45.1%
*-commutative45.1%
associate-*r*45.1%
unpow245.1%
unpow245.1%
times-frac53.3%
associate-/l*55.2%
unpow255.2%
Simplified55.2%
Taylor expanded in D around 0 63.9%
associate-/l/63.9%
unpow-163.9%
associate-*r*63.9%
*-commutative63.9%
mul-1-neg63.9%
unpow-163.9%
associate-/l/63.9%
associate-/r*63.9%
Simplified63.9%
if -2.40000000000000002e67 < l < 2.7000000000000001e-167Initial program 74.0%
Applied egg-rr19.6%
expm1-def24.9%
expm1-log1p65.3%
Simplified65.3%
Taylor expanded in h around 0 43.0%
times-frac40.0%
*-commutative40.0%
associate-*r*40.0%
unpow240.0%
unpow240.0%
times-frac51.1%
associate-/l*50.0%
unpow250.0%
Simplified58.4%
if 2.7000000000000001e-167 < l Initial program 63.8%
Taylor expanded in d around inf 56.0%
sqrt-div56.0%
*-commutative56.0%
metadata-eval56.0%
Applied egg-rr56.0%
Final simplification58.5%
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 (* 0.25 (* (/ D d) (/ D d)))))
(if (<= h -2e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (* t_0 (/ (* M (* h M)) l)))))
(if (<= h 3.6e+196)
(* d (/ 1.0 (sqrt (* h l))))
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* t_0 (/ (* M M) (/ l h))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.25 * ((D / d) * (D / d));
double tmp;
if (h <= -2e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * (t_0 * ((M * (h * M)) / l))));
} else if (h <= 3.6e+196) {
tmp = d * (1.0 / sqrt((h * l)));
} else {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (t_0 * ((M * M) / (l / h)))));
}
return tmp;
}
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 = 0.25d0 * ((d_1 / d) * (d_1 / d))
if (h <= (-2d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * (t_0 * ((m * (h * m)) / l))))
else if (h <= 3.6d+196) then
tmp = d * (1.0d0 / sqrt((h * l)))
else
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * (t_0 * ((m * m) / (l / h)))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 0.25 * ((D / d) * (D / d));
double tmp;
if (h <= -2e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * (t_0 * ((M * (h * M)) / l))));
} else if (h <= 3.6e+196) {
tmp = d * (1.0 / Math.sqrt((h * l)));
} else {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (t_0 * ((M * M) / (l / h)))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.25 * ((D / d) * (D / d)) tmp = 0 if h <= -2e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * (t_0 * ((M * (h * M)) / l)))) elif h <= 3.6e+196: tmp = d * (1.0 / math.sqrt((h * l))) else: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (t_0 * ((M * M) / (l / h))))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) tmp = 0.0 if (h <= -2e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(t_0 * Float64(Float64(M * Float64(h * M)) / l))))); elseif (h <= 3.6e+196) tmp = Float64(d * Float64(1.0 / sqrt(Float64(h * l)))); else tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(t_0 * Float64(Float64(M * M) / Float64(l / h)))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.25 * ((D / d) * (D / d));
tmp = 0.0;
if (h <= -2e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * (t_0 * ((M * (h * M)) / l))));
elseif (h <= 3.6e+196)
tmp = d * (1.0 / sqrt((h * l)));
else
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (t_0 * ((M * M) / (l / h)))));
end
tmp_2 = tmp;
end
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[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(t$95$0 * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 3.6e+196], N[(d * N[(1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(t$95$0 * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\\
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(t_0 \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\
\mathbf{elif}\;h \leq 3.6 \cdot 10^{+196}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(t_0 \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 69.2%
Applied egg-rr21.9%
expm1-def30.7%
expm1-log1p57.9%
Simplified57.9%
Taylor expanded in d around -inf 73.7%
mul-1-neg73.7%
distribute-rgt-neg-in73.7%
*-commutative73.7%
Simplified73.7%
Taylor expanded in h around 0 53.9%
times-frac51.6%
*-commutative51.6%
associate-*r*51.6%
unpow251.6%
unpow251.6%
times-frac64.3%
associate-/l*64.2%
unpow264.2%
Simplified64.2%
Taylor expanded in M around 0 64.3%
unpow264.3%
associate-*l*67.2%
Simplified67.2%
if -1.999999999999994e-310 < h < 3.60000000000000007e196Initial program 66.2%
Taylor expanded in d around inf 60.3%
sqrt-div60.3%
*-commutative60.3%
metadata-eval60.3%
Applied egg-rr60.3%
if 3.60000000000000007e196 < h Initial program 62.7%
Applied egg-rr18.6%
expm1-def32.7%
expm1-log1p52.2%
Simplified52.2%
Taylor expanded in h around 0 22.9%
times-frac0.8%
*-commutative0.8%
associate-*r*0.8%
unpow20.8%
unpow20.8%
times-frac1.1%
associate-/l*1.3%
unpow21.3%
Simplified30.4%
Final simplification60.6%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= d -3.2e-212) (* d (- (pow (* h l) -0.5))) (* d (sqrt (/ (/ 1.0 l) h)))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.2e-212) {
tmp = d * -pow((h * l), -0.5);
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
return tmp;
}
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 <= (-3.2d-212)) then
tmp = d * -((h * l) ** (-0.5d0))
else
tmp = d * sqrt(((1.0d0 / l) / h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.2e-212) {
tmp = d * -Math.pow((h * l), -0.5);
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -3.2e-212: tmp = d * -math.pow((h * l), -0.5) else: tmp = d * math.sqrt(((1.0 / l) / h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -3.2e-212) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -3.2e-212)
tmp = d * -((h * l) ^ -0.5);
else
tmp = d * sqrt(((1.0 / l) / h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -3.2e-212], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3.2 \cdot 10^{-212}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if d < -3.1999999999999999e-212Initial program 75.0%
Applied egg-rr25.5%
expm1-def36.7%
expm1-log1p63.8%
Simplified63.8%
Taylor expanded in d around -inf 78.7%
mul-1-neg78.7%
distribute-rgt-neg-in78.7%
*-commutative78.7%
Simplified78.7%
Taylor expanded in D around 0 52.0%
associate-/l/52.0%
associate-*r*52.0%
*-commutative52.0%
mul-1-neg52.0%
associate-/l/52.0%
*-commutative52.0%
unpow-152.0%
sqr-pow52.0%
rem-sqrt-square52.3%
metadata-eval52.3%
sqr-pow52.3%
fabs-sqr52.3%
sqr-pow52.3%
Simplified52.3%
if -3.1999999999999999e-212 < d Initial program 62.3%
Taylor expanded in d around inf 45.5%
associate-/l/45.5%
add-cbrt-cube34.9%
Applied egg-rr34.9%
Taylor expanded in h around 0 45.5%
associate-/r*45.6%
Simplified45.6%
Final simplification48.2%
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))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt(((1.0 / h) / l));
}
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
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, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(((1.0 / h) / l))
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(Float64(1.0 / h) / l))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt(((1.0 / h) / l));
end
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, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}
\end{array}
Initial program 67.3%
Taylor expanded in d around inf 30.8%
*-commutative30.8%
*-commutative30.8%
associate-/r*30.8%
Simplified30.8%
Final simplification30.8%
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))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt(((1.0 / l) / h));
}
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
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, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(((1.0 / l) / h))
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt(((1.0 / l) / h));
end
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, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}
\end{array}
Initial program 67.3%
Taylor expanded in d around inf 30.8%
associate-/l/30.8%
add-cbrt-cube26.6%
Applied egg-rr26.6%
Taylor expanded in h around 0 30.8%
associate-/r*30.8%
Simplified30.8%
Final simplification30.8%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (pow (* h l) -0.5)))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * pow((h * l), -0.5);
}
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 * ((h * l) ** (-0.5d0))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.pow((h * l), -0.5);
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.pow((h * l), -0.5)
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * (Float64(h * l) ^ -0.5)) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * ((h * l) ^ -0.5);
end
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[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 67.3%
Taylor expanded in d around inf 30.8%
associate-/l/30.8%
*-un-lft-identity30.8%
Applied egg-rr30.8%
*-lft-identity30.8%
associate-/l/30.8%
*-commutative30.8%
unpow-130.8%
sqr-pow30.8%
rem-sqrt-square30.0%
metadata-eval30.0%
sqr-pow29.9%
fabs-sqr29.9%
sqr-pow30.0%
Simplified30.0%
Final simplification30.0%
herbie shell --seed 2023189
(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)))))