
(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 19 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
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ (* (pow (* M (* 0.5 (/ D d))) 2.0) (* 0.5 (/ h l))) -1.0))))
(if (<= d -3.9e+54)
t_0
(if (<= d -3.1e-167)
(*
(*
(sqrt (/ d h))
(pow (* (pow (/ -1.0 l) 0.25) (pow (/ -1.0 d) -0.25)) 2.0))
(- 1.0 (/ (* h (* 0.5 (pow (/ (* D (* M 0.5)) d) 2.0))) l)))
(if (<= d -5e-310)
t_0
(*
(/ (sqrt d) (sqrt h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0)))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (d * sqrt((1.0 / (h * l)))) * ((pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0);
double tmp;
if (d <= -3.9e+54) {
tmp = t_0;
} else if (d <= -3.1e-167) {
tmp = (sqrt((d / h)) * pow((pow((-1.0 / l), 0.25) * pow((-1.0 / d), -0.25)), 2.0)) * (1.0 - ((h * (0.5 * pow(((D * (M * 0.5)) / d), 2.0))) / l));
} else if (d <= -5e-310) {
tmp = t_0;
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 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) :: t_0
real(8) :: tmp
t_0 = (d * sqrt((1.0d0 / (h * l)))) * ((((m * (0.5d0 * (d_1 / d))) ** 2.0d0) * (0.5d0 * (h / l))) + (-1.0d0))
if (d <= (-3.9d+54)) then
tmp = t_0
else if (d <= (-3.1d-167)) then
tmp = (sqrt((d / h)) * (((((-1.0d0) / l) ** 0.25d0) * (((-1.0d0) / d) ** (-0.25d0))) ** 2.0d0)) * (1.0d0 - ((h * (0.5d0 * (((d_1 * (m * 0.5d0)) / d) ** 2.0d0))) / l))
else if (d <= (-5d-310)) then
tmp = t_0
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 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 t_0 = (d * Math.sqrt((1.0 / (h * l)))) * ((Math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0);
double tmp;
if (d <= -3.9e+54) {
tmp = t_0;
} else if (d <= -3.1e-167) {
tmp = (Math.sqrt((d / h)) * Math.pow((Math.pow((-1.0 / l), 0.25) * Math.pow((-1.0 / d), -0.25)), 2.0)) * (1.0 - ((h * (0.5 * Math.pow(((D * (M * 0.5)) / d), 2.0))) / l));
} else if (d <= -5e-310) {
tmp = t_0;
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0)))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = (d * math.sqrt((1.0 / (h * l)))) * ((math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0) tmp = 0 if d <= -3.9e+54: tmp = t_0 elif d <= -3.1e-167: tmp = (math.sqrt((d / h)) * math.pow((math.pow((-1.0 / l), 0.25) * math.pow((-1.0 / d), -0.25)), 2.0)) * (1.0 - ((h * (0.5 * math.pow(((D * (M * 0.5)) / d), 2.0))) / l)) elif d <= -5e-310: tmp = t_0 else: tmp = (math.sqrt(d) / math.sqrt(h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0))))) 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(Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) * Float64(0.5 * Float64(h / l))) + -1.0)) tmp = 0.0 if (d <= -3.9e+54) tmp = t_0; elseif (d <= -3.1e-167) tmp = Float64(Float64(sqrt(Float64(d / h)) * (Float64((Float64(-1.0 / l) ^ 0.25) * (Float64(-1.0 / d) ^ -0.25)) ^ 2.0)) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(D * Float64(M * 0.5)) / d) ^ 2.0))) / l))); elseif (d <= -5e-310) tmp = t_0; else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)))))); 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)))) * ((((M * (0.5 * (D / d))) ^ 2.0) * (0.5 * (h / l))) + -1.0);
tmp = 0.0;
if (d <= -3.9e+54)
tmp = t_0;
elseif (d <= -3.1e-167)
tmp = (sqrt((d / h)) * ((((-1.0 / l) ^ 0.25) * ((-1.0 / d) ^ -0.25)) ^ 2.0)) * (1.0 - ((h * (0.5 * (((D * (M * 0.5)) / d) ^ 2.0))) / l));
elseif (d <= -5e-310)
tmp = t_0;
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 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_] := Block[{t$95$0 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.9e+54], t$95$0, If[LessEqual[d, -3.1e-167], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Power[N[(N[Power[N[(-1.0 / l), $MachinePrecision], 0.25], $MachinePrecision] * N[Power[N[(-1.0 / d), $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(D * N[(M * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], t$95$0, N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $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({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\
\mathbf{if}\;d \leq -3.9 \cdot 10^{+54}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -3.1 \cdot 10^{-167}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot {\left({\left(\frac{-1}{\ell}\right)}^{0.25} \cdot {\left(\frac{-1}{d}\right)}^{-0.25}\right)}^{2}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if d < -3.9000000000000003e54 or -3.1e-167 < d < -4.999999999999985e-310Initial program 57.0%
metadata-eval57.0%
unpow1/257.0%
metadata-eval57.0%
unpow1/257.0%
*-commutative57.0%
associate-*l*57.0%
times-frac57.6%
metadata-eval57.6%
Simplified57.6%
expm1-log1p-u29.1%
expm1-udef27.0%
Applied egg-rr24.2%
expm1-def25.3%
expm1-log1p48.8%
sub-neg48.8%
*-commutative48.8%
sub-neg48.8%
associate-*l*48.8%
*-commutative48.8%
Simplified48.8%
Taylor expanded in d around -inf 78.2%
mul-1-neg78.2%
*-commutative78.2%
distribute-rgt-neg-in78.2%
*-commutative78.2%
Simplified78.2%
if -3.9000000000000003e54 < d < -3.1e-167Initial program 78.6%
metadata-eval78.6%
unpow1/278.6%
metadata-eval78.6%
unpow1/278.6%
*-commutative78.6%
associate-*l*78.6%
times-frac78.7%
metadata-eval78.7%
Simplified78.7%
associate-*r*78.7%
frac-times78.6%
*-commutative78.6%
metadata-eval78.6%
associate-*r/82.6%
metadata-eval82.6%
*-commutative82.6%
frac-times82.6%
div-inv82.6%
metadata-eval82.6%
Applied egg-rr82.6%
metadata-eval82.6%
div-inv82.6%
associate-*r/82.6%
div-inv82.6%
metadata-eval82.6%
Applied egg-rr82.6%
pow1/282.6%
sqr-pow82.5%
pow282.5%
metadata-eval82.5%
Applied egg-rr82.5%
Taylor expanded in d around -inf 86.5%
distribute-lft-in86.5%
exp-sum86.8%
*-commutative86.8%
exp-to-pow87.7%
*-commutative87.7%
*-commutative87.7%
associate-*l*87.7%
metadata-eval87.7%
metadata-eval87.7%
metadata-eval87.7%
exp-to-pow89.6%
metadata-eval89.6%
metadata-eval89.6%
Simplified89.6%
if -4.999999999999985e-310 < d Initial program 58.1%
associate-*l*58.1%
metadata-eval58.1%
unpow1/258.1%
metadata-eval58.1%
unpow1/258.1%
associate-*l*58.1%
metadata-eval58.1%
times-frac57.3%
Simplified57.3%
sqrt-div68.1%
Applied egg-rr68.1%
Final simplification75.7%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ (* (pow (* M (* 0.5 (/ D d))) 2.0) (* 0.5 (/ h l))) -1.0))
(*
(/ (sqrt d) (sqrt h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * ((pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0);
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 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 (l <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((((m * (0.5d0 * (d_1 / d))) ** 2.0d0) * (0.5d0 * (h / l))) + (-1.0d0))
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 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 (l <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * ((Math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0);
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0)))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * ((math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0))))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) * Float64(0.5 * Float64(h / l))) + -1.0)); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 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 (l <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * ((((M * (0.5 * (D / d))) ^ 2.0) * (0.5 * (h / l))) + -1.0);
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 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[l, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 64.8%
metadata-eval64.8%
unpow1/264.8%
metadata-eval64.8%
unpow1/264.8%
*-commutative64.8%
associate-*l*64.8%
times-frac65.2%
metadata-eval65.2%
Simplified65.2%
expm1-log1p-u28.6%
expm1-udef21.4%
Applied egg-rr19.7%
expm1-def24.8%
expm1-log1p53.9%
sub-neg53.9%
*-commutative53.9%
sub-neg53.9%
associate-*l*53.9%
*-commutative53.9%
Simplified53.9%
Taylor expanded in d around -inf 75.6%
mul-1-neg75.6%
*-commutative75.6%
distribute-rgt-neg-in75.6%
*-commutative75.6%
Simplified75.6%
if -4.999999999999985e-310 < l Initial program 58.1%
associate-*l*58.1%
metadata-eval58.1%
unpow1/258.1%
metadata-eval58.1%
unpow1/258.1%
associate-*l*58.1%
metadata-eval58.1%
times-frac57.3%
Simplified57.3%
sqrt-div68.1%
Applied egg-rr68.1%
Final simplification72.1%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -1.1e-290)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ (* (pow (* M (* 0.5 (/ D d))) 2.0) (* 0.5 (/ h l))) -1.0))
(if (<= l 1.15e+95)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))))
(* d (* (pow h -0.5) (pow l -0.5))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.1e-290) {
tmp = (d * sqrt((1.0 / (h * l)))) * ((pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0);
} else if (l <= 1.15e+95) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.0)))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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 <= (-1.1d-290)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((((m * (0.5d0 * (d_1 / d))) ** 2.0d0) * (0.5d0 * (h / l))) + (-1.0d0))
else if (l <= 1.15d+95) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0)))))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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 <= -1.1e-290) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * ((Math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0);
} else if (l <= 1.15e+95) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0)))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -1.1e-290: tmp = (d * math.sqrt((1.0 / (h * l)))) * ((math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0) elif l <= 1.15e+95: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0))))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.1e-290) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) * Float64(0.5 * Float64(h / l))) + -1.0)); elseif (l <= 1.15e+95) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -1.1e-290)
tmp = (d * sqrt((1.0 / (h * l)))) * ((((M * (0.5 * (D / d))) ^ 2.0) * (0.5 * (h / l))) + -1.0);
elseif (l <= 1.15e+95)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 2.0)))));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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, -1.1e-290], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.15e+95], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.1 \cdot 10^{-290}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\
\mathbf{elif}\;\ell \leq 1.15 \cdot 10^{+95}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.1e-290Initial program 64.3%
metadata-eval64.3%
unpow1/264.3%
metadata-eval64.3%
unpow1/264.3%
*-commutative64.3%
associate-*l*64.3%
times-frac64.7%
metadata-eval64.7%
Simplified64.7%
expm1-log1p-u29.0%
expm1-udef21.7%
Applied egg-rr19.9%
expm1-def25.1%
expm1-log1p53.2%
sub-neg53.2%
*-commutative53.2%
sub-neg53.2%
associate-*l*53.2%
*-commutative53.2%
Simplified53.2%
Taylor expanded in d around -inf 75.9%
mul-1-neg75.9%
*-commutative75.9%
distribute-rgt-neg-in75.9%
*-commutative75.9%
Simplified75.9%
if -1.1e-290 < l < 1.14999999999999999e95Initial program 77.7%
associate-*l*77.7%
metadata-eval77.7%
unpow1/277.7%
metadata-eval77.7%
unpow1/277.7%
associate-*l*77.7%
metadata-eval77.7%
times-frac76.4%
Simplified76.4%
if 1.14999999999999999e95 < l Initial program 31.3%
metadata-eval31.3%
unpow1/231.3%
metadata-eval31.3%
unpow1/231.3%
*-commutative31.3%
associate-*l*31.3%
times-frac31.3%
metadata-eval31.3%
Simplified31.3%
Taylor expanded in d around inf 44.1%
*-un-lft-identity44.1%
*-commutative44.1%
Applied egg-rr44.1%
*-lft-identity44.1%
unpow-144.1%
sqr-pow44.1%
rem-sqrt-square44.1%
sqr-pow43.9%
fabs-sqr43.9%
sqr-pow44.1%
metadata-eval44.1%
Simplified44.1%
unpow-prod-down47.9%
Applied egg-rr47.9%
Final simplification70.7%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -7.5e-291)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ (* (pow (* M (* 0.5 (/ D d))) 2.0) (* 0.5 (/ h l))) -1.0))
(if (<= l 1.6e+95)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (/ h l) (pow (/ (/ (* M D) 2.0) d) 2.0))))))
(* d (* (pow h -0.5) (pow l -0.5))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -7.5e-291) {
tmp = (d * sqrt((1.0 / (h * l)))) * ((pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0);
} else if (l <= 1.6e+95) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * pow((((M * D) / 2.0) / d), 2.0)))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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 <= (-7.5d-291)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((((m * (0.5d0 * (d_1 / d))) ** 2.0d0) * (0.5d0 * (h / l))) + (-1.0d0))
else if (l <= 1.6d+95) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((h / l) * ((((m * d_1) / 2.0d0) / d) ** 2.0d0)))))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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 <= -7.5e-291) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * ((Math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0);
} else if (l <= 1.6e+95) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * Math.pow((((M * D) / 2.0) / d), 2.0)))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -7.5e-291: tmp = (d * math.sqrt((1.0 / (h * l)))) * ((math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0) elif l <= 1.6e+95: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * math.pow((((M * D) / 2.0) / d), 2.0))))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -7.5e-291) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) * Float64(0.5 * Float64(h / l))) + -1.0)); elseif (l <= 1.6e+95) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0)))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -7.5e-291)
tmp = (d * sqrt((1.0 / (h * l)))) * ((((M * (0.5 * (D / d))) ^ 2.0) * (0.5 * (h / l))) + -1.0);
elseif (l <= 1.6e+95)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * ((((M * D) / 2.0) / d) ^ 2.0)))));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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, -7.5e-291], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.6e+95], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7.5 \cdot 10^{-291}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\
\mathbf{elif}\;\ell \leq 1.6 \cdot 10^{+95}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -7.49999999999999981e-291Initial program 64.3%
metadata-eval64.3%
unpow1/264.3%
metadata-eval64.3%
unpow1/264.3%
*-commutative64.3%
associate-*l*64.3%
times-frac64.7%
metadata-eval64.7%
Simplified64.7%
expm1-log1p-u29.0%
expm1-udef21.7%
Applied egg-rr19.9%
expm1-def25.1%
expm1-log1p53.2%
sub-neg53.2%
*-commutative53.2%
sub-neg53.2%
associate-*l*53.2%
*-commutative53.2%
Simplified53.2%
Taylor expanded in d around -inf 75.9%
mul-1-neg75.9%
*-commutative75.9%
distribute-rgt-neg-in75.9%
*-commutative75.9%
Simplified75.9%
if -7.49999999999999981e-291 < l < 1.6e95Initial program 77.7%
associate-*l*77.7%
metadata-eval77.7%
unpow1/277.7%
metadata-eval77.7%
unpow1/277.7%
associate-*l*77.7%
metadata-eval77.7%
times-frac76.4%
Simplified76.4%
frac-times77.7%
associate-/r*77.7%
Applied egg-rr77.7%
if 1.6e95 < l Initial program 31.3%
metadata-eval31.3%
unpow1/231.3%
metadata-eval31.3%
unpow1/231.3%
*-commutative31.3%
associate-*l*31.3%
times-frac31.3%
metadata-eval31.3%
Simplified31.3%
Taylor expanded in d around inf 44.1%
*-un-lft-identity44.1%
*-commutative44.1%
Applied egg-rr44.1%
*-lft-identity44.1%
unpow-144.1%
sqr-pow44.1%
rem-sqrt-square44.1%
sqr-pow43.9%
fabs-sqr43.9%
sqr-pow44.1%
metadata-eval44.1%
Simplified44.1%
unpow-prod-down47.9%
Applied egg-rr47.9%
Final simplification71.1%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -1.4e-290)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ (* (pow (* M (* 0.5 (/ D d))) 2.0) (* 0.5 (/ h l))) -1.0))
(if (<= l 1.6e+95)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (/ (* h (* 0.5 (pow (* (/ D d) (* M 0.5)) 2.0))) l)))
(* d (* (pow h -0.5) (pow l -0.5))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.4e-290) {
tmp = (d * sqrt((1.0 / (h * l)))) * ((pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0);
} else if (l <= 1.6e+95) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((h * (0.5 * pow(((D / d) * (M * 0.5)), 2.0))) / l));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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 <= (-1.4d-290)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((((m * (0.5d0 * (d_1 / d))) ** 2.0d0) * (0.5d0 * (h / l))) + (-1.0d0))
else if (l <= 1.6d+95) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - ((h * (0.5d0 * (((d_1 / d) * (m * 0.5d0)) ** 2.0d0))) / l))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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 <= -1.4e-290) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * ((Math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0);
} else if (l <= 1.6e+95) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - ((h * (0.5 * Math.pow(((D / d) * (M * 0.5)), 2.0))) / l));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -1.4e-290: tmp = (d * math.sqrt((1.0 / (h * l)))) * ((math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0) elif l <= 1.6e+95: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - ((h * (0.5 * math.pow(((D / d) * (M * 0.5)), 2.0))) / l)) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.4e-290) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) * Float64(0.5 * Float64(h / l))) + -1.0)); elseif (l <= 1.6e+95) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0))) / l))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -1.4e-290)
tmp = (d * sqrt((1.0 / (h * l)))) * ((((M * (0.5 * (D / d))) ^ 2.0) * (0.5 * (h / l))) + -1.0);
elseif (l <= 1.6e+95)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((h * (0.5 * (((D / d) * (M * 0.5)) ^ 2.0))) / l));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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, -1.4e-290], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.6e+95], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.4 \cdot 10^{-290}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\
\mathbf{elif}\;\ell \leq 1.6 \cdot 10^{+95}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.39999999999999998e-290Initial program 64.3%
metadata-eval64.3%
unpow1/264.3%
metadata-eval64.3%
unpow1/264.3%
*-commutative64.3%
associate-*l*64.3%
times-frac64.7%
metadata-eval64.7%
Simplified64.7%
expm1-log1p-u29.0%
expm1-udef21.7%
Applied egg-rr19.9%
expm1-def25.1%
expm1-log1p53.2%
sub-neg53.2%
*-commutative53.2%
sub-neg53.2%
associate-*l*53.2%
*-commutative53.2%
Simplified53.2%
Taylor expanded in d around -inf 75.9%
mul-1-neg75.9%
*-commutative75.9%
distribute-rgt-neg-in75.9%
*-commutative75.9%
Simplified75.9%
if -1.39999999999999998e-290 < l < 1.6e95Initial program 77.7%
metadata-eval77.7%
unpow1/277.7%
metadata-eval77.7%
unpow1/277.7%
*-commutative77.7%
associate-*l*77.7%
times-frac76.4%
metadata-eval76.4%
Simplified76.4%
associate-*r*76.4%
frac-times77.7%
*-commutative77.7%
metadata-eval77.7%
associate-*r/82.1%
metadata-eval82.1%
*-commutative82.1%
frac-times80.8%
div-inv80.8%
metadata-eval80.8%
Applied egg-rr80.8%
if 1.6e95 < l Initial program 31.3%
metadata-eval31.3%
unpow1/231.3%
metadata-eval31.3%
unpow1/231.3%
*-commutative31.3%
associate-*l*31.3%
times-frac31.3%
metadata-eval31.3%
Simplified31.3%
Taylor expanded in d around inf 44.1%
*-un-lft-identity44.1%
*-commutative44.1%
Applied egg-rr44.1%
*-lft-identity44.1%
unpow-144.1%
sqr-pow44.1%
rem-sqrt-square44.1%
sqr-pow43.9%
fabs-sqr43.9%
sqr-pow44.1%
metadata-eval44.1%
Simplified44.1%
unpow-prod-down47.9%
Applied egg-rr47.9%
Final simplification71.9%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -9.5e-291)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ (* (pow (* M (* 0.5 (/ D d))) 2.0) (* 0.5 (/ h l))) -1.0))
(if (<= l 1.6e+95)
(*
(- 1.0 (/ (* h (* 0.5 (pow (/ (* D (* M 0.5)) d) 2.0))) l))
(* (sqrt (/ d h)) (sqrt (/ d l))))
(* d (* (pow h -0.5) (pow l -0.5))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -9.5e-291) {
tmp = (d * sqrt((1.0 / (h * l)))) * ((pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0);
} else if (l <= 1.6e+95) {
tmp = (1.0 - ((h * (0.5 * pow(((D * (M * 0.5)) / d), 2.0))) / l)) * (sqrt((d / h)) * sqrt((d / l)));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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 <= (-9.5d-291)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((((m * (0.5d0 * (d_1 / d))) ** 2.0d0) * (0.5d0 * (h / l))) + (-1.0d0))
else if (l <= 1.6d+95) then
tmp = (1.0d0 - ((h * (0.5d0 * (((d_1 * (m * 0.5d0)) / d) ** 2.0d0))) / l)) * (sqrt((d / h)) * sqrt((d / l)))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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 <= -9.5e-291) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * ((Math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0);
} else if (l <= 1.6e+95) {
tmp = (1.0 - ((h * (0.5 * Math.pow(((D * (M * 0.5)) / d), 2.0))) / l)) * (Math.sqrt((d / h)) * Math.sqrt((d / l)));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -9.5e-291: tmp = (d * math.sqrt((1.0 / (h * l)))) * ((math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0) elif l <= 1.6e+95: tmp = (1.0 - ((h * (0.5 * math.pow(((D * (M * 0.5)) / d), 2.0))) / l)) * (math.sqrt((d / h)) * math.sqrt((d / l))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -9.5e-291) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) * Float64(0.5 * Float64(h / l))) + -1.0)); elseif (l <= 1.6e+95) tmp = Float64(Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(D * Float64(M * 0.5)) / d) ^ 2.0))) / l)) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -9.5e-291)
tmp = (d * sqrt((1.0 / (h * l)))) * ((((M * (0.5 * (D / d))) ^ 2.0) * (0.5 * (h / l))) + -1.0);
elseif (l <= 1.6e+95)
tmp = (1.0 - ((h * (0.5 * (((D * (M * 0.5)) / d) ^ 2.0))) / l)) * (sqrt((d / h)) * sqrt((d / l)));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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, -9.5e-291], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.6e+95], N[(N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(D * N[(M * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9.5 \cdot 10^{-291}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\
\mathbf{elif}\;\ell \leq 1.6 \cdot 10^{+95}:\\
\;\;\;\;\left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2}\right)}{\ell}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -9.49999999999999938e-291Initial program 64.3%
metadata-eval64.3%
unpow1/264.3%
metadata-eval64.3%
unpow1/264.3%
*-commutative64.3%
associate-*l*64.3%
times-frac64.7%
metadata-eval64.7%
Simplified64.7%
expm1-log1p-u29.0%
expm1-udef21.7%
Applied egg-rr19.9%
expm1-def25.1%
expm1-log1p53.2%
sub-neg53.2%
*-commutative53.2%
sub-neg53.2%
associate-*l*53.2%
*-commutative53.2%
Simplified53.2%
Taylor expanded in d around -inf 75.9%
mul-1-neg75.9%
*-commutative75.9%
distribute-rgt-neg-in75.9%
*-commutative75.9%
Simplified75.9%
if -9.49999999999999938e-291 < l < 1.6e95Initial program 77.7%
metadata-eval77.7%
unpow1/277.7%
metadata-eval77.7%
unpow1/277.7%
*-commutative77.7%
associate-*l*77.7%
times-frac76.4%
metadata-eval76.4%
Simplified76.4%
associate-*r*76.4%
frac-times77.7%
*-commutative77.7%
metadata-eval77.7%
associate-*r/82.1%
metadata-eval82.1%
*-commutative82.1%
frac-times80.8%
div-inv80.8%
metadata-eval80.8%
Applied egg-rr80.8%
metadata-eval80.8%
div-inv80.8%
associate-*r/82.1%
div-inv82.1%
metadata-eval82.1%
Applied egg-rr82.1%
if 1.6e95 < l Initial program 31.3%
metadata-eval31.3%
unpow1/231.3%
metadata-eval31.3%
unpow1/231.3%
*-commutative31.3%
associate-*l*31.3%
times-frac31.3%
metadata-eval31.3%
Simplified31.3%
Taylor expanded in d around inf 44.1%
*-un-lft-identity44.1%
*-commutative44.1%
Applied egg-rr44.1%
*-lft-identity44.1%
unpow-144.1%
sqr-pow44.1%
rem-sqrt-square44.1%
sqr-pow43.9%
fabs-sqr43.9%
sqr-pow44.1%
metadata-eval44.1%
Simplified44.1%
unpow-prod-down47.9%
Applied egg-rr47.9%
Final simplification72.3%
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 (* M (* 0.5 (/ D d))) 2.0)))
(if (<= d -5e-310)
(* (* d (sqrt (/ 1.0 (* h l)))) (+ (* t_0 (* 0.5 (/ h l))) -1.0))
(if (<= d 1e-157)
(* -0.125 (/ (* (* M D) (* M D)) (/ d (sqrt (/ h (pow l 3.0))))))
(if (<= d 1.9e-53)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* 0.125 (* (* (/ D d) (/ D d)) (* h (/ M (/ l M)))))))
(if (<= d 6.7e+184)
(* (sqrt (/ d (/ (* h l) d))) (- 1.0 (/ 0.5 (/ (/ l h) t_0))))
(* d (* (pow h -0.5) (pow l -0.5)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((M * (0.5 * (D / d))), 2.0);
double tmp;
if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * ((t_0 * (0.5 * (h / l))) + -1.0);
} else if (d <= 1e-157) {
tmp = -0.125 * (((M * D) * (M * D)) / (d / sqrt((h / pow(l, 3.0)))));
} else if (d <= 1.9e-53) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.125 * (((D / d) * (D / d)) * (h * (M / (l / M))))));
} else if (d <= 6.7e+184) {
tmp = sqrt((d / ((h * l) / d))) * (1.0 - (0.5 / ((l / h) / t_0)));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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 = (m * (0.5d0 * (d_1 / d))) ** 2.0d0
if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((t_0 * (0.5d0 * (h / l))) + (-1.0d0))
else if (d <= 1d-157) then
tmp = (-0.125d0) * (((m * d_1) * (m * d_1)) / (d / sqrt((h / (l ** 3.0d0)))))
else if (d <= 1.9d-53) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (0.125d0 * (((d_1 / d) * (d_1 / d)) * (h * (m / (l / m))))))
else if (d <= 6.7d+184) then
tmp = sqrt((d / ((h * l) / d))) * (1.0d0 - (0.5d0 / ((l / h) / t_0)))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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((M * (0.5 * (D / d))), 2.0);
double tmp;
if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * ((t_0 * (0.5 * (h / l))) + -1.0);
} else if (d <= 1e-157) {
tmp = -0.125 * (((M * D) * (M * D)) / (d / Math.sqrt((h / Math.pow(l, 3.0)))));
} else if (d <= 1.9e-53) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (0.125 * (((D / d) * (D / d)) * (h * (M / (l / M))))));
} else if (d <= 6.7e+184) {
tmp = Math.sqrt((d / ((h * l) / d))) * (1.0 - (0.5 / ((l / h) / t_0)));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow((M * (0.5 * (D / d))), 2.0) tmp = 0 if d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * ((t_0 * (0.5 * (h / l))) + -1.0) elif d <= 1e-157: tmp = -0.125 * (((M * D) * (M * D)) / (d / math.sqrt((h / math.pow(l, 3.0))))) elif d <= 1.9e-53: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (0.125 * (((D / d) * (D / d)) * (h * (M / (l / M)))))) elif d <= 6.7e+184: tmp = math.sqrt((d / ((h * l) / d))) * (1.0 - (0.5 / ((l / h) / t_0))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0 tmp = 0.0 if (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(Float64(t_0 * Float64(0.5 * Float64(h / l))) + -1.0)); elseif (d <= 1e-157) tmp = Float64(-0.125 * Float64(Float64(Float64(M * D) * Float64(M * D)) / Float64(d / sqrt(Float64(h / (l ^ 3.0)))))); elseif (d <= 1.9e-53) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(h * Float64(M / Float64(l / M))))))); elseif (d <= 6.7e+184) tmp = Float64(sqrt(Float64(d / Float64(Float64(h * l) / d))) * Float64(1.0 - Float64(0.5 / Float64(Float64(l / h) / t_0)))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (M * (0.5 * (D / d))) ^ 2.0;
tmp = 0.0;
if (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * ((t_0 * (0.5 * (h / l))) + -1.0);
elseif (d <= 1e-157)
tmp = -0.125 * (((M * D) * (M * D)) / (d / sqrt((h / (l ^ 3.0)))));
elseif (d <= 1.9e-53)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.125 * (((D / d) * (D / d)) * (h * (M / (l / M))))));
elseif (d <= 6.7e+184)
tmp = sqrt((d / ((h * l) / d))) * (1.0 - (0.5 / ((l / h) / t_0)));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1e-157], N[(-0.125 * N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(d / N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.9e-53], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.7e+184], N[(N[Sqrt[N[(d / N[(N[(h * l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 / N[(N[(l / h), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\\
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(t_0 \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\
\mathbf{elif}\;d \leq 10^{-157}:\\
\;\;\;\;-0.125 \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\
\mathbf{elif}\;d \leq 1.9 \cdot 10^{-53}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \frac{M}{\frac{\ell}{M}}\right)\right)\right)\\
\mathbf{elif}\;d \leq 6.7 \cdot 10^{+184}:\\
\;\;\;\;\sqrt{\frac{d}{\frac{h \cdot \ell}{d}}} \cdot \left(1 - \frac{0.5}{\frac{\frac{\ell}{h}}{t_0}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 64.8%
metadata-eval64.8%
unpow1/264.8%
metadata-eval64.8%
unpow1/264.8%
*-commutative64.8%
associate-*l*64.8%
times-frac65.2%
metadata-eval65.2%
Simplified65.2%
expm1-log1p-u28.6%
expm1-udef21.4%
Applied egg-rr19.7%
expm1-def24.8%
expm1-log1p53.9%
sub-neg53.9%
*-commutative53.9%
sub-neg53.9%
associate-*l*53.9%
*-commutative53.9%
Simplified53.9%
Taylor expanded in d around -inf 75.6%
mul-1-neg75.6%
*-commutative75.6%
distribute-rgt-neg-in75.6%
*-commutative75.6%
Simplified75.6%
if -4.999999999999985e-310 < d < 9.99999999999999943e-158Initial program 32.0%
metadata-eval32.0%
unpow1/232.0%
metadata-eval32.0%
unpow1/232.0%
*-commutative32.0%
associate-*l*32.0%
times-frac32.0%
metadata-eval32.0%
Simplified32.0%
associate-*r*32.0%
frac-times32.0%
*-commutative32.0%
metadata-eval32.0%
associate-*r/32.0%
metadata-eval32.0%
*-commutative32.0%
frac-times32.0%
div-inv32.0%
metadata-eval32.0%
Applied egg-rr32.0%
Taylor expanded in d around 0 32.1%
associate-*l/34.8%
associate-/l*34.8%
unpow234.8%
unpow234.8%
unswap-sqr47.0%
Simplified47.0%
if 9.99999999999999943e-158 < d < 1.8999999999999999e-53Initial program 59.2%
metadata-eval59.2%
unpow1/259.2%
metadata-eval59.2%
unpow1/259.2%
*-commutative59.2%
associate-*l*59.2%
times-frac55.4%
metadata-eval55.4%
Simplified55.4%
associate-*r*55.4%
frac-times59.2%
*-commutative59.2%
metadata-eval59.2%
associate-*r/63.6%
metadata-eval63.6%
*-commutative63.6%
frac-times59.7%
div-inv59.7%
metadata-eval59.7%
Applied egg-rr59.7%
metadata-eval59.7%
div-inv59.7%
associate-*r/63.6%
div-inv63.6%
metadata-eval63.6%
Applied egg-rr63.6%
Taylor expanded in M around 0 46.9%
*-commutative46.9%
times-frac47.2%
unpow247.2%
unpow247.2%
times-frac47.1%
associate-*l/46.5%
*-commutative46.5%
unpow246.5%
associate-/l*51.7%
Simplified51.7%
if 1.8999999999999999e-53 < d < 6.7e184Initial program 77.9%
metadata-eval77.9%
unpow1/277.9%
metadata-eval77.9%
unpow1/277.9%
*-commutative77.9%
associate-*l*77.9%
times-frac77.9%
metadata-eval77.9%
Simplified77.9%
associate-*r*77.9%
frac-times77.9%
*-commutative77.9%
metadata-eval77.9%
associate-*r/73.2%
metadata-eval73.2%
*-commutative73.2%
frac-times73.2%
div-inv73.2%
metadata-eval73.2%
Applied egg-rr73.2%
metadata-eval73.2%
div-inv73.2%
associate-*r/73.2%
div-inv73.2%
metadata-eval73.2%
Applied egg-rr73.2%
pow173.2%
sqrt-unprod65.8%
*-commutative65.8%
frac-times73.0%
*-commutative73.0%
associate-/l*75.5%
*-commutative75.5%
associate-*r/75.5%
associate-*r*75.5%
Applied egg-rr75.5%
sub-neg75.5%
sub-neg75.5%
associate-/l*73.0%
associate-*r/75.4%
unpow175.4%
associate-/l*75.5%
Simplified75.5%
if 6.7e184 < d Initial program 61.2%
metadata-eval61.2%
unpow1/261.2%
metadata-eval61.2%
unpow1/261.2%
*-commutative61.2%
associate-*l*61.2%
times-frac61.2%
metadata-eval61.2%
Simplified61.2%
Taylor expanded in d around inf 75.2%
*-un-lft-identity75.2%
*-commutative75.2%
Applied egg-rr75.2%
*-lft-identity75.2%
unpow-175.2%
sqr-pow75.3%
rem-sqrt-square75.3%
sqr-pow75.1%
fabs-sqr75.1%
sqr-pow75.3%
metadata-eval75.3%
Simplified75.3%
unpow-prod-down84.9%
Applied egg-rr84.9%
Final simplification70.3%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ (* (pow (* M (* 0.5 (/ D d))) 2.0) (* 0.5 (/ h l))) -1.0))
(if (<= d 2.8e-157)
(* -0.125 (/ (* (* M D) (* M D)) (/ d (sqrt (/ h (pow l 3.0))))))
(if (<= d 4.2e+181)
(*
(sqrt (* d (/ d (* h l))))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (/ d 0.5))) 2.0)))))
(* d (* (pow h -0.5) (pow l -0.5)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * ((pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0);
} else if (d <= 2.8e-157) {
tmp = -0.125 * (((M * D) * (M * D)) / (d / sqrt((h / pow(l, 3.0)))));
} else if (d <= 4.2e+181) {
tmp = sqrt((d * (d / (h * l)))) * (1.0 + (-0.5 * ((h / l) * pow((D * (M / (d / 0.5))), 2.0))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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 <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((((m * (0.5d0 * (d_1 / d))) ** 2.0d0) * (0.5d0 * (h / l))) + (-1.0d0))
else if (d <= 2.8d-157) then
tmp = (-0.125d0) * (((m * d_1) * (m * d_1)) / (d / sqrt((h / (l ** 3.0d0)))))
else if (d <= 4.2d+181) then
tmp = sqrt((d * (d / (h * l)))) * (1.0d0 + ((-0.5d0) * ((h / l) * ((d_1 * (m / (d / 0.5d0))) ** 2.0d0))))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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 <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * ((Math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0);
} else if (d <= 2.8e-157) {
tmp = -0.125 * (((M * D) * (M * D)) / (d / Math.sqrt((h / Math.pow(l, 3.0)))));
} else if (d <= 4.2e+181) {
tmp = Math.sqrt((d * (d / (h * l)))) * (1.0 + (-0.5 * ((h / l) * Math.pow((D * (M / (d / 0.5))), 2.0))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * ((math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l))) + -1.0) elif d <= 2.8e-157: tmp = -0.125 * (((M * D) * (M * D)) / (d / math.sqrt((h / math.pow(l, 3.0))))) elif d <= 4.2e+181: tmp = math.sqrt((d * (d / (h * l)))) * (1.0 + (-0.5 * ((h / l) * math.pow((D * (M / (d / 0.5))), 2.0)))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) * Float64(0.5 * Float64(h / l))) + -1.0)); elseif (d <= 2.8e-157) tmp = Float64(-0.125 * Float64(Float64(Float64(M * D) * Float64(M * D)) / Float64(d / sqrt(Float64(h / (l ^ 3.0)))))); elseif (d <= 4.2e+181) tmp = Float64(sqrt(Float64(d * Float64(d / Float64(h * l)))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(d / 0.5))) ^ 2.0))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * ((((M * (0.5 * (D / d))) ^ 2.0) * (0.5 * (h / l))) + -1.0);
elseif (d <= 2.8e-157)
tmp = -0.125 * (((M * D) * (M * D)) / (d / sqrt((h / (l ^ 3.0)))));
elseif (d <= 4.2e+181)
tmp = sqrt((d * (d / (h * l)))) * (1.0 + (-0.5 * ((h / l) * ((D * (M / (d / 0.5))) ^ 2.0))));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.8e-157], N[(-0.125 * N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(d / N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.2e+181], N[(N[Sqrt[N[(d * N[(d / 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[(d / 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\
\mathbf{elif}\;d \leq 2.8 \cdot 10^{-157}:\\
\;\;\;\;-0.125 \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\
\mathbf{elif}\;d \leq 4.2 \cdot 10^{+181}:\\
\;\;\;\;\sqrt{d \cdot \frac{d}{h \cdot \ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{\frac{d}{0.5}}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 64.8%
metadata-eval64.8%
unpow1/264.8%
metadata-eval64.8%
unpow1/264.8%
*-commutative64.8%
associate-*l*64.8%
times-frac65.2%
metadata-eval65.2%
Simplified65.2%
expm1-log1p-u28.6%
expm1-udef21.4%
Applied egg-rr19.7%
expm1-def24.8%
expm1-log1p53.9%
sub-neg53.9%
*-commutative53.9%
sub-neg53.9%
associate-*l*53.9%
*-commutative53.9%
Simplified53.9%
Taylor expanded in d around -inf 75.6%
mul-1-neg75.6%
*-commutative75.6%
distribute-rgt-neg-in75.6%
*-commutative75.6%
Simplified75.6%
if -4.999999999999985e-310 < d < 2.8000000000000001e-157Initial program 32.0%
metadata-eval32.0%
unpow1/232.0%
metadata-eval32.0%
unpow1/232.0%
*-commutative32.0%
associate-*l*32.0%
times-frac32.0%
metadata-eval32.0%
Simplified32.0%
associate-*r*32.0%
frac-times32.0%
*-commutative32.0%
metadata-eval32.0%
associate-*r/32.0%
metadata-eval32.0%
*-commutative32.0%
frac-times32.0%
div-inv32.0%
metadata-eval32.0%
Applied egg-rr32.0%
Taylor expanded in d around 0 32.1%
associate-*l/34.8%
associate-/l*34.8%
unpow234.8%
unpow234.8%
unswap-sqr47.0%
Simplified47.0%
if 2.8000000000000001e-157 < d < 4.19999999999999995e181Initial program 70.9%
metadata-eval70.9%
unpow1/270.9%
metadata-eval70.9%
unpow1/270.9%
*-commutative70.9%
associate-*l*70.9%
times-frac69.5%
metadata-eval69.5%
Simplified69.5%
associate-*r*69.5%
frac-times70.9%
*-commutative70.9%
metadata-eval70.9%
associate-*r/69.6%
metadata-eval69.6%
*-commutative69.6%
frac-times68.1%
div-inv68.1%
metadata-eval68.1%
Applied egg-rr68.1%
metadata-eval68.1%
div-inv68.1%
associate-*r/69.6%
div-inv69.6%
metadata-eval69.6%
Applied egg-rr69.6%
pow169.6%
sqrt-unprod59.2%
*-commutative59.2%
frac-times61.1%
*-commutative61.1%
associate-/l*61.0%
*-commutative61.0%
associate-*r/60.4%
associate-*r*60.4%
Applied egg-rr60.4%
associate-/l*60.4%
associate-*r/60.3%
unpow160.3%
associate-/l*60.7%
associate-/r/60.6%
associate-*l*60.6%
cancel-sign-sub-inv60.6%
metadata-eval60.6%
Simplified61.2%
if 4.19999999999999995e181 < d Initial program 61.2%
metadata-eval61.2%
unpow1/261.2%
metadata-eval61.2%
unpow1/261.2%
*-commutative61.2%
associate-*l*61.2%
times-frac61.2%
metadata-eval61.2%
Simplified61.2%
Taylor expanded in d around inf 75.2%
*-un-lft-identity75.2%
*-commutative75.2%
Applied egg-rr75.2%
*-lft-identity75.2%
unpow-175.2%
sqr-pow75.3%
rem-sqrt-square75.3%
sqr-pow75.1%
fabs-sqr75.1%
sqr-pow75.3%
metadata-eval75.3%
Simplified75.3%
unpow-prod-down84.9%
Applied egg-rr84.9%
Final simplification68.9%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 1.02e-25)
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* (pow (/ D (* 2.0 (/ d M))) 2.0) (/ 0.5 (/ l h)))))
(if (<= l 8e+101)
(* -0.125 (/ (* (* M D) (* M D)) (/ d (sqrt (/ h (pow l 3.0))))))
(if (<= l 1.25e+162)
(* d (* (pow h -0.5) (pow l -0.5)))
(* d (/ 1.0 (* (sqrt h) (sqrt l))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.02e-25) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (pow((D / (2.0 * (d / M))), 2.0) * (0.5 / (l / h))));
} else if (l <= 8e+101) {
tmp = -0.125 * (((M * D) * (M * D)) / (d / sqrt((h / pow(l, 3.0)))));
} else if (l <= 1.25e+162) {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
} else {
tmp = d * (1.0 / (sqrt(h) * 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 <= 1.02d-25) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (((d_1 / (2.0d0 * (d / m))) ** 2.0d0) * (0.5d0 / (l / h))))
else if (l <= 8d+101) then
tmp = (-0.125d0) * (((m * d_1) * (m * d_1)) / (d / sqrt((h / (l ** 3.0d0)))))
else if (l <= 1.25d+162) then
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
else
tmp = d * (1.0d0 / (sqrt(h) * 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 <= 1.02e-25) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (Math.pow((D / (2.0 * (d / M))), 2.0) * (0.5 / (l / h))));
} else if (l <= 8e+101) {
tmp = -0.125 * (((M * D) * (M * D)) / (d / Math.sqrt((h / Math.pow(l, 3.0)))));
} else if (l <= 1.25e+162) {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
} else {
tmp = d * (1.0 / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 1.02e-25: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (math.pow((D / (2.0 * (d / M))), 2.0) * (0.5 / (l / h)))) elif l <= 8e+101: tmp = -0.125 * (((M * D) * (M * D)) / (d / math.sqrt((h / math.pow(l, 3.0))))) elif l <= 1.25e+162: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) else: tmp = d * (1.0 / (math.sqrt(h) * math.sqrt(l))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 1.02e-25) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64((Float64(D / Float64(2.0 * Float64(d / M))) ^ 2.0) * Float64(0.5 / Float64(l / h))))); elseif (l <= 8e+101) tmp = Float64(-0.125 * Float64(Float64(Float64(M * D) * Float64(M * D)) / Float64(d / sqrt(Float64(h / (l ^ 3.0)))))); elseif (l <= 1.25e+162) tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); else tmp = Float64(d * Float64(1.0 / Float64(sqrt(h) * 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 <= 1.02e-25)
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (((D / (2.0 * (d / M))) ^ 2.0) * (0.5 / (l / h))));
elseif (l <= 8e+101)
tmp = -0.125 * (((M * D) * (M * D)) / (d / sqrt((h / (l ^ 3.0)))));
elseif (l <= 1.25e+162)
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
else
tmp = d * (1.0 / (sqrt(h) * 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, 1.02e-25], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[Power[N[(D / N[(2.0 * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8e+101], N[(-0.125 * N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(d / N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.25e+162], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(1.0 / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.02 \cdot 10^{-25}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\frac{D}{2 \cdot \frac{d}{M}}\right)}^{2} \cdot \frac{0.5}{\frac{\ell}{h}}\right)\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{+101}:\\
\;\;\;\;-0.125 \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\
\mathbf{elif}\;\ell \leq 1.25 \cdot 10^{+162}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 1.01999999999999998e-25Initial program 69.3%
metadata-eval69.3%
unpow1/269.3%
metadata-eval69.3%
unpow1/269.3%
*-commutative69.3%
associate-*l*69.3%
times-frac69.1%
metadata-eval69.1%
Simplified69.1%
frac-times69.3%
associate-/l*69.2%
*-commutative69.2%
Applied egg-rr69.2%
associate-/l*69.3%
associate-/r*69.3%
*-commutative69.3%
associate-/l*69.3%
associate-/l/69.3%
Simplified69.3%
pow169.3%
sqrt-unprod59.6%
associate-*r/59.6%
Applied egg-rr59.6%
unpow159.6%
associate-/l*59.6%
Simplified59.6%
if 1.01999999999999998e-25 < l < 7.9999999999999998e101Initial program 60.7%
metadata-eval60.7%
unpow1/260.7%
metadata-eval60.7%
unpow1/260.7%
*-commutative60.7%
associate-*l*60.7%
times-frac60.7%
metadata-eval60.7%
Simplified60.7%
associate-*r*60.7%
frac-times60.7%
*-commutative60.7%
metadata-eval60.7%
associate-*r/61.1%
metadata-eval61.1%
*-commutative61.1%
frac-times61.1%
div-inv61.1%
metadata-eval61.1%
Applied egg-rr61.1%
Taylor expanded in d around 0 48.5%
associate-*l/53.8%
associate-/l*53.8%
unpow253.8%
unpow253.8%
unswap-sqr70.9%
Simplified70.9%
if 7.9999999999999998e101 < l < 1.2499999999999999e162Initial program 27.6%
metadata-eval27.6%
unpow1/227.6%
metadata-eval27.6%
unpow1/227.6%
*-commutative27.6%
associate-*l*27.6%
times-frac27.6%
metadata-eval27.6%
Simplified27.6%
Taylor expanded in d around inf 50.8%
*-un-lft-identity50.8%
*-commutative50.8%
Applied egg-rr50.8%
*-lft-identity50.8%
unpow-150.8%
sqr-pow50.8%
rem-sqrt-square50.8%
sqr-pow50.7%
fabs-sqr50.7%
sqr-pow50.8%
metadata-eval50.8%
Simplified50.8%
unpow-prod-down51.0%
Applied egg-rr51.0%
if 1.2499999999999999e162 < l Initial program 33.7%
metadata-eval33.7%
unpow1/233.7%
metadata-eval33.7%
unpow1/233.7%
*-commutative33.7%
associate-*l*33.7%
times-frac33.7%
metadata-eval33.7%
Simplified33.7%
Taylor expanded in d around inf 42.6%
sqrt-div42.5%
metadata-eval42.5%
*-commutative42.5%
Applied egg-rr42.5%
sqrt-prod48.1%
Applied egg-rr48.1%
Final simplification58.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 9.5e-26)
(*
(- 1.0 (* (pow (* M (* 0.5 (/ D d))) 2.0) (* 0.5 (/ h l))))
(sqrt (* (/ d h) (/ d l))))
(if (<= l 1.75e+95)
(* -0.125 (/ (* (* M D) (* M D)) (/ d (sqrt (/ h (pow l 3.0))))))
(* d (* (pow h -0.5) (pow l -0.5))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 9.5e-26) {
tmp = (1.0 - (pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l)))) * sqrt(((d / h) * (d / l)));
} else if (l <= 1.75e+95) {
tmp = -0.125 * (((M * D) * (M * D)) / (d / sqrt((h / pow(l, 3.0)))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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 <= 9.5d-26) then
tmp = (1.0d0 - (((m * (0.5d0 * (d_1 / d))) ** 2.0d0) * (0.5d0 * (h / l)))) * sqrt(((d / h) * (d / l)))
else if (l <= 1.75d+95) then
tmp = (-0.125d0) * (((m * d_1) * (m * d_1)) / (d / sqrt((h / (l ** 3.0d0)))))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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 <= 9.5e-26) {
tmp = (1.0 - (Math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l)))) * Math.sqrt(((d / h) * (d / l)));
} else if (l <= 1.75e+95) {
tmp = -0.125 * (((M * D) * (M * D)) / (d / Math.sqrt((h / Math.pow(l, 3.0)))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 9.5e-26: tmp = (1.0 - (math.pow((M * (0.5 * (D / d))), 2.0) * (0.5 * (h / l)))) * math.sqrt(((d / h) * (d / l))) elif l <= 1.75e+95: tmp = -0.125 * (((M * D) * (M * D)) / (d / math.sqrt((h / math.pow(l, 3.0))))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 9.5e-26) tmp = Float64(Float64(1.0 - Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) * Float64(0.5 * Float64(h / l)))) * sqrt(Float64(Float64(d / h) * Float64(d / l)))); elseif (l <= 1.75e+95) tmp = Float64(-0.125 * Float64(Float64(Float64(M * D) * Float64(M * D)) / Float64(d / sqrt(Float64(h / (l ^ 3.0)))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 9.5e-26)
tmp = (1.0 - (((M * (0.5 * (D / d))) ^ 2.0) * (0.5 * (h / l)))) * sqrt(((d / h) * (d / l)));
elseif (l <= 1.75e+95)
tmp = -0.125 * (((M * D) * (M * D)) / (d / sqrt((h / (l ^ 3.0)))));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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, 9.5e-26], N[(N[(1.0 - N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.75e+95], N[(-0.125 * N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(d / N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 9.5 \cdot 10^{-26}:\\
\;\;\;\;\left(1 - {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 1.75 \cdot 10^{+95}:\\
\;\;\;\;-0.125 \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < 9.4999999999999995e-26Initial program 69.3%
metadata-eval69.3%
unpow1/269.3%
metadata-eval69.3%
unpow1/269.3%
*-commutative69.3%
associate-*l*69.3%
times-frac69.1%
metadata-eval69.1%
Simplified69.1%
expm1-log1p-u29.2%
expm1-udef22.0%
Applied egg-rr19.8%
expm1-def24.7%
expm1-log1p59.1%
sub-neg59.1%
*-commutative59.1%
sub-neg59.1%
associate-*l*59.1%
*-commutative59.1%
Simplified59.1%
if 9.4999999999999995e-26 < l < 1.75e95Initial program 60.7%
metadata-eval60.7%
unpow1/260.7%
metadata-eval60.7%
unpow1/260.7%
*-commutative60.7%
associate-*l*60.7%
times-frac60.7%
metadata-eval60.7%
Simplified60.7%
associate-*r*60.7%
frac-times60.7%
*-commutative60.7%
metadata-eval60.7%
associate-*r/61.1%
metadata-eval61.1%
*-commutative61.1%
frac-times61.1%
div-inv61.1%
metadata-eval61.1%
Applied egg-rr61.1%
Taylor expanded in d around 0 48.5%
associate-*l/53.8%
associate-/l*53.8%
unpow253.8%
unpow253.8%
unswap-sqr70.9%
Simplified70.9%
if 1.75e95 < l Initial program 31.9%
metadata-eval31.9%
unpow1/231.9%
metadata-eval31.9%
unpow1/231.9%
*-commutative31.9%
associate-*l*31.9%
times-frac31.9%
metadata-eval31.9%
Simplified31.9%
Taylor expanded in d around inf 45.0%
*-un-lft-identity45.0%
*-commutative45.0%
Applied egg-rr45.0%
*-lft-identity45.0%
unpow-145.0%
sqr-pow45.0%
rem-sqrt-square45.0%
sqr-pow44.8%
fabs-sqr44.8%
sqr-pow45.0%
metadata-eval45.0%
Simplified45.0%
unpow-prod-down48.8%
Applied egg-rr48.8%
Final simplification58.0%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 1.25e-26)
(*
(sqrt (/ (/ d h) (/ l d)))
(- 1.0 (* (pow (/ (/ M (/ d D)) 2.0) 2.0) (* h (/ 0.5 l)))))
(if (<= l 5.5e+98)
(* -0.125 (/ (* (* M D) (* M D)) (/ d (sqrt (/ h (pow l 3.0))))))
(* d (* (pow h -0.5) (pow l -0.5))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.25e-26) {
tmp = sqrt(((d / h) / (l / d))) * (1.0 - (pow(((M / (d / D)) / 2.0), 2.0) * (h * (0.5 / l))));
} else if (l <= 5.5e+98) {
tmp = -0.125 * (((M * D) * (M * D)) / (d / sqrt((h / pow(l, 3.0)))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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 <= 1.25d-26) then
tmp = sqrt(((d / h) / (l / d))) * (1.0d0 - ((((m / (d / d_1)) / 2.0d0) ** 2.0d0) * (h * (0.5d0 / l))))
else if (l <= 5.5d+98) then
tmp = (-0.125d0) * (((m * d_1) * (m * d_1)) / (d / sqrt((h / (l ** 3.0d0)))))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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 <= 1.25e-26) {
tmp = Math.sqrt(((d / h) / (l / d))) * (1.0 - (Math.pow(((M / (d / D)) / 2.0), 2.0) * (h * (0.5 / l))));
} else if (l <= 5.5e+98) {
tmp = -0.125 * (((M * D) * (M * D)) / (d / Math.sqrt((h / Math.pow(l, 3.0)))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 1.25e-26: tmp = math.sqrt(((d / h) / (l / d))) * (1.0 - (math.pow(((M / (d / D)) / 2.0), 2.0) * (h * (0.5 / l)))) elif l <= 5.5e+98: tmp = -0.125 * (((M * D) * (M * D)) / (d / math.sqrt((h / math.pow(l, 3.0))))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 1.25e-26) tmp = Float64(sqrt(Float64(Float64(d / h) / Float64(l / d))) * Float64(1.0 - Float64((Float64(Float64(M / Float64(d / D)) / 2.0) ^ 2.0) * Float64(h * Float64(0.5 / l))))); elseif (l <= 5.5e+98) tmp = Float64(-0.125 * Float64(Float64(Float64(M * D) * Float64(M * D)) / Float64(d / sqrt(Float64(h / (l ^ 3.0)))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 1.25e-26)
tmp = sqrt(((d / h) / (l / d))) * (1.0 - ((((M / (d / D)) / 2.0) ^ 2.0) * (h * (0.5 / l))));
elseif (l <= 5.5e+98)
tmp = -0.125 * (((M * D) * (M * D)) / (d / sqrt((h / (l ^ 3.0)))));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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, 1.25e-26], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[Power[N[(N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.5e+98], N[(-0.125 * N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(d / N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.25 \cdot 10^{-26}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}} \cdot \left(1 - {\left(\frac{\frac{M}{\frac{d}{D}}}{2}\right)}^{2} \cdot \left(h \cdot \frac{0.5}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 5.5 \cdot 10^{+98}:\\
\;\;\;\;-0.125 \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < 1.25000000000000005e-26Initial program 69.3%
metadata-eval69.3%
unpow1/269.3%
metadata-eval69.3%
unpow1/269.3%
*-commutative69.3%
associate-*l*69.3%
times-frac69.1%
metadata-eval69.1%
Simplified69.1%
frac-times69.3%
associate-/l*69.2%
*-commutative69.2%
Applied egg-rr69.2%
associate-/l*69.3%
associate-/r*69.3%
*-commutative69.3%
associate-/l*69.3%
associate-/l/69.3%
Simplified69.3%
pow169.3%
sqrt-unprod59.6%
associate-*r/59.6%
Applied egg-rr59.6%
unpow159.6%
associate-*r/50.7%
associate-/l*59.6%
associate-/l*59.6%
associate-/l/59.6%
associate-/l*59.1%
*-commutative59.1%
associate-/l*59.1%
associate-/r/59.1%
Simplified59.1%
if 1.25000000000000005e-26 < l < 5.49999999999999946e98Initial program 60.7%
metadata-eval60.7%
unpow1/260.7%
metadata-eval60.7%
unpow1/260.7%
*-commutative60.7%
associate-*l*60.7%
times-frac60.7%
metadata-eval60.7%
Simplified60.7%
associate-*r*60.7%
frac-times60.7%
*-commutative60.7%
metadata-eval60.7%
associate-*r/61.1%
metadata-eval61.1%
*-commutative61.1%
frac-times61.1%
div-inv61.1%
metadata-eval61.1%
Applied egg-rr61.1%
Taylor expanded in d around 0 48.5%
associate-*l/53.8%
associate-/l*53.8%
unpow253.8%
unpow253.8%
unswap-sqr70.9%
Simplified70.9%
if 5.49999999999999946e98 < l Initial program 31.9%
metadata-eval31.9%
unpow1/231.9%
metadata-eval31.9%
unpow1/231.9%
*-commutative31.9%
associate-*l*31.9%
times-frac31.9%
metadata-eval31.9%
Simplified31.9%
Taylor expanded in d around inf 45.0%
*-un-lft-identity45.0%
*-commutative45.0%
Applied egg-rr45.0%
*-lft-identity45.0%
unpow-145.0%
sqr-pow45.0%
rem-sqrt-square45.0%
sqr-pow44.8%
fabs-sqr44.8%
sqr-pow45.0%
metadata-eval45.0%
Simplified45.0%
unpow-prod-down48.8%
Applied egg-rr48.8%
Final simplification57.9%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (or (<= M -3.1e+153) (not (<= M 8.5e-95)))
(*
(sqrt (/ d (/ (* h l) d)))
(* (/ D d) (* (/ D d) (* -0.125 (* h (/ (* M M) l))))))
(* (sqrt (/ d h)) (sqrt (/ d l)))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if ((M <= -3.1e+153) || !(M <= 8.5e-95)) {
tmp = sqrt((d / ((h * l) / d))) * ((D / d) * ((D / d) * (-0.125 * (h * ((M * M) / l)))));
} else {
tmp = sqrt((d / h)) * sqrt((d / 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 ((m <= (-3.1d+153)) .or. (.not. (m <= 8.5d-95))) then
tmp = sqrt((d / ((h * l) / d))) * ((d_1 / d) * ((d_1 / d) * ((-0.125d0) * (h * ((m * m) / l)))))
else
tmp = sqrt((d / h)) * sqrt((d / 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 ((M <= -3.1e+153) || !(M <= 8.5e-95)) {
tmp = Math.sqrt((d / ((h * l) / d))) * ((D / d) * ((D / d) * (-0.125 * (h * ((M * M) / l)))));
} else {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if (M <= -3.1e+153) or not (M <= 8.5e-95): tmp = math.sqrt((d / ((h * l) / d))) * ((D / d) * ((D / d) * (-0.125 * (h * ((M * M) / l))))) else: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if ((M <= -3.1e+153) || !(M <= 8.5e-95)) tmp = Float64(sqrt(Float64(d / Float64(Float64(h * l) / d))) * Float64(Float64(D / d) * Float64(Float64(D / d) * Float64(-0.125 * Float64(h * Float64(Float64(M * M) / l)))))); else tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if ((M <= -3.1e+153) || ~((M <= 8.5e-95)))
tmp = sqrt((d / ((h * l) / d))) * ((D / d) * ((D / d) * (-0.125 * (h * ((M * M) / l)))));
else
tmp = sqrt((d / h)) * sqrt((d / 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[Or[LessEqual[M, -3.1e+153], N[Not[LessEqual[M, 8.5e-95]], $MachinePrecision]], N[(N[Sqrt[N[(d / N[(N[(h * l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(-0.125 * N[(h * N[(N[(M * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -3.1 \cdot 10^{+153} \lor \neg \left(M \leq 8.5 \cdot 10^{-95}\right):\\
\;\;\;\;\sqrt{\frac{d}{\frac{h \cdot \ell}{d}}} \cdot \left(\frac{D}{d} \cdot \left(\frac{D}{d} \cdot \left(-0.125 \cdot \left(h \cdot \frac{M \cdot M}{\ell}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\end{array}
\end{array}
if M < -3.1e153 or 8.4999999999999995e-95 < M Initial program 64.7%
associate-*l*64.8%
metadata-eval64.8%
unpow1/264.8%
metadata-eval64.8%
unpow1/264.8%
sub-neg64.8%
+-commutative64.8%
*-commutative64.8%
distribute-rgt-neg-in64.8%
fma-def64.8%
Simplified63.9%
Taylor expanded in h around inf 39.5%
*-commutative39.5%
*-commutative39.5%
times-frac38.6%
*-commutative38.6%
unpow238.6%
unpow238.6%
unpow238.6%
Simplified38.6%
sqrt-div20.1%
Applied egg-rr20.1%
pow120.1%
sqrt-div38.6%
associate-*r*38.6%
sqrt-unprod29.2%
*-commutative29.2%
frac-times20.9%
*-commutative20.9%
associate-*l*20.9%
times-frac26.6%
associate-/l*25.5%
Applied egg-rr25.5%
unpow125.5%
associate-/l*34.8%
associate-*l*41.8%
*-commutative41.8%
unpow241.8%
associate-/r/42.9%
unpow242.9%
Simplified42.9%
if -3.1e153 < M < 8.4999999999999995e-95Initial program 59.5%
associate-*l*59.5%
metadata-eval59.5%
unpow1/259.5%
metadata-eval59.5%
unpow1/259.5%
sub-neg59.5%
+-commutative59.5%
*-commutative59.5%
distribute-rgt-neg-in59.5%
fma-def59.5%
Simplified60.1%
Taylor expanded in h around 0 42.1%
Final simplification42.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 3.2e-260)
(*
(sqrt (/ d (/ (* h l) d)))
(* (/ D d) (* (/ D d) (* -0.125 (* h (/ (* M M) l))))))
(* d (* (pow h -0.5) (pow l -0.5)))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.2e-260) {
tmp = sqrt((d / ((h * l) / d))) * ((D / d) * ((D / d) * (-0.125 * (h * ((M * M) / l)))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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 <= 3.2d-260) then
tmp = sqrt((d / ((h * l) / d))) * ((d_1 / d) * ((d_1 / d) * ((-0.125d0) * (h * ((m * m) / l)))))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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 <= 3.2e-260) {
tmp = Math.sqrt((d / ((h * l) / d))) * ((D / d) * ((D / d) * (-0.125 * (h * ((M * M) / l)))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 3.2e-260: tmp = math.sqrt((d / ((h * l) / d))) * ((D / d) * ((D / d) * (-0.125 * (h * ((M * M) / l))))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 3.2e-260) tmp = Float64(sqrt(Float64(d / Float64(Float64(h * l) / d))) * Float64(Float64(D / d) * Float64(Float64(D / d) * Float64(-0.125 * Float64(h * Float64(Float64(M * M) / l)))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 3.2e-260)
tmp = sqrt((d / ((h * l) / d))) * ((D / d) * ((D / d) * (-0.125 * (h * ((M * M) / l)))));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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, 3.2e-260], N[(N[Sqrt[N[(d / N[(N[(h * l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(-0.125 * N[(h * N[(N[(M * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.2 \cdot 10^{-260}:\\
\;\;\;\;\sqrt{\frac{d}{\frac{h \cdot \ell}{d}}} \cdot \left(\frac{D}{d} \cdot \left(\frac{D}{d} \cdot \left(-0.125 \cdot \left(h \cdot \frac{M \cdot M}{\ell}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < 3.19999999999999995e-260Initial program 66.1%
associate-*l*66.1%
metadata-eval66.1%
unpow1/266.1%
metadata-eval66.1%
unpow1/266.1%
sub-neg66.1%
+-commutative66.1%
*-commutative66.1%
distribute-rgt-neg-in66.1%
fma-def66.1%
Simplified66.1%
Taylor expanded in h around inf 27.6%
*-commutative27.6%
*-commutative27.6%
times-frac27.0%
*-commutative27.0%
unpow227.0%
unpow227.0%
unpow227.0%
Simplified27.0%
sqrt-div5.4%
Applied egg-rr5.4%
pow15.4%
sqrt-div27.0%
associate-*r*27.0%
sqrt-unprod20.9%
*-commutative20.9%
frac-times16.8%
*-commutative16.8%
associate-*l*16.8%
times-frac21.2%
associate-/l*21.5%
Applied egg-rr21.5%
unpow121.5%
associate-/l*27.0%
associate-*l*32.1%
*-commutative32.1%
unpow232.1%
associate-/r/32.9%
unpow232.9%
Simplified32.9%
if 3.19999999999999995e-260 < l Initial program 55.6%
metadata-eval55.6%
unpow1/255.6%
metadata-eval55.6%
unpow1/255.6%
*-commutative55.6%
associate-*l*55.6%
times-frac54.8%
metadata-eval54.8%
Simplified54.8%
Taylor expanded in d around inf 38.4%
*-un-lft-identity38.4%
*-commutative38.4%
Applied egg-rr38.4%
*-lft-identity38.4%
unpow-138.4%
sqr-pow38.4%
rem-sqrt-square38.4%
sqr-pow38.3%
fabs-sqr38.3%
sqr-pow38.4%
metadata-eval38.4%
Simplified38.4%
unpow-prod-down44.6%
Applied egg-rr44.6%
Final simplification37.8%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (or (<= M -5.5e-14) (not (<= M 1.9e-96)))
(*
(sqrt (* (/ d h) (/ d l)))
(* -0.125 (* (* (/ D d) (/ D d)) (* h (/ M (/ l M))))))
(* d (sqrt (/ 1.0 (* h l))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if ((M <= -5.5e-14) || !(M <= 1.9e-96)) {
tmp = sqrt(((d / h) * (d / l))) * (-0.125 * (((D / d) * (D / d)) * (h * (M / (l / M)))));
} else {
tmp = d * sqrt((1.0 / (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 ((m <= (-5.5d-14)) .or. (.not. (m <= 1.9d-96))) then
tmp = sqrt(((d / h) * (d / l))) * ((-0.125d0) * (((d_1 / d) * (d_1 / d)) * (h * (m / (l / m)))))
else
tmp = d * sqrt((1.0d0 / (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 ((M <= -5.5e-14) || !(M <= 1.9e-96)) {
tmp = Math.sqrt(((d / h) * (d / l))) * (-0.125 * (((D / d) * (D / d)) * (h * (M / (l / M)))));
} else {
tmp = d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if (M <= -5.5e-14) or not (M <= 1.9e-96): tmp = math.sqrt(((d / h) * (d / l))) * (-0.125 * (((D / d) * (D / d)) * (h * (M / (l / M))))) else: tmp = d * math.sqrt((1.0 / (h * l))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if ((M <= -5.5e-14) || !(M <= 1.9e-96)) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(h * Float64(M / Float64(l / M)))))); else tmp = Float64(d * sqrt(Float64(1.0 / 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 ((M <= -5.5e-14) || ~((M <= 1.9e-96)))
tmp = sqrt(((d / h) * (d / l))) * (-0.125 * (((D / d) * (D / d)) * (h * (M / (l / M)))));
else
tmp = d * sqrt((1.0 / (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[Or[LessEqual[M, -5.5e-14], N[Not[LessEqual[M, 1.9e-96]], $MachinePrecision]], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -5.5 \cdot 10^{-14} \lor \neg \left(M \leq 1.9 \cdot 10^{-96}\right):\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \frac{M}{\frac{\ell}{M}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if M < -5.49999999999999991e-14 or 1.9e-96 < M Initial program 62.6%
associate-*l*62.6%
metadata-eval62.6%
unpow1/262.6%
metadata-eval62.6%
unpow1/262.6%
sub-neg62.6%
+-commutative62.6%
*-commutative62.6%
distribute-rgt-neg-in62.6%
fma-def62.6%
Simplified62.6%
Taylor expanded in h around inf 37.0%
*-commutative37.0%
*-commutative37.0%
times-frac35.7%
*-commutative35.7%
unpow235.7%
unpow235.7%
unpow235.7%
Simplified35.7%
sqrt-div18.4%
Applied egg-rr18.4%
pow118.4%
sqrt-div35.7%
associate-*r*35.7%
sqrt-unprod26.6%
*-commutative26.6%
frac-times20.5%
*-commutative20.5%
associate-*l*20.5%
times-frac26.2%
associate-/l*25.4%
Applied egg-rr25.4%
unpow125.4%
times-frac31.6%
*-commutative31.6%
*-commutative31.6%
associate-*l*31.6%
*-commutative31.6%
unpow231.6%
associate-/r/32.4%
*-commutative32.4%
unpow232.4%
associate-/l*33.2%
Simplified33.2%
if -5.49999999999999991e-14 < M < 1.9e-96Initial program 60.6%
metadata-eval60.6%
unpow1/260.6%
metadata-eval60.6%
unpow1/260.6%
*-commutative60.6%
associate-*l*60.6%
times-frac59.2%
metadata-eval59.2%
Simplified59.2%
Taylor expanded in d around inf 30.9%
Final simplification32.2%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (or (<= M -6e-14) (not (<= M 9.2e-98)))
(*
(sqrt (/ d (/ (* h l) d)))
(* (/ D d) (* (/ D d) (* -0.125 (* h (/ (* M M) l))))))
(* d (sqrt (/ 1.0 (* h l))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if ((M <= -6e-14) || !(M <= 9.2e-98)) {
tmp = sqrt((d / ((h * l) / d))) * ((D / d) * ((D / d) * (-0.125 * (h * ((M * M) / l)))));
} else {
tmp = d * sqrt((1.0 / (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 ((m <= (-6d-14)) .or. (.not. (m <= 9.2d-98))) then
tmp = sqrt((d / ((h * l) / d))) * ((d_1 / d) * ((d_1 / d) * ((-0.125d0) * (h * ((m * m) / l)))))
else
tmp = d * sqrt((1.0d0 / (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 ((M <= -6e-14) || !(M <= 9.2e-98)) {
tmp = Math.sqrt((d / ((h * l) / d))) * ((D / d) * ((D / d) * (-0.125 * (h * ((M * M) / l)))));
} else {
tmp = d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if (M <= -6e-14) or not (M <= 9.2e-98): tmp = math.sqrt((d / ((h * l) / d))) * ((D / d) * ((D / d) * (-0.125 * (h * ((M * M) / l))))) else: tmp = d * math.sqrt((1.0 / (h * l))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if ((M <= -6e-14) || !(M <= 9.2e-98)) tmp = Float64(sqrt(Float64(d / Float64(Float64(h * l) / d))) * Float64(Float64(D / d) * Float64(Float64(D / d) * Float64(-0.125 * Float64(h * Float64(Float64(M * M) / l)))))); else tmp = Float64(d * sqrt(Float64(1.0 / 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 ((M <= -6e-14) || ~((M <= 9.2e-98)))
tmp = sqrt((d / ((h * l) / d))) * ((D / d) * ((D / d) * (-0.125 * (h * ((M * M) / l)))));
else
tmp = d * sqrt((1.0 / (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[Or[LessEqual[M, -6e-14], N[Not[LessEqual[M, 9.2e-98]], $MachinePrecision]], N[(N[Sqrt[N[(d / N[(N[(h * l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(-0.125 * N[(h * N[(N[(M * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -6 \cdot 10^{-14} \lor \neg \left(M \leq 9.2 \cdot 10^{-98}\right):\\
\;\;\;\;\sqrt{\frac{d}{\frac{h \cdot \ell}{d}}} \cdot \left(\frac{D}{d} \cdot \left(\frac{D}{d} \cdot \left(-0.125 \cdot \left(h \cdot \frac{M \cdot M}{\ell}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if M < -5.9999999999999997e-14 or 9.20000000000000002e-98 < M Initial program 62.6%
associate-*l*62.6%
metadata-eval62.6%
unpow1/262.6%
metadata-eval62.6%
unpow1/262.6%
sub-neg62.6%
+-commutative62.6%
*-commutative62.6%
distribute-rgt-neg-in62.6%
fma-def62.6%
Simplified62.6%
Taylor expanded in h around inf 37.0%
*-commutative37.0%
*-commutative37.0%
times-frac35.7%
*-commutative35.7%
unpow235.7%
unpow235.7%
unpow235.7%
Simplified35.7%
sqrt-div18.4%
Applied egg-rr18.4%
pow118.4%
sqrt-div35.7%
associate-*r*35.7%
sqrt-unprod26.6%
*-commutative26.6%
frac-times20.5%
*-commutative20.5%
associate-*l*20.5%
times-frac26.2%
associate-/l*25.4%
Applied egg-rr25.4%
unpow125.4%
associate-/l*33.0%
associate-*l*38.9%
*-commutative38.9%
unpow238.9%
associate-/r/39.7%
unpow239.7%
Simplified39.7%
if -5.9999999999999997e-14 < M < 9.20000000000000002e-98Initial program 60.6%
metadata-eval60.6%
unpow1/260.6%
metadata-eval60.6%
unpow1/260.6%
*-commutative60.6%
associate-*l*60.6%
times-frac59.2%
metadata-eval59.2%
Simplified59.2%
Taylor expanded in d around inf 30.9%
Final simplification35.9%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= D -2.8e-161)
(*
(sqrt (* d (/ d (* h l))))
(* -0.125 (* (/ D (/ l D)) (* (/ (* M M) d) (/ h d)))))
(if (<= D 1.05e+51)
(* d (pow (* h l) -0.5))
(*
(sqrt (* (/ d h) (/ d l)))
(* -0.125 (* (* (/ D d) (/ D d)) (* h (/ M (/ l M)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (D <= -2.8e-161) {
tmp = sqrt((d * (d / (h * l)))) * (-0.125 * ((D / (l / D)) * (((M * M) / d) * (h / d))));
} else if (D <= 1.05e+51) {
tmp = d * pow((h * l), -0.5);
} else {
tmp = sqrt(((d / h) * (d / l))) * (-0.125 * (((D / d) * (D / d)) * (h * (M / (l / 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 (d_1 <= (-2.8d-161)) then
tmp = sqrt((d * (d / (h * l)))) * ((-0.125d0) * ((d_1 / (l / d_1)) * (((m * m) / d) * (h / d))))
else if (d_1 <= 1.05d+51) then
tmp = d * ((h * l) ** (-0.5d0))
else
tmp = sqrt(((d / h) * (d / l))) * ((-0.125d0) * (((d_1 / d) * (d_1 / d)) * (h * (m / (l / 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 (D <= -2.8e-161) {
tmp = Math.sqrt((d * (d / (h * l)))) * (-0.125 * ((D / (l / D)) * (((M * M) / d) * (h / d))));
} else if (D <= 1.05e+51) {
tmp = d * Math.pow((h * l), -0.5);
} else {
tmp = Math.sqrt(((d / h) * (d / l))) * (-0.125 * (((D / d) * (D / d)) * (h * (M / (l / M)))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if D <= -2.8e-161: tmp = math.sqrt((d * (d / (h * l)))) * (-0.125 * ((D / (l / D)) * (((M * M) / d) * (h / d)))) elif D <= 1.05e+51: tmp = d * math.pow((h * l), -0.5) else: tmp = math.sqrt(((d / h) * (d / l))) * (-0.125 * (((D / d) * (D / d)) * (h * (M / (l / M))))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (D <= -2.8e-161) tmp = Float64(sqrt(Float64(d * Float64(d / Float64(h * l)))) * Float64(-0.125 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(Float64(M * M) / d) * Float64(h / d))))); elseif (D <= 1.05e+51) tmp = Float64(d * (Float64(h * l) ^ -0.5)); else tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(h * Float64(M / Float64(l / M)))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (D <= -2.8e-161)
tmp = sqrt((d * (d / (h * l)))) * (-0.125 * ((D / (l / D)) * (((M * M) / d) * (h / d))));
elseif (D <= 1.05e+51)
tmp = d * ((h * l) ^ -0.5);
else
tmp = sqrt(((d / h) * (d / l))) * (-0.125 * (((D / d) * (D / d)) * (h * (M / (l / 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[D, -2.8e-161], N[(N[Sqrt[N[(d * N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] / d), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 1.05e+51], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq -2.8 \cdot 10^{-161}:\\
\;\;\;\;\sqrt{d \cdot \frac{d}{h \cdot \ell}} \cdot \left(-0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)\right)\right)\\
\mathbf{elif}\;D \leq 1.05 \cdot 10^{+51}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \frac{M}{\frac{\ell}{M}}\right)\right)\right)\\
\end{array}
\end{array}
if D < -2.79999999999999992e-161Initial program 59.9%
associate-*l*59.9%
metadata-eval59.9%
unpow1/259.9%
metadata-eval59.9%
unpow1/259.9%
sub-neg59.9%
+-commutative59.9%
*-commutative59.9%
distribute-rgt-neg-in59.9%
fma-def59.9%
Simplified60.0%
Taylor expanded in h around inf 29.9%
*-commutative29.9%
*-commutative29.9%
times-frac29.1%
*-commutative29.1%
unpow229.1%
unpow229.1%
unpow229.1%
Simplified29.1%
sqrt-div15.7%
Applied egg-rr15.7%
pow115.7%
sqrt-div29.1%
associate-*r*29.1%
sqrt-unprod23.2%
*-commutative23.2%
frac-times21.2%
*-commutative21.2%
associate-*l*21.2%
times-frac26.1%
associate-/l*26.4%
Applied egg-rr26.4%
unpow126.4%
associate-/l*29.4%
associate-/r/29.4%
*-commutative29.4%
*-commutative29.4%
associate-*l*29.4%
unpow229.4%
associate-/l*29.1%
*-commutative29.1%
times-frac24.2%
unpow224.2%
unpow224.2%
Simplified28.4%
if -2.79999999999999992e-161 < D < 1.0500000000000001e51Initial program 59.4%
metadata-eval59.4%
unpow1/259.4%
metadata-eval59.4%
unpow1/259.4%
*-commutative59.4%
associate-*l*59.4%
times-frac59.5%
metadata-eval59.5%
Simplified59.5%
Taylor expanded in d around inf 26.8%
*-un-lft-identity26.8%
*-commutative26.8%
Applied egg-rr26.8%
*-lft-identity26.8%
unpow-126.8%
sqr-pow26.9%
rem-sqrt-square26.9%
sqr-pow26.8%
fabs-sqr26.8%
sqr-pow26.9%
metadata-eval26.9%
Simplified26.9%
if 1.0500000000000001e51 < D Initial program 68.7%
associate-*l*68.7%
metadata-eval68.7%
unpow1/268.7%
metadata-eval68.7%
unpow1/268.7%
sub-neg68.7%
+-commutative68.7%
*-commutative68.7%
distribute-rgt-neg-in68.7%
fma-def68.7%
Simplified70.4%
Taylor expanded in h around inf 37.4%
*-commutative37.4%
*-commutative37.4%
times-frac37.4%
*-commutative37.4%
unpow237.4%
unpow237.4%
unpow237.4%
Simplified37.4%
sqrt-div17.8%
Applied egg-rr17.8%
pow117.8%
sqrt-div37.4%
associate-*r*37.4%
sqrt-unprod25.1%
*-commutative25.1%
frac-times14.5%
*-commutative14.5%
associate-*l*14.5%
times-frac19.9%
associate-/l*19.9%
Applied egg-rr19.9%
unpow119.9%
times-frac30.4%
*-commutative30.4%
*-commutative30.4%
associate-*l*30.4%
*-commutative30.4%
unpow230.4%
associate-/r/32.2%
*-commutative32.2%
unpow232.2%
associate-/l*35.7%
Simplified35.7%
Final simplification29.5%
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(1.0 / Float64(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[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{1}{h \cdot \ell}}
\end{array}
Initial program 61.7%
metadata-eval61.7%
unpow1/261.7%
metadata-eval61.7%
unpow1/261.7%
*-commutative61.7%
associate-*l*61.7%
times-frac61.6%
metadata-eval61.6%
Simplified61.6%
Taylor expanded in d around inf 22.3%
Final simplification22.3%
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 61.7%
metadata-eval61.7%
unpow1/261.7%
metadata-eval61.7%
unpow1/261.7%
*-commutative61.7%
associate-*l*61.7%
times-frac61.6%
metadata-eval61.6%
Simplified61.6%
Taylor expanded in d around inf 22.3%
*-un-lft-identity22.3%
*-commutative22.3%
Applied egg-rr22.3%
*-lft-identity22.3%
unpow-122.3%
sqr-pow22.3%
rem-sqrt-square22.0%
sqr-pow21.9%
fabs-sqr21.9%
sqr-pow22.0%
metadata-eval22.0%
Simplified22.0%
Final simplification22.0%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ d (sqrt (* h l))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((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((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((h * l));
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d / math.sqrt((h * l))
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(h * l))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((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[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 61.7%
metadata-eval61.7%
unpow1/261.7%
metadata-eval61.7%
unpow1/261.7%
*-commutative61.7%
associate-*l*61.7%
times-frac61.6%
metadata-eval61.6%
Simplified61.6%
Taylor expanded in d around inf 22.3%
sqrt-div22.0%
metadata-eval22.0%
*-commutative22.0%
Applied egg-rr22.0%
associate-*l/21.9%
*-un-lft-identity21.9%
*-commutative21.9%
Applied egg-rr21.9%
Final simplification21.9%
herbie shell --seed 2023173
(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)))))