
(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 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (- 1.0 (* 0.5 (/ (* h (pow (* (* 0.5 M) (/ D d)) 2.0)) l)))))
(if (<= d -5e-309)
(* (* (pow (* (pow (/ -1.0 h) 0.25) (pow (/ -1.0 d) -0.25)) 2.0) t_0) t_1)
(if (<= d 2.6e-207)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* M (* M (* D (/ D d))))))
(if (<= d 2e-127)
(*
(/ (sqrt d) (sqrt l))
(*
(sqrt (/ d h))
(fma (pow (* 0.5 (/ M (/ d D))) 2.0) (* -0.5 (/ h l)) 1.0)))
(* t_1 (* t_0 (/ (sqrt d) (sqrt h)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = 1.0 - (0.5 * ((h * pow(((0.5 * M) * (D / d)), 2.0)) / l));
double tmp;
if (d <= -5e-309) {
tmp = (pow((pow((-1.0 / h), 0.25) * pow((-1.0 / d), -0.25)), 2.0) * t_0) * t_1;
} else if (d <= 2.6e-207) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (M * (M * (D * (D / d)))));
} else if (d <= 2e-127) {
tmp = (sqrt(d) / sqrt(l)) * (sqrt((d / h)) * fma(pow((0.5 * (M / (d / D))), 2.0), (-0.5 * (h / l)), 1.0));
} else {
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(h)));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)) / l))) tmp = 0.0 if (d <= -5e-309) tmp = Float64(Float64((Float64((Float64(-1.0 / h) ^ 0.25) * (Float64(-1.0 / d) ^ -0.25)) ^ 2.0) * t_0) * t_1); elseif (d <= 2.6e-207) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(M * Float64(M * Float64(D * Float64(D / d)))))); elseif (d <= 2e-127) tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(sqrt(Float64(d / h)) * fma((Float64(0.5 * Float64(M / Float64(d / D))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0))); else tmp = Float64(t_1 * Float64(t_0 * Float64(sqrt(d) / sqrt(h)))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5e-309], N[(N[(N[Power[N[(N[Power[N[(-1.0 / h), $MachinePrecision], 0.25], $MachinePrecision] * N[Power[N[(-1.0 / d), $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, 2.6e-207], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(M * N[(M * N[(D * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2e-127], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(0.5 * N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := 1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\\
\mathbf{if}\;d \leq -5 \cdot 10^{-309}:\\
\;\;\;\;\left({\left({\left(\frac{-1}{h}\right)}^{0.25} \cdot {\left(\frac{-1}{d}\right)}^{-0.25}\right)}^{2} \cdot t_0\right) \cdot t_1\\
\mathbf{elif}\;d \leq 2.6 \cdot 10^{-207}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \left(M \cdot \left(D \cdot \frac{D}{d}\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq 2 \cdot 10^{-127}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if d < -4.9999999999999995e-309Initial program 68.6%
Simplified68.6%
associate-*r/68.8%
div-inv68.8%
metadata-eval68.8%
Applied egg-rr68.8%
pow1/268.8%
sqr-pow68.7%
pow268.7%
metadata-eval68.7%
Applied egg-rr68.7%
Taylor expanded in d around -inf 77.0%
distribute-lft-in77.0%
exp-sum77.3%
*-commutative77.3%
exp-to-pow77.9%
*-commutative77.9%
*-commutative77.9%
associate-*l*77.9%
metadata-eval77.9%
metadata-eval77.9%
metadata-eval77.9%
exp-to-pow80.3%
metadata-eval80.3%
metadata-eval80.3%
Simplified80.3%
if -4.9999999999999995e-309 < d < 2.5999999999999999e-207Initial program 52.4%
Simplified52.2%
associate-*r/52.2%
div-inv52.2%
metadata-eval52.2%
Applied egg-rr52.2%
pow1/252.2%
add-cube-cbrt52.1%
unpow-prod-down52.1%
pow252.1%
Applied egg-rr52.1%
unpow1/252.1%
unpow252.1%
rem-sqrt-square52.1%
rem-square-sqrt52.2%
unpow1/252.2%
unpow1/252.2%
fabs-sqr52.2%
pow-sqr52.1%
metadata-eval52.1%
unpow152.1%
unpow1/252.1%
Simplified52.1%
Taylor expanded in d around 0 68.7%
associate-*r*68.7%
*-commutative68.7%
unpow268.7%
associate-*l/72.7%
unpow272.7%
*-commutative72.7%
associate-*l*77.2%
associate-/l*81.8%
associate-/r/81.7%
Simplified81.7%
if 2.5999999999999999e-207 < d < 2.0000000000000001e-127Initial program 63.3%
Simplified63.2%
sqrt-div85.5%
Applied egg-rr85.5%
if 2.0000000000000001e-127 < d Initial program 74.4%
Simplified73.4%
associate-*r/76.8%
div-inv76.8%
metadata-eval76.8%
Applied egg-rr76.8%
sqrt-div88.4%
Applied egg-rr88.4%
Final simplification83.8%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))))
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l))))
(if (<= d 1.3e-206)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* M (* M (* D (/ D d))))))
(if (<= d 5e-138)
(* (* (/ (sqrt d) (sqrt l)) (sqrt (/ d h))) t_0)
(* (* (sqrt (/ d l)) (/ (sqrt d) (sqrt h))) t_0))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.0)));
double tmp;
if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (d <= 1.3e-206) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (M * (M * (D * (D / d)))));
} else if (d <= 5e-138) {
tmp = ((sqrt(d) / sqrt(l)) * sqrt((d / h))) * t_0;
} else {
tmp = (sqrt((d / l)) * (sqrt(d) / sqrt(h))) * t_0;
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0)))
if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l)))
else if (d <= 1.3d-206) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (m * (m * (d_1 * (d_1 / d)))))
else if (d <= 5d-138) then
tmp = ((sqrt(d) / sqrt(l)) * sqrt((d / h))) * t_0
else
tmp = (sqrt((d / l)) * (sqrt(d) / sqrt(h))) * t_0
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0)));
double tmp;
if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (d <= 1.3e-206) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (M * (M * (D * (D / d)))));
} else if (d <= 5e-138) {
tmp = ((Math.sqrt(d) / Math.sqrt(l)) * Math.sqrt((d / h))) * t_0;
} else {
tmp = (Math.sqrt((d / l)) * (Math.sqrt(d) / Math.sqrt(h))) * t_0;
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0))) tmp = 0 if d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * math.pow((D * (0.5 * (M / d))), 2.0)) / l))) elif d <= 1.3e-206: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (M * (M * (D * (D / d))))) elif d <= 5e-138: tmp = ((math.sqrt(d) / math.sqrt(l)) * math.sqrt((d / h))) * t_0 else: tmp = (math.sqrt((d / l)) * (math.sqrt(d) / math.sqrt(h))) * t_0 return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)))) tmp = 0.0 if (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l)))); elseif (d <= 1.3e-206) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(M * Float64(M * Float64(D * Float64(D / d)))))); elseif (d <= 5e-138) tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * sqrt(Float64(d / h))) * t_0); else tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(sqrt(d) / sqrt(h))) * t_0); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 1.0 - (0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 2.0)));
tmp = 0.0;
if (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * ((D * (0.5 * (M / d))) ^ 2.0)) / l)));
elseif (d <= 1.3e-206)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (M * (M * (D * (D / d)))));
elseif (d <= 5e-138)
tmp = ((sqrt(d) / sqrt(l)) * sqrt((d / h))) * t_0;
else
tmp = (sqrt((d / l)) * (sqrt(d) / sqrt(h))) * t_0;
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(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]}, If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.3e-206], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(M * N[(M * N[(D * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5e-138], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\\
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;d \leq 1.3 \cdot 10^{-206}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \left(M \cdot \left(D \cdot \frac{D}{d}\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq 5 \cdot 10^{-138}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot t_0\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 68.6%
Applied egg-rr26.7%
expm1-def33.3%
expm1-log1p56.7%
cancel-sign-sub-inv56.7%
metadata-eval56.7%
*-commutative56.7%
associate-*r*56.7%
*-commutative56.7%
associate-*r/55.9%
associate-*l/56.7%
*-commutative56.7%
associate-*l*56.7%
Simplified56.7%
associate-*l/56.9%
*-commutative56.9%
Applied egg-rr56.9%
Taylor expanded in d around -inf 77.9%
associate-*r*75.4%
mul-1-neg75.4%
*-commutative75.4%
Simplified77.9%
if -4.999999999999985e-310 < d < 1.3e-206Initial program 52.4%
Simplified52.2%
associate-*r/52.2%
div-inv52.2%
metadata-eval52.2%
Applied egg-rr52.2%
pow1/252.2%
add-cube-cbrt52.1%
unpow-prod-down52.1%
pow252.1%
Applied egg-rr52.1%
unpow1/252.1%
unpow252.1%
rem-sqrt-square52.1%
rem-square-sqrt52.2%
unpow1/252.2%
unpow1/252.2%
fabs-sqr52.2%
pow-sqr52.1%
metadata-eval52.1%
unpow152.1%
unpow1/252.1%
Simplified52.1%
Taylor expanded in d around 0 68.7%
associate-*r*68.7%
*-commutative68.7%
unpow268.7%
associate-*l/72.7%
unpow272.7%
*-commutative72.7%
associate-*l*77.2%
associate-/l*81.8%
associate-/r/81.7%
Simplified81.7%
if 1.3e-206 < d < 4.99999999999999989e-138Initial program 60.6%
Simplified60.5%
sqrt-div88.0%
Applied egg-rr88.0%
if 4.99999999999999989e-138 < d Initial program 74.4%
Simplified73.5%
sqrt-div87.8%
Applied egg-rr84.6%
Final simplification81.5%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l))))
(if (<= d 2.6e-204)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* M (* M (* D (/ D d))))))
(*
(* (/ (sqrt d) (sqrt l)) (sqrt (/ d h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))))))M = abs(M);
D = abs(D);
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)))) * (-1.0 - (-0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (d <= 2.6e-204) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (M * (M * (D * (D / d)))));
} else {
tmp = ((sqrt(d) / sqrt(l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.0))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l)))
else if (d <= 2.6d-204) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (m * (m * (d_1 * (d_1 / d)))))
else
tmp = ((sqrt(d) / sqrt(l)) * sqrt((d / h))) * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
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)))) * (-1.0 - (-0.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (d <= 2.6e-204) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (M * (M * (D * (D / d)))));
} else {
tmp = ((Math.sqrt(d) / Math.sqrt(l)) * Math.sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0))));
}
return tmp;
}
M = abs(M) D = abs(D) [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)))) * (-1.0 - (-0.5 * ((h * math.pow((D * (0.5 * (M / d))), 2.0)) / l))) elif d <= 2.6e-204: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (M * (M * (D * (D / d))))) else: tmp = ((math.sqrt(d) / math.sqrt(l)) * math.sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0)))) return tmp
M = abs(M) D = abs(D) 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(-1.0 - Float64(-0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l)))); elseif (d <= 2.6e-204) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(M * Float64(M * Float64(D * Float64(D / d)))))); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * sqrt(Float64(d / h))) * 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 = abs(M)
D = abs(D)
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)))) * (-1.0 - (-0.5 * ((h * ((D * (0.5 * (M / d))) ^ 2.0)) / l)));
elseif (d <= 2.6e-204)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (M * (M * (D * (D / d)))));
else
tmp = ((sqrt(d) / sqrt(l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.6e-204], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(M * N[(M * N[(D * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $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]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[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(-1 - -0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;d \leq 2.6 \cdot 10^{-204}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \left(M \cdot \left(D \cdot \frac{D}{d}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 68.6%
Applied egg-rr26.7%
expm1-def33.3%
expm1-log1p56.7%
cancel-sign-sub-inv56.7%
metadata-eval56.7%
*-commutative56.7%
associate-*r*56.7%
*-commutative56.7%
associate-*r/55.9%
associate-*l/56.7%
*-commutative56.7%
associate-*l*56.7%
Simplified56.7%
associate-*l/56.9%
*-commutative56.9%
Applied egg-rr56.9%
Taylor expanded in d around -inf 77.9%
associate-*r*75.4%
mul-1-neg75.4%
*-commutative75.4%
Simplified77.9%
if -4.999999999999985e-310 < d < 2.59999999999999983e-204Initial program 52.4%
Simplified52.2%
associate-*r/52.2%
div-inv52.2%
metadata-eval52.2%
Applied egg-rr52.2%
pow1/252.2%
add-cube-cbrt52.1%
unpow-prod-down52.1%
pow252.1%
Applied egg-rr52.1%
unpow1/252.1%
unpow252.1%
rem-sqrt-square52.1%
rem-square-sqrt52.2%
unpow1/252.2%
unpow1/252.2%
fabs-sqr52.2%
pow-sqr52.1%
metadata-eval52.1%
unpow152.1%
unpow1/252.1%
Simplified52.1%
Taylor expanded in d around 0 68.7%
associate-*r*68.7%
*-commutative68.7%
unpow268.7%
associate-*l/72.7%
unpow272.7%
*-commutative72.7%
associate-*l*77.2%
associate-/l*81.8%
associate-/r/81.7%
Simplified81.7%
if 2.59999999999999983e-204 < d Initial program 72.3%
Simplified71.6%
sqrt-div76.4%
Applied egg-rr76.4%
Final simplification77.6%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l))))
(if (<= d 2.3e-207)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* M (* M (* D (/ D d))))))
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (* 0.5 M) (/ D d)) 2.0)) l)))
(* (/ (sqrt d) (sqrt l)) (sqrt (/ d h)))))))M = abs(M);
D = abs(D);
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)))) * (-1.0 - (-0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (d <= 2.3e-207) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (M * (M * (D * (D / d)))));
} else {
tmp = (1.0 - (0.5 * ((h * pow(((0.5 * M) * (D / d)), 2.0)) / l))) * ((sqrt(d) / sqrt(l)) * sqrt((d / h)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l)))
else if (d <= 2.3d-207) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (m * (m * (d_1 * (d_1 / d)))))
else
tmp = (1.0d0 - (0.5d0 * ((h * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0)) / l))) * ((sqrt(d) / sqrt(l)) * sqrt((d / h)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
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)))) * (-1.0 - (-0.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (d <= 2.3e-207) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (M * (M * (D * (D / d)))));
} else {
tmp = (1.0 - (0.5 * ((h * Math.pow(((0.5 * M) * (D / d)), 2.0)) / l))) * ((Math.sqrt(d) / Math.sqrt(l)) * Math.sqrt((d / h)));
}
return tmp;
}
M = abs(M) D = abs(D) [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)))) * (-1.0 - (-0.5 * ((h * math.pow((D * (0.5 * (M / d))), 2.0)) / l))) elif d <= 2.3e-207: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (M * (M * (D * (D / d))))) else: tmp = (1.0 - (0.5 * ((h * math.pow(((0.5 * M) * (D / d)), 2.0)) / l))) * ((math.sqrt(d) / math.sqrt(l)) * math.sqrt((d / h))) return tmp
M = abs(M) D = abs(D) 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(-1.0 - Float64(-0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l)))); elseif (d <= 2.3e-207) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(M * Float64(M * Float64(D * Float64(D / d)))))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)) / l))) * Float64(Float64(sqrt(d) / sqrt(l)) * sqrt(Float64(d / h)))); end return tmp end
M = abs(M)
D = abs(D)
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)))) * (-1.0 - (-0.5 * ((h * ((D * (0.5 * (M / d))) ^ 2.0)) / l)));
elseif (d <= 2.3e-207)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (M * (M * (D * (D / d)))));
else
tmp = (1.0 - (0.5 * ((h * (((0.5 * M) * (D / d)) ^ 2.0)) / l))) * ((sqrt(d) / sqrt(l)) * sqrt((d / h)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.3e-207], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(M * N[(M * N[(D * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[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(-1 - -0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;d \leq 2.3 \cdot 10^{-207}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \left(M \cdot \left(D \cdot \frac{D}{d}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 68.6%
Applied egg-rr26.7%
expm1-def33.3%
expm1-log1p56.7%
cancel-sign-sub-inv56.7%
metadata-eval56.7%
*-commutative56.7%
associate-*r*56.7%
*-commutative56.7%
associate-*r/55.9%
associate-*l/56.7%
*-commutative56.7%
associate-*l*56.7%
Simplified56.7%
associate-*l/56.9%
*-commutative56.9%
Applied egg-rr56.9%
Taylor expanded in d around -inf 77.9%
associate-*r*75.4%
mul-1-neg75.4%
*-commutative75.4%
Simplified77.9%
if -4.999999999999985e-310 < d < 2.3000000000000001e-207Initial program 52.4%
Simplified52.2%
associate-*r/52.2%
div-inv52.2%
metadata-eval52.2%
Applied egg-rr52.2%
pow1/252.2%
add-cube-cbrt52.1%
unpow-prod-down52.1%
pow252.1%
Applied egg-rr52.1%
unpow1/252.1%
unpow252.1%
rem-sqrt-square52.1%
rem-square-sqrt52.2%
unpow1/252.2%
unpow1/252.2%
fabs-sqr52.2%
pow-sqr52.1%
metadata-eval52.1%
unpow152.1%
unpow1/252.1%
Simplified52.1%
Taylor expanded in d around 0 68.7%
associate-*r*68.7%
*-commutative68.7%
unpow268.7%
associate-*l/72.7%
unpow272.7%
*-commutative72.7%
associate-*l*77.2%
associate-/l*81.8%
associate-/r/81.7%
Simplified81.7%
if 2.3000000000000001e-207 < d Initial program 72.3%
Simplified71.6%
associate-*r/74.3%
div-inv74.3%
metadata-eval74.3%
Applied egg-rr74.3%
sqrt-div76.4%
Applied egg-rr80.8%
Final simplification79.5%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l))))
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (* 0.5 M) (/ D d)) 2.0)) l)))
(* (sqrt (/ d l)) (/ (sqrt d) (sqrt h))))))M = abs(M);
D = abs(D);
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)))) * (-1.0 - (-0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else {
tmp = (1.0 - (0.5 * ((h * pow(((0.5 * M) * (D / d)), 2.0)) / l))) * (sqrt((d / l)) * (sqrt(d) / sqrt(h)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l)))
else
tmp = (1.0d0 - (0.5d0 * ((h * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0)) / l))) * (sqrt((d / l)) * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
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)))) * (-1.0 - (-0.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else {
tmp = (1.0 - (0.5 * ((h * Math.pow(((0.5 * M) * (D / d)), 2.0)) / l))) * (Math.sqrt((d / l)) * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
M = abs(M) D = abs(D) [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)))) * (-1.0 - (-0.5 * ((h * math.pow((D * (0.5 * (M / d))), 2.0)) / l))) else: tmp = (1.0 - (0.5 * ((h * math.pow(((0.5 * M) * (D / d)), 2.0)) / l))) * (math.sqrt((d / l)) * (math.sqrt(d) / math.sqrt(h))) return tmp
M = abs(M) D = abs(D) 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(-1.0 - Float64(-0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l)))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / l)) * Float64(sqrt(d) / sqrt(h)))); end return tmp end
M = abs(M)
D = abs(D)
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)))) * (-1.0 - (-0.5 * ((h * ((D * (0.5 * (M / d))) ^ 2.0)) / l)));
else
tmp = (1.0 - (0.5 * ((h * (((0.5 * M) * (D / d)) ^ 2.0)) / l))) * (sqrt((d / l)) * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[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(-1 - -0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 68.6%
Applied egg-rr26.7%
expm1-def33.3%
expm1-log1p56.7%
cancel-sign-sub-inv56.7%
metadata-eval56.7%
*-commutative56.7%
associate-*r*56.7%
*-commutative56.7%
associate-*r/55.9%
associate-*l/56.7%
*-commutative56.7%
associate-*l*56.7%
Simplified56.7%
associate-*l/56.9%
*-commutative56.9%
Applied egg-rr56.9%
Taylor expanded in d around -inf 77.9%
associate-*r*75.4%
mul-1-neg75.4%
*-commutative75.4%
Simplified77.9%
if -4.999999999999985e-310 < l Initial program 69.1%
Simplified68.4%
associate-*r/70.7%
div-inv70.7%
metadata-eval70.7%
Applied egg-rr70.7%
sqrt-div81.9%
Applied egg-rr81.9%
Final simplification80.1%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 3.9e-308)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l))))
(if (<= l 5.2e+122)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+ 1.0 (/ (* -0.5 (pow (* M (* 0.5 (/ D d))) 2.0)) (/ l h)))))
(/ d (* (sqrt l) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.9e-308) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (l <= 5.2e+122) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((-0.5 * pow((M * (0.5 * (D / d))), 2.0)) / (l / h))));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 3.9d-308) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l)))
else if (l <= 5.2d+122) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (((-0.5d0) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0)) / (l / h))))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.9e-308) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (l <= 5.2e+122) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + ((-0.5 * Math.pow((M * (0.5 * (D / d))), 2.0)) / (l / h))));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 3.9e-308: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * math.pow((D * (0.5 * (M / d))), 2.0)) / l))) elif l <= 5.2e+122: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + ((-0.5 * math.pow((M * (0.5 * (D / d))), 2.0)) / (l / h)))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 3.9e-308) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l)))); elseif (l <= 5.2e+122) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(-0.5 * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0)) / Float64(l / h))))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 3.9e-308)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * ((D * (0.5 * (M / d))) ^ 2.0)) / l)));
elseif (l <= 5.2e+122)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((-0.5 * ((M * (0.5 * (D / d))) ^ 2.0)) / (l / h))));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 3.9e-308], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.2e+122], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.9 \cdot 10^{-308}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+122}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{-0.5 \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{h}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 3.8999999999999999e-308Initial program 68.0%
Applied egg-rr26.5%
expm1-def33.0%
expm1-log1p56.3%
cancel-sign-sub-inv56.3%
metadata-eval56.3%
*-commutative56.3%
associate-*r*56.3%
*-commutative56.3%
associate-*r/55.4%
associate-*l/56.2%
*-commutative56.2%
associate-*l*56.2%
Simplified56.2%
associate-*l/56.4%
*-commutative56.4%
Applied egg-rr56.4%
Taylor expanded in d around -inf 77.3%
associate-*r*74.7%
mul-1-neg74.7%
*-commutative74.7%
Simplified77.3%
if 3.8999999999999999e-308 < l < 5.20000000000000015e122Initial program 74.7%
Simplified73.6%
associate-*r/77.0%
div-inv77.0%
metadata-eval77.0%
Applied egg-rr77.0%
pow1/277.0%
sqr-pow76.9%
pow276.9%
metadata-eval76.9%
Applied egg-rr76.9%
pow176.9%
associate-*l*76.9%
pow-pow77.0%
metadata-eval77.0%
associate-/l*73.6%
associate-*l*73.6%
Applied egg-rr73.6%
unpow173.6%
unpow1/273.6%
cancel-sign-sub-inv73.6%
metadata-eval73.6%
metadata-eval73.6%
associate-*r/73.6%
metadata-eval73.6%
Simplified73.6%
if 5.20000000000000015e122 < l Initial program 59.2%
Taylor expanded in d around inf 53.8%
*-commutative53.8%
add-cbrt-cube40.1%
add-sqr-sqrt40.1%
*-commutative40.1%
*-commutative40.1%
pow140.1%
Applied egg-rr53.9%
unpow153.9%
associate-*r/54.0%
*-rgt-identity54.0%
Simplified54.0%
sqrt-prod73.0%
Applied egg-rr73.0%
Final simplification75.2%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 3.9e-308)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l))))
(if (<= l 7e+117)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(/ d (* (sqrt l) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.9e-308) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (l <= 7e+117) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.0)))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 3.9d-308) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l)))
else if (l <= 7d+117) then
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0)))) * (sqrt((d / l)) * sqrt((d / h)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.9e-308) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (l <= 7e+117) {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0)))) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 3.9e-308: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * math.pow((D * (0.5 * (M / d))), 2.0)) / l))) elif l <= 7e+117: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0)))) * (math.sqrt((d / l)) * math.sqrt((d / h))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 3.9e-308) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l)))); elseif (l <= 7e+117) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 3.9e-308)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * ((D * (0.5 * (M / d))) ^ 2.0)) / l)));
elseif (l <= 7e+117)
tmp = (1.0 - (0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 2.0)))) * (sqrt((d / l)) * sqrt((d / h)));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 3.9e-308], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7e+117], N[(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] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.9 \cdot 10^{-308}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 7 \cdot 10^{+117}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 3.8999999999999999e-308Initial program 68.0%
Applied egg-rr26.5%
expm1-def33.0%
expm1-log1p56.3%
cancel-sign-sub-inv56.3%
metadata-eval56.3%
*-commutative56.3%
associate-*r*56.3%
*-commutative56.3%
associate-*r/55.4%
associate-*l/56.2%
*-commutative56.2%
associate-*l*56.2%
Simplified56.2%
associate-*l/56.4%
*-commutative56.4%
Applied egg-rr56.4%
Taylor expanded in d around -inf 77.3%
associate-*r*74.7%
mul-1-neg74.7%
*-commutative74.7%
Simplified77.3%
if 3.8999999999999999e-308 < l < 6.99999999999999965e117Initial program 74.7%
Simplified73.6%
if 6.99999999999999965e117 < l Initial program 59.2%
Taylor expanded in d around inf 53.8%
*-commutative53.8%
add-cbrt-cube40.1%
add-sqr-sqrt40.1%
*-commutative40.1%
*-commutative40.1%
pow140.1%
Applied egg-rr53.9%
unpow153.9%
associate-*r/54.0%
*-rgt-identity54.0%
Simplified54.0%
sqrt-prod73.0%
Applied egg-rr73.0%
Final simplification75.3%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l))))
(if (<= d 2.8e-205)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* M (* M (* D (/ D d))))))
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* 0.5 (/ (* h (pow (* 0.5 (/ D (/ d M))) 2.0)) l)))))))M = abs(M);
D = abs(D);
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)))) * (-1.0 - (-0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (d <= 2.8e-205) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (M * (M * (D * (D / d)))));
} else {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h * pow((0.5 * (D / (d / M))), 2.0)) / l)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l)))
else if (d <= 2.8d-205) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (m * (m * (d_1 * (d_1 / d)))))
else
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (0.5d0 * ((h * ((0.5d0 * (d_1 / (d / m))) ** 2.0d0)) / l)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
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)))) * (-1.0 - (-0.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (d <= 2.8e-205) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (M * (M * (D * (D / d)))));
} else {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (0.5 * ((h * Math.pow((0.5 * (D / (d / M))), 2.0)) / l)));
}
return tmp;
}
M = abs(M) D = abs(D) [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)))) * (-1.0 - (-0.5 * ((h * math.pow((D * (0.5 * (M / d))), 2.0)) / l))) elif d <= 2.8e-205: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (M * (M * (D * (D / d))))) else: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (0.5 * ((h * math.pow((0.5 * (D / (d / M))), 2.0)) / l))) return tmp
M = abs(M) D = abs(D) 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(-1.0 - Float64(-0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l)))); elseif (d <= 2.8e-205) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(M * Float64(M * Float64(D * Float64(D / d)))))); else tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(0.5 * Float64(D / Float64(d / M))) ^ 2.0)) / l)))); end return tmp end
M = abs(M)
D = abs(D)
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)))) * (-1.0 - (-0.5 * ((h * ((D * (0.5 * (M / d))) ^ 2.0)) / l)));
elseif (d <= 2.8e-205)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (M * (M * (D * (D / d)))));
else
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h * ((0.5 * (D / (d / M))) ^ 2.0)) / l)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.8e-205], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(M * N[(M * N[(D * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(0.5 * N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[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(-1 - -0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;d \leq 2.8 \cdot 10^{-205}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \left(M \cdot \left(D \cdot \frac{D}{d}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(0.5 \cdot \frac{D}{\frac{d}{M}}\right)}^{2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 68.6%
Applied egg-rr26.7%
expm1-def33.3%
expm1-log1p56.7%
cancel-sign-sub-inv56.7%
metadata-eval56.7%
*-commutative56.7%
associate-*r*56.7%
*-commutative56.7%
associate-*r/55.9%
associate-*l/56.7%
*-commutative56.7%
associate-*l*56.7%
Simplified56.7%
associate-*l/56.9%
*-commutative56.9%
Applied egg-rr56.9%
Taylor expanded in d around -inf 77.9%
associate-*r*75.4%
mul-1-neg75.4%
*-commutative75.4%
Simplified77.9%
if -4.999999999999985e-310 < d < 2.79999999999999991e-205Initial program 52.4%
Simplified52.2%
associate-*r/52.2%
div-inv52.2%
metadata-eval52.2%
Applied egg-rr52.2%
pow1/252.2%
add-cube-cbrt52.1%
unpow-prod-down52.1%
pow252.1%
Applied egg-rr52.1%
unpow1/252.1%
unpow252.1%
rem-sqrt-square52.1%
rem-square-sqrt52.2%
unpow1/252.2%
unpow1/252.2%
fabs-sqr52.2%
pow-sqr52.1%
metadata-eval52.1%
unpow152.1%
unpow1/252.1%
Simplified52.1%
Taylor expanded in d around 0 68.7%
associate-*r*68.7%
*-commutative68.7%
unpow268.7%
associate-*l/72.7%
unpow272.7%
*-commutative72.7%
associate-*l*77.2%
associate-/l*81.8%
associate-/r/81.7%
Simplified81.7%
if 2.79999999999999991e-205 < d Initial program 72.3%
Simplified71.6%
associate-*r/74.3%
div-inv74.3%
metadata-eval74.3%
Applied egg-rr74.3%
Taylor expanded in M around 0 75.0%
associate-/l*73.3%
Simplified73.3%
Final simplification76.2%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 3.9e-308)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l))))
(if (<= l 3.15e+153)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (* 0.5 M) (/ D d)) 2.0)) l)))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(/ d (* (sqrt l) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.9e-308) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (l <= 3.15e+153) {
tmp = (1.0 - (0.5 * ((h * pow(((0.5 * M) * (D / d)), 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 3.9d-308) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l)))
else if (l <= 3.15d+153) then
tmp = (1.0d0 - (0.5d0 * ((h * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0)) / l))) * (sqrt((d / l)) * sqrt((d / h)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.9e-308) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (l <= 3.15e+153) {
tmp = (1.0 - (0.5 * ((h * Math.pow(((0.5 * M) * (D / d)), 2.0)) / l))) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 3.9e-308: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * math.pow((D * (0.5 * (M / d))), 2.0)) / l))) elif l <= 3.15e+153: tmp = (1.0 - (0.5 * ((h * math.pow(((0.5 * M) * (D / d)), 2.0)) / l))) * (math.sqrt((d / l)) * math.sqrt((d / h))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 3.9e-308) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l)))); elseif (l <= 3.15e+153) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 3.9e-308)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * ((D * (0.5 * (M / d))) ^ 2.0)) / l)));
elseif (l <= 3.15e+153)
tmp = (1.0 - (0.5 * ((h * (((0.5 * M) * (D / d)) ^ 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h)));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 3.9e-308], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.15e+153], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.9 \cdot 10^{-308}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 3.15 \cdot 10^{+153}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 3.8999999999999999e-308Initial program 68.0%
Applied egg-rr26.5%
expm1-def33.0%
expm1-log1p56.3%
cancel-sign-sub-inv56.3%
metadata-eval56.3%
*-commutative56.3%
associate-*r*56.3%
*-commutative56.3%
associate-*r/55.4%
associate-*l/56.2%
*-commutative56.2%
associate-*l*56.2%
Simplified56.2%
associate-*l/56.4%
*-commutative56.4%
Applied egg-rr56.4%
Taylor expanded in d around -inf 77.3%
associate-*r*74.7%
mul-1-neg74.7%
*-commutative74.7%
Simplified77.3%
if 3.8999999999999999e-308 < l < 3.1500000000000001e153Initial program 73.4%
Simplified72.5%
associate-*r/76.7%
div-inv76.7%
metadata-eval76.7%
Applied egg-rr76.7%
if 3.1500000000000001e153 < l Initial program 59.7%
Taylor expanded in d around inf 53.1%
*-commutative53.1%
add-cbrt-cube39.9%
add-sqr-sqrt39.8%
*-commutative39.8%
*-commutative39.8%
pow139.8%
Applied egg-rr53.2%
unpow153.2%
associate-*r/53.2%
*-rgt-identity53.2%
Simplified53.2%
sqrt-prod73.3%
Applied egg-rr73.3%
Final simplification76.5%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* (/ d l) (/ d h)))))
(if (<= l -6.8e-23)
(* d (- (sqrt (/ 1.0 (* h l)))))
(if (<= l 2.6e-122)
(* t_0 (+ 1.0 (* -0.5 (* h (/ (pow (* (* 0.5 M) (/ D d)) 2.0) l)))))
(if (<= l 2.4e-68)
(* -0.125 (/ (* (sqrt (/ h (pow l 3.0))) (* (* M D) (* M D))) d))
(if (<= l 3.5e-33)
(/ d (sqrt (* h l)))
(if (<= l 6.9e+81)
(*
t_0
(+ 1.0 (* -0.5 (* (/ h l) (pow (* D (* 0.5 (/ M d))) 2.0)))))
(/ d (* (sqrt l) (sqrt h))))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / l) * (d / h)));
double tmp;
if (l <= -6.8e-23) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (l <= 2.6e-122) {
tmp = t_0 * (1.0 + (-0.5 * (h * (pow(((0.5 * M) * (D / d)), 2.0) / l))));
} else if (l <= 2.4e-68) {
tmp = -0.125 * ((sqrt((h / pow(l, 3.0))) * ((M * D) * (M * D))) / d);
} else if (l <= 3.5e-33) {
tmp = d / sqrt((h * l));
} else if (l <= 6.9e+81) {
tmp = t_0 * (1.0 + (-0.5 * ((h / l) * pow((D * (0.5 * (M / d))), 2.0))));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((d / l) * (d / h)))
if (l <= (-6.8d-23)) then
tmp = d * -sqrt((1.0d0 / (h * l)))
else if (l <= 2.6d-122) then
tmp = t_0 * (1.0d0 + ((-0.5d0) * (h * ((((0.5d0 * m) * (d_1 / d)) ** 2.0d0) / l))))
else if (l <= 2.4d-68) then
tmp = (-0.125d0) * ((sqrt((h / (l ** 3.0d0))) * ((m * d_1) * (m * d_1))) / d)
else if (l <= 3.5d-33) then
tmp = d / sqrt((h * l))
else if (l <= 6.9d+81) then
tmp = t_0 * (1.0d0 + ((-0.5d0) * ((h / l) * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0))))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / l) * (d / h)));
double tmp;
if (l <= -6.8e-23) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else if (l <= 2.6e-122) {
tmp = t_0 * (1.0 + (-0.5 * (h * (Math.pow(((0.5 * M) * (D / d)), 2.0) / l))));
} else if (l <= 2.4e-68) {
tmp = -0.125 * ((Math.sqrt((h / Math.pow(l, 3.0))) * ((M * D) * (M * D))) / d);
} else if (l <= 3.5e-33) {
tmp = d / Math.sqrt((h * l));
} else if (l <= 6.9e+81) {
tmp = t_0 * (1.0 + (-0.5 * ((h / l) * Math.pow((D * (0.5 * (M / d))), 2.0))));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d / l) * (d / h))) tmp = 0 if l <= -6.8e-23: tmp = d * -math.sqrt((1.0 / (h * l))) elif l <= 2.6e-122: tmp = t_0 * (1.0 + (-0.5 * (h * (math.pow(((0.5 * M) * (D / d)), 2.0) / l)))) elif l <= 2.4e-68: tmp = -0.125 * ((math.sqrt((h / math.pow(l, 3.0))) * ((M * D) * (M * D))) / d) elif l <= 3.5e-33: tmp = d / math.sqrt((h * l)) elif l <= 6.9e+81: tmp = t_0 * (1.0 + (-0.5 * ((h / l) * math.pow((D * (0.5 * (M / d))), 2.0)))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(Float64(d / l) * Float64(d / h))) tmp = 0.0 if (l <= -6.8e-23) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (l <= 2.6e-122) tmp = Float64(t_0 * Float64(1.0 + Float64(-0.5 * Float64(h * Float64((Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0) / l))))); elseif (l <= 2.4e-68) tmp = Float64(-0.125 * Float64(Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(Float64(M * D) * Float64(M * D))) / d)); elseif (l <= 3.5e-33) tmp = Float64(d / sqrt(Float64(h * l))); elseif (l <= 6.9e+81) tmp = Float64(t_0 * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0))))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d / l) * (d / h)));
tmp = 0.0;
if (l <= -6.8e-23)
tmp = d * -sqrt((1.0 / (h * l)));
elseif (l <= 2.6e-122)
tmp = t_0 * (1.0 + (-0.5 * (h * ((((0.5 * M) * (D / d)) ^ 2.0) / l))));
elseif (l <= 2.4e-68)
tmp = -0.125 * ((sqrt((h / (l ^ 3.0))) * ((M * D) * (M * D))) / d);
elseif (l <= 3.5e-33)
tmp = d / sqrt((h * l));
elseif (l <= 6.9e+81)
tmp = t_0 * (1.0 + (-0.5 * ((h / l) * ((D * (0.5 * (M / d))) ^ 2.0))));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -6.8e-23], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 2.6e-122], N[(t$95$0 * N[(1.0 + N[(-0.5 * N[(h * N[(N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.4e-68], N[(-0.125 * N[(N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.5e-33], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.9e+81], N[(t$95$0 * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{if}\;\ell \leq -6.8 \cdot 10^{-23}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{-122}:\\
\;\;\;\;t_0 \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{-68}:\\
\;\;\;\;-0.125 \cdot \frac{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right)}{d}\\
\mathbf{elif}\;\ell \leq 3.5 \cdot 10^{-33}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 6.9 \cdot 10^{+81}:\\
\;\;\;\;t_0 \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -6.8000000000000001e-23Initial program 63.3%
Applied egg-rr29.8%
expm1-def40.1%
expm1-log1p48.9%
cancel-sign-sub-inv48.9%
metadata-eval48.9%
*-commutative48.9%
associate-*r*48.9%
*-commutative48.9%
associate-*r/47.3%
associate-*l/48.9%
*-commutative48.9%
associate-*l*48.9%
Simplified48.9%
associate-*l/49.0%
*-commutative49.0%
Applied egg-rr49.0%
Taylor expanded in d around -inf 56.3%
mul-1-neg56.3%
*-commutative56.3%
distribute-rgt-neg-in56.3%
*-commutative56.3%
Simplified56.3%
if -6.8000000000000001e-23 < l < 2.59999999999999975e-122Initial program 75.3%
Simplified73.3%
associate-*r/75.6%
div-inv75.6%
metadata-eval75.6%
Applied egg-rr75.6%
pow175.6%
sqrt-prod70.7%
frac-times56.5%
cancel-sign-sub-inv56.5%
metadata-eval56.5%
associate-/l*54.2%
Applied egg-rr54.2%
unpow154.2%
times-frac68.3%
associate-/r/69.7%
*-commutative69.7%
Simplified69.7%
if 2.59999999999999975e-122 < l < 2.39999999999999991e-68Initial program 78.9%
Taylor expanded in d around 0 79.4%
associate-*l/79.4%
unpow279.4%
unpow279.4%
unswap-sqr86.6%
Simplified86.6%
if 2.39999999999999991e-68 < l < 3.4999999999999999e-33Initial program 56.5%
Taylor expanded in d around inf 88.7%
*-commutative88.7%
add-cbrt-cube44.3%
add-sqr-sqrt44.3%
*-commutative44.3%
*-commutative44.3%
pow144.3%
Applied egg-rr88.9%
unpow188.9%
associate-*r/88.9%
*-rgt-identity88.9%
Simplified88.9%
if 3.4999999999999999e-33 < l < 6.8999999999999996e81Initial program 79.3%
Applied egg-rr22.3%
expm1-def42.1%
expm1-log1p66.9%
cancel-sign-sub-inv66.9%
metadata-eval66.9%
*-commutative66.9%
associate-*r*66.9%
*-commutative66.9%
associate-*r/66.9%
associate-*l/66.9%
*-commutative66.9%
associate-*l*66.9%
Simplified66.9%
if 6.8999999999999996e81 < l Initial program 58.4%
Taylor expanded in d around inf 53.4%
*-commutative53.4%
add-cbrt-cube41.3%
add-sqr-sqrt41.3%
*-commutative41.3%
*-commutative41.3%
pow141.3%
Applied egg-rr53.4%
unpow153.4%
associate-*r/53.5%
*-rgt-identity53.5%
Simplified53.5%
sqrt-prod70.3%
Applied egg-rr70.3%
Final simplification67.8%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -5.6e-23)
(* d (- (sqrt (/ 1.0 (* h l)))))
(if (<= l 6.5e+81)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* D (* 0.5 (/ M d))) 2.0)))))
(/ d (* (sqrt l) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5.6e-23) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (l <= 6.5e+81) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * pow((D * (0.5 * (M / d))), 2.0))));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-5.6d-23)) then
tmp = d * -sqrt((1.0d0 / (h * l)))
else if (l <= 6.5d+81) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * ((h / l) * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0))))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5.6e-23) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else if (l <= 6.5e+81) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * Math.pow((D * (0.5 * (M / d))), 2.0))));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -5.6e-23: tmp = d * -math.sqrt((1.0 / (h * l))) elif l <= 6.5e+81: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * math.pow((D * (0.5 * (M / d))), 2.0)))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -5.6e-23) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (l <= 6.5e+81) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0))))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -5.6e-23)
tmp = d * -sqrt((1.0 / (h * l)));
elseif (l <= 6.5e+81)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * ((D * (0.5 * (M / d))) ^ 2.0))));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5.6e-23], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 6.5e+81], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.6 \cdot 10^{-23}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{+81}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -5.5999999999999994e-23Initial program 63.3%
Applied egg-rr29.8%
expm1-def40.1%
expm1-log1p48.9%
cancel-sign-sub-inv48.9%
metadata-eval48.9%
*-commutative48.9%
associate-*r*48.9%
*-commutative48.9%
associate-*r/47.3%
associate-*l/48.9%
*-commutative48.9%
associate-*l*48.9%
Simplified48.9%
associate-*l/49.0%
*-commutative49.0%
Applied egg-rr49.0%
Taylor expanded in d around -inf 56.3%
mul-1-neg56.3%
*-commutative56.3%
distribute-rgt-neg-in56.3%
*-commutative56.3%
Simplified56.3%
if -5.5999999999999994e-23 < l < 6.4999999999999996e81Initial program 75.1%
Applied egg-rr19.8%
expm1-def25.1%
expm1-log1p66.4%
cancel-sign-sub-inv66.4%
metadata-eval66.4%
*-commutative66.4%
associate-*r*66.4%
*-commutative66.4%
associate-*r/67.1%
associate-*l/66.3%
*-commutative66.3%
associate-*l*66.3%
Simplified66.3%
if 6.4999999999999996e81 < l Initial program 58.4%
Taylor expanded in d around inf 53.4%
*-commutative53.4%
add-cbrt-cube41.3%
add-sqr-sqrt41.3%
*-commutative41.3%
*-commutative41.3%
pow141.3%
Applied egg-rr53.4%
unpow153.4%
associate-*r/53.5%
*-rgt-identity53.5%
Simplified53.5%
sqrt-prod70.3%
Applied egg-rr70.3%
Final simplification64.5%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -7.5e-23)
(* d (- (sqrt (/ 1.0 (* h l)))))
(if (<= l 2.8e+82)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (/ (* h (pow (* 0.5 (* M (/ D d))) 2.0)) l))))
(/ d (* (sqrt l) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -7.5e-23) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (l <= 2.8e+82) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h * pow((0.5 * (M * (D / d))), 2.0)) / l)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-7.5d-23)) then
tmp = d * -sqrt((1.0d0 / (h * l)))
else if (l <= 2.8d+82) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * ((h * ((0.5d0 * (m * (d_1 / d))) ** 2.0d0)) / l)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -7.5e-23) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else if (l <= 2.8e+82) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h * Math.pow((0.5 * (M * (D / d))), 2.0)) / l)));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -7.5e-23: tmp = d * -math.sqrt((1.0 / (h * l))) elif l <= 2.8e+82: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h * math.pow((0.5 * (M * (D / d))), 2.0)) / l))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -7.5e-23) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (l <= 2.8e+82) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h * (Float64(0.5 * Float64(M * Float64(D / d))) ^ 2.0)) / l)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -7.5e-23)
tmp = d * -sqrt((1.0 / (h * l)));
elseif (l <= 2.8e+82)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h * ((0.5 * (M * (D / d))) ^ 2.0)) / l)));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -7.5e-23], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 2.8e+82], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h * N[Power[N[(0.5 * N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7.5 \cdot 10^{-23}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;\ell \leq 2.8 \cdot 10^{+82}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \frac{h \cdot {\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -7.4999999999999998e-23Initial program 63.3%
Applied egg-rr29.8%
expm1-def40.1%
expm1-log1p48.9%
cancel-sign-sub-inv48.9%
metadata-eval48.9%
*-commutative48.9%
associate-*r*48.9%
*-commutative48.9%
associate-*r/47.3%
associate-*l/48.9%
*-commutative48.9%
associate-*l*48.9%
Simplified48.9%
associate-*l/49.0%
*-commutative49.0%
Applied egg-rr49.0%
Taylor expanded in d around -inf 56.3%
mul-1-neg56.3%
*-commutative56.3%
distribute-rgt-neg-in56.3%
*-commutative56.3%
Simplified56.3%
if -7.4999999999999998e-23 < l < 2.8e82Initial program 75.1%
Applied egg-rr19.8%
expm1-def25.1%
expm1-log1p66.4%
cancel-sign-sub-inv66.4%
metadata-eval66.4%
*-commutative66.4%
associate-*r*66.4%
*-commutative66.4%
associate-*r/67.1%
associate-*l/66.3%
*-commutative66.3%
associate-*l*66.3%
Simplified66.3%
associate-*l/67.9%
*-commutative67.9%
Applied egg-rr67.9%
Taylor expanded in D around 0 69.4%
*-commutative69.4%
associate-*r/68.7%
Simplified68.7%
if 2.8e82 < l Initial program 58.4%
Taylor expanded in d around inf 53.4%
*-commutative53.4%
add-cbrt-cube41.3%
add-sqr-sqrt41.3%
*-commutative41.3%
*-commutative41.3%
pow141.3%
Applied egg-rr53.4%
unpow153.4%
associate-*r/53.5%
*-rgt-identity53.5%
Simplified53.5%
sqrt-prod70.3%
Applied egg-rr70.3%
Final simplification65.9%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 3.9e-308)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (* (/ h l) (pow (* D (* 0.5 (/ M d))) 2.0)))))
(if (<= l 6.5e+81)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (/ (* h (pow (* 0.5 (* M (/ D d))) 2.0)) l))))
(/ d (* (sqrt l) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.9e-308) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (0.5 * (M / d))), 2.0))));
} else if (l <= 6.5e+81) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h * pow((0.5 * (M * (D / d))), 2.0)) / l)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 3.9d-308) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0))))
else if (l <= 6.5d+81) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * ((h * ((0.5d0 * (m * (d_1 / d))) ** 2.0d0)) / l)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.9e-308) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (0.5 * (M / d))), 2.0))));
} else if (l <= 6.5e+81) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h * Math.pow((0.5 * (M * (D / d))), 2.0)) / l)));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 3.9e-308: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (0.5 * (M / d))), 2.0)))) elif l <= 6.5e+81: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h * math.pow((0.5 * (M * (D / d))), 2.0)) / l))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 3.9e-308) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0))))); elseif (l <= 6.5e+81) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h * (Float64(0.5 * Float64(M * Float64(D / d))) ^ 2.0)) / l)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 3.9e-308)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (0.5 * (M / d))) ^ 2.0))));
elseif (l <= 6.5e+81)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h * ((0.5 * (M * (D / d))) ^ 2.0)) / l)));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 3.9e-308], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.5e+81], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h * N[Power[N[(0.5 * N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.9 \cdot 10^{-308}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{+81}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \frac{h \cdot {\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 3.8999999999999999e-308Initial program 68.0%
Applied egg-rr26.5%
expm1-def33.0%
expm1-log1p56.3%
cancel-sign-sub-inv56.3%
metadata-eval56.3%
*-commutative56.3%
associate-*r*56.3%
*-commutative56.3%
associate-*r/55.4%
associate-*l/56.2%
*-commutative56.2%
associate-*l*56.2%
Simplified56.2%
Taylor expanded in d around -inf 74.7%
associate-*r*74.7%
mul-1-neg74.7%
*-commutative74.7%
Simplified74.7%
if 3.8999999999999999e-308 < l < 6.4999999999999996e81Initial program 76.2%
Applied egg-rr17.8%
expm1-def25.2%
expm1-log1p67.4%
cancel-sign-sub-inv67.4%
metadata-eval67.4%
*-commutative67.4%
associate-*r*67.4%
*-commutative67.4%
associate-*r/68.5%
associate-*l/67.3%
*-commutative67.3%
associate-*l*67.3%
Simplified67.3%
associate-*l/69.8%
*-commutative69.8%
Applied egg-rr69.8%
Taylor expanded in D around 0 72.1%
*-commutative72.1%
associate-*r/71.0%
Simplified71.0%
if 6.4999999999999996e81 < l Initial program 58.4%
Taylor expanded in d around inf 53.4%
*-commutative53.4%
add-cbrt-cube41.3%
add-sqr-sqrt41.3%
*-commutative41.3%
*-commutative41.3%
pow141.3%
Applied egg-rr53.4%
unpow153.4%
associate-*r/53.5%
*-rgt-identity53.5%
Simplified53.5%
sqrt-prod70.3%
Applied egg-rr70.3%
Final simplification72.6%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 3.9e-308)
(*
(* d (sqrt (/ 1.0 (* h l))))
(- -1.0 (* -0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l))))
(if (<= l 5e+82)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (/ (* h (pow (* 0.5 (* M (/ D d))) 2.0)) l))))
(/ d (* (sqrt l) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.9e-308) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (l <= 5e+82) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h * pow((0.5 * (M * (D / d))), 2.0)) / l)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 3.9d-308) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l)))
else if (l <= 5d+82) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * ((h * ((0.5d0 * (m * (d_1 / d))) ** 2.0d0)) / l)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.9e-308) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else if (l <= 5e+82) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h * Math.pow((0.5 * (M * (D / d))), 2.0)) / l)));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 3.9e-308: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * math.pow((D * (0.5 * (M / d))), 2.0)) / l))) elif l <= 5e+82: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h * math.pow((0.5 * (M * (D / d))), 2.0)) / l))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 3.9e-308) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l)))); elseif (l <= 5e+82) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h * (Float64(0.5 * Float64(M * Float64(D / d))) ^ 2.0)) / l)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 3.9e-308)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h * ((D * (0.5 * (M / d))) ^ 2.0)) / l)));
elseif (l <= 5e+82)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h * ((0.5 * (M * (D / d))) ^ 2.0)) / l)));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 3.9e-308], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e+82], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h * N[Power[N[(0.5 * N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.9 \cdot 10^{-308}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+82}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \frac{h \cdot {\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 3.8999999999999999e-308Initial program 68.0%
Applied egg-rr26.5%
expm1-def33.0%
expm1-log1p56.3%
cancel-sign-sub-inv56.3%
metadata-eval56.3%
*-commutative56.3%
associate-*r*56.3%
*-commutative56.3%
associate-*r/55.4%
associate-*l/56.2%
*-commutative56.2%
associate-*l*56.2%
Simplified56.2%
associate-*l/56.4%
*-commutative56.4%
Applied egg-rr56.4%
Taylor expanded in d around -inf 77.3%
associate-*r*74.7%
mul-1-neg74.7%
*-commutative74.7%
Simplified77.3%
if 3.8999999999999999e-308 < l < 5.00000000000000015e82Initial program 76.2%
Applied egg-rr17.8%
expm1-def25.2%
expm1-log1p67.4%
cancel-sign-sub-inv67.4%
metadata-eval67.4%
*-commutative67.4%
associate-*r*67.4%
*-commutative67.4%
associate-*r/68.5%
associate-*l/67.3%
*-commutative67.3%
associate-*l*67.3%
Simplified67.3%
associate-*l/69.8%
*-commutative69.8%
Applied egg-rr69.8%
Taylor expanded in D around 0 72.1%
*-commutative72.1%
associate-*r/71.0%
Simplified71.0%
if 5.00000000000000015e82 < l Initial program 58.4%
Taylor expanded in d around inf 53.4%
*-commutative53.4%
add-cbrt-cube41.3%
add-sqr-sqrt41.3%
*-commutative41.3%
*-commutative41.3%
pow141.3%
Applied egg-rr53.4%
unpow153.4%
associate-*r/53.5%
*-rgt-identity53.5%
Simplified53.5%
sqrt-prod70.3%
Applied egg-rr70.3%
Final simplification73.8%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -1.15e-23)
(* d (- (sqrt (/ 1.0 (* h l)))))
(if (<= l 2.95e+81)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (* 0.25 (* (* (/ D d) (/ D d)) (/ h (/ l (* M M))))))))
(/ d (* (sqrt l) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.15e-23) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (l <= 2.95e+81) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D / d) * (D / d)) * (h / (l / (M * M)))))));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-1.15d-23)) then
tmp = d * -sqrt((1.0d0 / (h * l)))
else if (l <= 2.95d+81) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * (0.25d0 * (((d_1 / d) * (d_1 / d)) * (h / (l / (m * m)))))))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.15e-23) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else if (l <= 2.95e+81) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D / d) * (D / d)) * (h / (l / (M * M)))))));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -1.15e-23: tmp = d * -math.sqrt((1.0 / (h * l))) elif l <= 2.95e+81: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D / d) * (D / d)) * (h / (l / (M * M))))))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.15e-23) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (l <= 2.95e+81) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(0.25 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(h / Float64(l / Float64(M * M)))))))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -1.15e-23)
tmp = d * -sqrt((1.0 / (h * l)));
elseif (l <= 2.95e+81)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D / d) * (D / d)) * (h / (l / (M * M)))))));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.15e-23], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 2.95e+81], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(0.25 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.15 \cdot 10^{-23}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;\ell \leq 2.95 \cdot 10^{+81}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{h}{\frac{\ell}{M \cdot M}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.15000000000000005e-23Initial program 63.3%
Applied egg-rr29.8%
expm1-def40.1%
expm1-log1p48.9%
cancel-sign-sub-inv48.9%
metadata-eval48.9%
*-commutative48.9%
associate-*r*48.9%
*-commutative48.9%
associate-*r/47.3%
associate-*l/48.9%
*-commutative48.9%
associate-*l*48.9%
Simplified48.9%
associate-*l/49.0%
*-commutative49.0%
Applied egg-rr49.0%
Taylor expanded in d around -inf 56.3%
mul-1-neg56.3%
*-commutative56.3%
distribute-rgt-neg-in56.3%
*-commutative56.3%
Simplified56.3%
if -1.15000000000000005e-23 < l < 2.9500000000000002e81Initial program 75.1%
Applied egg-rr19.8%
expm1-def25.1%
expm1-log1p66.4%
cancel-sign-sub-inv66.4%
metadata-eval66.4%
*-commutative66.4%
associate-*r*66.4%
*-commutative66.4%
associate-*r/67.1%
associate-*l/66.3%
*-commutative66.3%
associate-*l*66.3%
Simplified66.3%
associate-*l/67.9%
*-commutative67.9%
Applied egg-rr67.9%
Taylor expanded in h around 0 43.1%
associate-*r/43.1%
unpow243.1%
*-commutative43.1%
unpow243.1%
*-commutative43.1%
associate-*r/43.1%
times-frac44.3%
unpow244.3%
unpow244.3%
times-frac54.3%
unpow254.3%
*-commutative54.3%
associate-/l*54.9%
Simplified54.9%
if 2.9500000000000002e81 < l Initial program 58.4%
Taylor expanded in d around inf 53.4%
*-commutative53.4%
add-cbrt-cube41.3%
add-sqr-sqrt41.3%
*-commutative41.3%
*-commutative41.3%
pow141.3%
Applied egg-rr53.4%
unpow153.4%
associate-*r/53.5%
*-rgt-identity53.5%
Simplified53.5%
sqrt-prod70.3%
Applied egg-rr70.3%
Final simplification58.3%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= M 7.2e-180)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (* 0.25 (* (* (/ D d) (/ D d)) (/ h (/ l (* M M))))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 7.2e-180) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D / d) * (D / d)) * (h / (l / (M * M)))))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (m <= 7.2d-180) then
tmp = sqrt((d / l)) * sqrt((d / h))
else
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * (0.25d0 * (((d_1 / d) * (d_1 / d)) * (h / (l / (m * m)))))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 7.2e-180) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D / d) * (D / d)) * (h / (l / (M * M)))))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if M <= 7.2e-180: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) else: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D / d) * (D / d)) * (h / (l / (M * M))))))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (M <= 7.2e-180) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(0.25 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(h / Float64(l / Float64(M * M)))))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (M <= 7.2e-180)
tmp = sqrt((d / l)) * sqrt((d / h));
else
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D / d) * (D / d)) * (h / (l / (M * M)))))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[M, 7.2e-180], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(0.25 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 7.2 \cdot 10^{-180}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{h}{\frac{\ell}{M \cdot M}}\right)\right)\right)\\
\end{array}
\end{array}
if M < 7.1999999999999998e-180Initial program 68.7%
Simplified68.6%
Taylor expanded in M around 0 43.3%
if 7.1999999999999998e-180 < M Initial program 69.1%
Applied egg-rr21.9%
expm1-def27.8%
expm1-log1p55.2%
cancel-sign-sub-inv55.2%
metadata-eval55.2%
*-commutative55.2%
associate-*r*55.2%
*-commutative55.2%
associate-*r/56.1%
associate-*l/55.5%
*-commutative55.5%
associate-*l*55.5%
Simplified55.5%
associate-*l/56.5%
*-commutative56.5%
Applied egg-rr56.5%
Taylor expanded in h around 0 30.3%
associate-*r/30.3%
unpow230.3%
*-commutative30.3%
unpow230.3%
*-commutative30.3%
associate-*r/30.3%
times-frac32.9%
unpow232.9%
unpow232.9%
times-frac42.3%
unpow242.3%
*-commutative42.3%
associate-/l*42.3%
Simplified42.3%
Final simplification42.9%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -6.2e-23)
(* d (- (sqrt (/ 1.0 (* h l)))))
(if (<= l 6.5e+168)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (* 0.25 (* (* (/ D d) (/ D d)) (/ h (/ l (* M M))))))))
(/ d (sqrt (* h l))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -6.2e-23) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (l <= 6.5e+168) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D / d) * (D / d)) * (h / (l / (M * M)))))));
} else {
tmp = d / sqrt((h * l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-6.2d-23)) then
tmp = d * -sqrt((1.0d0 / (h * l)))
else if (l <= 6.5d+168) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * (0.25d0 * (((d_1 / d) * (d_1 / d)) * (h / (l / (m * m)))))))
else
tmp = d / sqrt((h * l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -6.2e-23) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else if (l <= 6.5e+168) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D / d) * (D / d)) * (h / (l / (M * M)))))));
} else {
tmp = d / Math.sqrt((h * l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -6.2e-23: tmp = d * -math.sqrt((1.0 / (h * l))) elif l <= 6.5e+168: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D / d) * (D / d)) * (h / (l / (M * M))))))) else: tmp = d / math.sqrt((h * l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -6.2e-23) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (l <= 6.5e+168) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(0.25 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(h / Float64(l / Float64(M * M)))))))); else tmp = Float64(d / sqrt(Float64(h * l))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -6.2e-23)
tmp = d * -sqrt((1.0 / (h * l)));
elseif (l <= 6.5e+168)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (0.25 * (((D / d) * (D / d)) * (h / (l / (M * M)))))));
else
tmp = d / sqrt((h * l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -6.2e-23], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 6.5e+168], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(0.25 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.2 \cdot 10^{-23}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{+168}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{h}{\frac{\ell}{M \cdot M}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if l < -6.1999999999999998e-23Initial program 63.3%
Applied egg-rr29.8%
expm1-def40.1%
expm1-log1p48.9%
cancel-sign-sub-inv48.9%
metadata-eval48.9%
*-commutative48.9%
associate-*r*48.9%
*-commutative48.9%
associate-*r/47.3%
associate-*l/48.9%
*-commutative48.9%
associate-*l*48.9%
Simplified48.9%
associate-*l/49.0%
*-commutative49.0%
Applied egg-rr49.0%
Taylor expanded in d around -inf 56.3%
mul-1-neg56.3%
*-commutative56.3%
distribute-rgt-neg-in56.3%
*-commutative56.3%
Simplified56.3%
if -6.1999999999999998e-23 < l < 6.49999999999999999e168Initial program 73.0%
Applied egg-rr21.8%
expm1-def27.2%
expm1-log1p64.7%
cancel-sign-sub-inv64.7%
metadata-eval64.7%
*-commutative64.7%
associate-*r*64.7%
*-commutative64.7%
associate-*r/65.2%
associate-*l/64.6%
*-commutative64.6%
associate-*l*64.6%
Simplified64.6%
associate-*l/66.7%
*-commutative66.7%
Applied egg-rr66.7%
Taylor expanded in h around 0 41.9%
associate-*r/41.9%
unpow241.9%
*-commutative41.9%
unpow241.9%
*-commutative41.9%
associate-*r/41.9%
times-frac43.6%
unpow243.6%
unpow243.6%
times-frac53.9%
unpow253.9%
*-commutative53.9%
associate-/l*55.1%
Simplified55.1%
if 6.49999999999999999e168 < l Initial program 59.6%
Taylor expanded in d around inf 54.9%
*-commutative54.9%
add-cbrt-cube42.6%
add-sqr-sqrt42.6%
*-commutative42.6%
*-commutative42.6%
pow142.6%
Applied egg-rr54.9%
unpow154.9%
associate-*r/55.0%
*-rgt-identity55.0%
Simplified55.0%
Final simplification55.4%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l -4.5e-207) (* d (- (sqrt (/ 1.0 (* h l))))) (/ d (sqrt (* h l)))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.5e-207) {
tmp = d * -sqrt((1.0 / (h * l)));
} else {
tmp = d / sqrt((h * l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-4.5d-207)) then
tmp = d * -sqrt((1.0d0 / (h * l)))
else
tmp = d / sqrt((h * l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.5e-207) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else {
tmp = d / Math.sqrt((h * l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -4.5e-207: tmp = d * -math.sqrt((1.0 / (h * l))) else: tmp = d / math.sqrt((h * l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -4.5e-207) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); else tmp = Float64(d / sqrt(Float64(h * l))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -4.5e-207)
tmp = d * -sqrt((1.0 / (h * l)));
else
tmp = d / sqrt((h * l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -4.5e-207], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{-207}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if l < -4.49999999999999992e-207Initial program 69.5%
Applied egg-rr29.7%
expm1-def36.6%
expm1-log1p55.4%
cancel-sign-sub-inv55.4%
metadata-eval55.4%
*-commutative55.4%
associate-*r*55.4%
*-commutative55.4%
associate-*r/54.4%
associate-*l/55.5%
*-commutative55.5%
associate-*l*55.5%
Simplified55.5%
associate-*l/55.7%
*-commutative55.7%
Applied egg-rr55.7%
Taylor expanded in d around -inf 51.2%
mul-1-neg51.2%
*-commutative51.2%
distribute-rgt-neg-in51.2%
*-commutative51.2%
Simplified51.2%
if -4.49999999999999992e-207 < l Initial program 68.4%
Taylor expanded in d around inf 41.1%
*-commutative41.1%
add-cbrt-cube32.1%
add-sqr-sqrt32.1%
*-commutative32.1%
*-commutative32.1%
pow132.1%
Applied egg-rr41.1%
unpow141.1%
associate-*r/41.1%
*-rgt-identity41.1%
Simplified41.1%
Final simplification45.1%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l -2.8e-182) (sqrt (* (/ d l) (/ d h))) (/ d (sqrt (* h l)))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.8e-182) {
tmp = sqrt(((d / l) * (d / h)));
} else {
tmp = d / sqrt((h * l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-2.8d-182)) then
tmp = sqrt(((d / l) * (d / h)))
else
tmp = d / sqrt((h * l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.8e-182) {
tmp = Math.sqrt(((d / l) * (d / h)));
} else {
tmp = d / Math.sqrt((h * l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -2.8e-182: tmp = math.sqrt(((d / l) * (d / h))) else: tmp = d / math.sqrt((h * l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -2.8e-182) tmp = sqrt(Float64(Float64(d / l) * Float64(d / h))); else tmp = Float64(d / sqrt(Float64(h * l))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -2.8e-182)
tmp = sqrt(((d / l) * (d / h)));
else
tmp = d / sqrt((h * l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.8e-182], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.8 \cdot 10^{-182}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if l < -2.79999999999999993e-182Initial program 70.0%
Simplified70.0%
Taylor expanded in M around 0 46.8%
*-rgt-identity46.8%
*-commutative46.8%
sqrt-prod39.1%
pow1/239.1%
Applied egg-rr39.1%
unpow1/239.1%
Simplified39.1%
if -2.79999999999999993e-182 < l Initial program 68.2%
Taylor expanded in d around inf 40.4%
*-commutative40.4%
add-cbrt-cube32.3%
add-sqr-sqrt32.3%
*-commutative32.3%
*-commutative32.3%
pow132.3%
Applied egg-rr40.4%
unpow140.4%
associate-*r/40.5%
*-rgt-identity40.5%
Simplified40.5%
Final simplification39.9%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ d (sqrt (* h l))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((h * l));
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d / sqrt((h * l))
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((h * l));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d / math.sqrt((h * l))
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(h * l))) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((h * l));
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 68.9%
Taylor expanded in d around inf 28.3%
*-commutative28.3%
add-cbrt-cube24.1%
add-sqr-sqrt24.0%
*-commutative24.0%
*-commutative24.0%
pow124.0%
Applied egg-rr28.0%
unpow128.0%
associate-*r/28.0%
*-rgt-identity28.0%
Simplified28.0%
Final simplification28.0%
herbie shell --seed 2023275
(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)))))