
(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 17 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 h)))
(t_1 (sqrt (/ d l)))
(t_2
(*
(* d (- (pow (* h l) -0.5)))
(fma h (* (pow (* D (/ (/ M d) 2.0)) 2.0) (/ -0.5 l)) 1.0))))
(if (<= d -8.6e+156)
t_2
(if (<= d -3.7e-79)
(*
(* t_0 t_1)
(- 1.0 (/ (* 0.125 (* D (* (* (* M M) (/ D d)) (/ h d)))) l)))
(if (<= d -2e-310)
t_2
(if (<= d 1.02e-91)
(*
(/ (sqrt d) (sqrt h))
(* t_1 (fma (pow (* M (/ (/ D d) 2.0)) 2.0) (/ -0.5 (/ l h)) 1.0)))
(*
(* t_0 (/ (sqrt d) (sqrt l)))
(- 1.0 (/ (* h (* 0.5 (pow (* M (* (/ D d) 0.5)) 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 t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double t_2 = (d * -pow((h * l), -0.5)) * fma(h, (pow((D * ((M / d) / 2.0)), 2.0) * (-0.5 / l)), 1.0);
double tmp;
if (d <= -8.6e+156) {
tmp = t_2;
} else if (d <= -3.7e-79) {
tmp = (t_0 * t_1) * (1.0 - ((0.125 * (D * (((M * M) * (D / d)) * (h / d)))) / l));
} else if (d <= -2e-310) {
tmp = t_2;
} else if (d <= 1.02e-91) {
tmp = (sqrt(d) / sqrt(h)) * (t_1 * fma(pow((M * ((D / d) / 2.0)), 2.0), (-0.5 / (l / h)), 1.0));
} else {
tmp = (t_0 * (sqrt(d) / sqrt(l))) * (1.0 - ((h * (0.5 * pow((M * ((D / d) * 0.5)), 2.0))) / l));
}
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 / h)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(Float64(d * Float64(-(Float64(h * l) ^ -0.5))) * fma(h, Float64((Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0) * Float64(-0.5 / l)), 1.0)) tmp = 0.0 if (d <= -8.6e+156) tmp = t_2; elseif (d <= -3.7e-79) tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 - Float64(Float64(0.125 * Float64(D * Float64(Float64(Float64(M * M) * Float64(D / d)) * Float64(h / d)))) / l))); elseif (d <= -2e-310) tmp = t_2; elseif (d <= 1.02e-91) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_1 * fma((Float64(M * Float64(Float64(D / d) / 2.0)) ^ 2.0), Float64(-0.5 / Float64(l / h)), 1.0))); else tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(l))) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(M * Float64(Float64(D / d) * 0.5)) ^ 2.0))) / l))); 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 / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision] * N[(h * N[(N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.6e+156], t$95$2, If[LessEqual[d, -3.7e-79], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(0.125 * N[(D * N[(N[(N[(M * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], t$95$2, If[LessEqual[d, 1.02e-91], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(N[Power[N[(M * N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / N[(l / h), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(M * N[(N[(D / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \left(d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\right) \cdot \mathsf{fma}\left(h, {\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2} \cdot \frac{-0.5}{\ell}, 1\right)\\
\mathbf{if}\;d \leq -8.6 \cdot 10^{+156}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq -3.7 \cdot 10^{-79}:\\
\;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - \frac{0.125 \cdot \left(D \cdot \left(\left(\left(M \cdot M\right) \cdot \frac{D}{d}\right) \cdot \frac{h}{d}\right)\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq 1.02 \cdot 10^{-91}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_1 \cdot \mathsf{fma}\left({\left(M \cdot \frac{\frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\frac{\ell}{h}}, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(M \cdot \left(\frac{D}{d} \cdot 0.5\right)\right)}^{2}\right)}{\ell}\right)\\
\end{array}
\end{array}
if d < -8.5999999999999997e156 or -3.70000000000000018e-79 < d < -1.999999999999994e-310Initial program 52.0%
metadata-eval52.0%
unpow1/252.0%
metadata-eval52.0%
unpow1/252.0%
*-commutative52.0%
associate-*l*52.0%
times-frac52.0%
metadata-eval52.0%
Simplified52.0%
Applied egg-rr18.9%
expm1-def21.4%
expm1-log1p41.1%
*-commutative41.1%
sub-neg41.1%
+-commutative41.1%
distribute-rgt-neg-in41.1%
fma-def41.1%
associate-/l*41.1%
distribute-neg-frac41.1%
metadata-eval41.1%
associate-/l*41.1%
associate-*l/41.1%
fma-def41.1%
associate-*r*41.5%
Simplified40.2%
Taylor expanded in d around -inf 72.7%
mul-1-neg72.7%
*-commutative72.7%
distribute-rgt-neg-in72.7%
unpow-172.7%
sqr-pow72.7%
rem-sqrt-square72.7%
metadata-eval72.7%
sqr-pow72.6%
fabs-sqr72.6%
sqr-pow72.7%
Simplified72.7%
if -8.5999999999999997e156 < d < -3.70000000000000018e-79Initial program 87.9%
metadata-eval87.9%
unpow1/287.9%
metadata-eval87.9%
unpow1/287.9%
*-commutative87.9%
associate-*l*87.9%
times-frac88.0%
metadata-eval88.0%
Simplified88.0%
associate-*r*88.0%
frac-times87.9%
*-commutative87.9%
metadata-eval87.9%
associate-*r/92.0%
metadata-eval92.0%
*-commutative92.0%
frac-times92.1%
associate-*l/92.1%
associate-*r/92.1%
div-inv92.1%
metadata-eval92.1%
Applied egg-rr92.1%
Taylor expanded in M around 0 69.6%
*-commutative69.6%
*-commutative69.6%
associate-*r*71.6%
unpow271.6%
times-frac75.3%
associate-/l*79.1%
unpow279.1%
associate-/l*83.3%
unpow283.3%
associate-/r*83.3%
Simplified83.3%
Taylor expanded in D around 0 69.6%
associate-*r*71.6%
unpow271.6%
times-frac75.3%
associate-/l*79.1%
unpow279.1%
unpow279.1%
associate-*l/83.3%
*-commutative83.3%
associate-*l*83.3%
unpow283.3%
associate-/r/85.4%
*-commutative85.4%
unpow285.4%
Simplified85.4%
if -1.999999999999994e-310 < d < 1.01999999999999994e-91Initial program 57.9%
associate-*l*57.9%
metadata-eval57.9%
unpow1/257.9%
metadata-eval57.9%
unpow1/257.9%
sub-neg57.9%
+-commutative57.9%
*-commutative57.9%
associate-*l*57.9%
distribute-rgt-neg-in57.9%
*-commutative57.9%
Simplified58.9%
sqrt-div72.0%
Applied egg-rr72.0%
if 1.01999999999999994e-91 < d Initial program 80.9%
metadata-eval80.9%
unpow1/280.9%
metadata-eval80.9%
unpow1/280.9%
*-commutative80.9%
associate-*l*80.9%
times-frac80.9%
metadata-eval80.9%
Simplified80.9%
associate-*r*80.9%
frac-times80.9%
*-commutative80.9%
metadata-eval80.9%
associate-*r/86.5%
metadata-eval86.5%
*-commutative86.5%
frac-times86.5%
associate-*l/86.5%
associate-*r/86.5%
div-inv86.5%
metadata-eval86.5%
Applied egg-rr86.5%
sqrt-div91.4%
Applied egg-rr91.4%
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
(let* ((t_0 (sqrt (/ d h)))
(t_1 (sqrt (/ d l)))
(t_2
(*
(* d (- (pow (* h l) -0.5)))
(fma h (* (pow (* D (/ (/ M d) 2.0)) 2.0) (/ -0.5 l)) 1.0))))
(if (<= d -6.5e+156)
t_2
(if (<= d -3e-79)
(*
(* t_0 t_1)
(- 1.0 (/ (* 0.125 (* D (* (* (* M M) (/ D d)) (/ h d)))) l)))
(if (<= d -2e-310)
t_2
(if (<= d 1.8e-93)
(*
(/ (sqrt d) (sqrt h))
(*
t_1
(- 1.0 (* 0.5 (* (pow (* (/ D d) (/ M 2.0)) 2.0) (/ h l))))))
(*
(* t_0 (/ (sqrt d) (sqrt l)))
(- 1.0 (/ (* h (* 0.5 (pow (* M (* (/ D d) 0.5)) 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 t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double t_2 = (d * -pow((h * l), -0.5)) * fma(h, (pow((D * ((M / d) / 2.0)), 2.0) * (-0.5 / l)), 1.0);
double tmp;
if (d <= -6.5e+156) {
tmp = t_2;
} else if (d <= -3e-79) {
tmp = (t_0 * t_1) * (1.0 - ((0.125 * (D * (((M * M) * (D / d)) * (h / d)))) / l));
} else if (d <= -2e-310) {
tmp = t_2;
} else if (d <= 1.8e-93) {
tmp = (sqrt(d) / sqrt(h)) * (t_1 * (1.0 - (0.5 * (pow(((D / d) * (M / 2.0)), 2.0) * (h / l)))));
} else {
tmp = (t_0 * (sqrt(d) / sqrt(l))) * (1.0 - ((h * (0.5 * pow((M * ((D / d) * 0.5)), 2.0))) / l));
}
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 / h)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(Float64(d * Float64(-(Float64(h * l) ^ -0.5))) * fma(h, Float64((Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0) * Float64(-0.5 / l)), 1.0)) tmp = 0.0 if (d <= -6.5e+156) tmp = t_2; elseif (d <= -3e-79) tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 - Float64(Float64(0.125 * Float64(D * Float64(Float64(Float64(M * M) * Float64(D / d)) * Float64(h / d)))) / l))); elseif (d <= -2e-310) tmp = t_2; elseif (d <= 1.8e-93) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0) * Float64(h / l)))))); else tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(l))) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(M * Float64(Float64(D / d) * 0.5)) ^ 2.0))) / l))); 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 / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision] * N[(h * N[(N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -6.5e+156], t$95$2, If[LessEqual[d, -3e-79], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(0.125 * N[(D * N[(N[(N[(M * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], t$95$2, If[LessEqual[d, 1.8e-93], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(M * N[(N[(D / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \left(d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\right) \cdot \mathsf{fma}\left(h, {\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2} \cdot \frac{-0.5}{\ell}, 1\right)\\
\mathbf{if}\;d \leq -6.5 \cdot 10^{+156}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq -3 \cdot 10^{-79}:\\
\;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - \frac{0.125 \cdot \left(D \cdot \left(\left(\left(M \cdot M\right) \cdot \frac{D}{d}\right) \cdot \frac{h}{d}\right)\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq 1.8 \cdot 10^{-93}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(M \cdot \left(\frac{D}{d} \cdot 0.5\right)\right)}^{2}\right)}{\ell}\right)\\
\end{array}
\end{array}
if d < -6.50000000000000027e156 or -3e-79 < d < -1.999999999999994e-310Initial program 52.0%
metadata-eval52.0%
unpow1/252.0%
metadata-eval52.0%
unpow1/252.0%
*-commutative52.0%
associate-*l*52.0%
times-frac52.0%
metadata-eval52.0%
Simplified52.0%
Applied egg-rr18.9%
expm1-def21.4%
expm1-log1p41.1%
*-commutative41.1%
sub-neg41.1%
+-commutative41.1%
distribute-rgt-neg-in41.1%
fma-def41.1%
associate-/l*41.1%
distribute-neg-frac41.1%
metadata-eval41.1%
associate-/l*41.1%
associate-*l/41.1%
fma-def41.1%
associate-*r*41.5%
Simplified40.2%
Taylor expanded in d around -inf 72.7%
mul-1-neg72.7%
*-commutative72.7%
distribute-rgt-neg-in72.7%
unpow-172.7%
sqr-pow72.7%
rem-sqrt-square72.7%
metadata-eval72.7%
sqr-pow72.6%
fabs-sqr72.6%
sqr-pow72.7%
Simplified72.7%
if -6.50000000000000027e156 < d < -3e-79Initial program 87.9%
metadata-eval87.9%
unpow1/287.9%
metadata-eval87.9%
unpow1/287.9%
*-commutative87.9%
associate-*l*87.9%
times-frac88.0%
metadata-eval88.0%
Simplified88.0%
associate-*r*88.0%
frac-times87.9%
*-commutative87.9%
metadata-eval87.9%
associate-*r/92.0%
metadata-eval92.0%
*-commutative92.0%
frac-times92.1%
associate-*l/92.1%
associate-*r/92.1%
div-inv92.1%
metadata-eval92.1%
Applied egg-rr92.1%
Taylor expanded in M around 0 69.6%
*-commutative69.6%
*-commutative69.6%
associate-*r*71.6%
unpow271.6%
times-frac75.3%
associate-/l*79.1%
unpow279.1%
associate-/l*83.3%
unpow283.3%
associate-/r*83.3%
Simplified83.3%
Taylor expanded in D around 0 69.6%
associate-*r*71.6%
unpow271.6%
times-frac75.3%
associate-/l*79.1%
unpow279.1%
unpow279.1%
associate-*l/83.3%
*-commutative83.3%
associate-*l*83.3%
unpow283.3%
associate-/r/85.4%
*-commutative85.4%
unpow285.4%
Simplified85.4%
if -1.999999999999994e-310 < d < 1.8000000000000001e-93Initial program 57.9%
associate-*l*57.9%
metadata-eval57.9%
unpow1/257.9%
metadata-eval57.9%
unpow1/257.9%
associate-*l*57.9%
metadata-eval57.9%
times-frac58.8%
Simplified58.8%
sqrt-div72.0%
Applied egg-rr71.9%
if 1.8000000000000001e-93 < d Initial program 80.9%
metadata-eval80.9%
unpow1/280.9%
metadata-eval80.9%
unpow1/280.9%
*-commutative80.9%
associate-*l*80.9%
times-frac80.9%
metadata-eval80.9%
Simplified80.9%
associate-*r*80.9%
frac-times80.9%
*-commutative80.9%
metadata-eval80.9%
associate-*r/86.5%
metadata-eval86.5%
*-commutative86.5%
frac-times86.5%
associate-*l/86.5%
associate-*r/86.5%
div-inv86.5%
metadata-eval86.5%
Applied egg-rr86.5%
sqrt-div91.4%
Applied egg-rr91.4%
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
(let* ((t_0 (sqrt (/ d h)))
(t_1
(*
(* d (- (pow (* h l) -0.5)))
(fma h (* (pow (* D (/ (/ M d) 2.0)) 2.0) (/ -0.5 l)) 1.0))))
(if (<= d -8.6e+156)
t_1
(if (<= d -3.5e-79)
(*
(* t_0 (sqrt (/ d l)))
(- 1.0 (/ (* 0.125 (* D (* (* (* M M) (/ D d)) (/ h d)))) l)))
(if (<= d 1.35e-305)
t_1
(*
(* t_0 (/ (sqrt d) (sqrt l)))
(- 1.0 (/ (* h (* 0.5 (pow (* M (* (/ D d) 0.5)) 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 t_0 = sqrt((d / h));
double t_1 = (d * -pow((h * l), -0.5)) * fma(h, (pow((D * ((M / d) / 2.0)), 2.0) * (-0.5 / l)), 1.0);
double tmp;
if (d <= -8.6e+156) {
tmp = t_1;
} else if (d <= -3.5e-79) {
tmp = (t_0 * sqrt((d / l))) * (1.0 - ((0.125 * (D * (((M * M) * (D / d)) * (h / d)))) / l));
} else if (d <= 1.35e-305) {
tmp = t_1;
} else {
tmp = (t_0 * (sqrt(d) / sqrt(l))) * (1.0 - ((h * (0.5 * pow((M * ((D / d) * 0.5)), 2.0))) / l));
}
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 / h)) t_1 = Float64(Float64(d * Float64(-(Float64(h * l) ^ -0.5))) * fma(h, Float64((Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0) * Float64(-0.5 / l)), 1.0)) tmp = 0.0 if (d <= -8.6e+156) tmp = t_1; elseif (d <= -3.5e-79) tmp = Float64(Float64(t_0 * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(0.125 * Float64(D * Float64(Float64(Float64(M * M) * Float64(D / d)) * Float64(h / d)))) / l))); elseif (d <= 1.35e-305) tmp = t_1; else tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(l))) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(M * Float64(Float64(D / d) * 0.5)) ^ 2.0))) / l))); 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 / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision] * N[(h * N[(N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.6e+156], t$95$1, If[LessEqual[d, -3.5e-79], N[(N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.125 * N[(D * N[(N[(N[(M * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.35e-305], t$95$1, N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(M * N[(N[(D / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \left(d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\right) \cdot \mathsf{fma}\left(h, {\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2} \cdot \frac{-0.5}{\ell}, 1\right)\\
\mathbf{if}\;d \leq -8.6 \cdot 10^{+156}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -3.5 \cdot 10^{-79}:\\
\;\;\;\;\left(t_0 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{0.125 \cdot \left(D \cdot \left(\left(\left(M \cdot M\right) \cdot \frac{D}{d}\right) \cdot \frac{h}{d}\right)\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq 1.35 \cdot 10^{-305}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(M \cdot \left(\frac{D}{d} \cdot 0.5\right)\right)}^{2}\right)}{\ell}\right)\\
\end{array}
\end{array}
if d < -8.5999999999999997e156 or -3.5000000000000003e-79 < d < 1.35e-305Initial program 51.4%
metadata-eval51.4%
unpow1/251.4%
metadata-eval51.4%
unpow1/251.4%
*-commutative51.4%
associate-*l*51.4%
times-frac51.4%
metadata-eval51.4%
Simplified51.4%
Applied egg-rr18.7%
expm1-def21.1%
expm1-log1p40.6%
*-commutative40.6%
sub-neg40.6%
+-commutative40.6%
distribute-rgt-neg-in40.6%
fma-def40.6%
associate-/l*40.6%
distribute-neg-frac40.6%
metadata-eval40.6%
associate-/l*40.6%
associate-*l/40.6%
fma-def40.6%
associate-*r*41.0%
Simplified39.7%
Taylor expanded in d around -inf 71.8%
mul-1-neg71.8%
*-commutative71.8%
distribute-rgt-neg-in71.8%
unpow-171.8%
sqr-pow71.8%
rem-sqrt-square71.8%
metadata-eval71.8%
sqr-pow71.7%
fabs-sqr71.7%
sqr-pow71.8%
Simplified71.8%
if -8.5999999999999997e156 < d < -3.5000000000000003e-79Initial program 87.9%
metadata-eval87.9%
unpow1/287.9%
metadata-eval87.9%
unpow1/287.9%
*-commutative87.9%
associate-*l*87.9%
times-frac88.0%
metadata-eval88.0%
Simplified88.0%
associate-*r*88.0%
frac-times87.9%
*-commutative87.9%
metadata-eval87.9%
associate-*r/92.0%
metadata-eval92.0%
*-commutative92.0%
frac-times92.1%
associate-*l/92.1%
associate-*r/92.1%
div-inv92.1%
metadata-eval92.1%
Applied egg-rr92.1%
Taylor expanded in M around 0 69.6%
*-commutative69.6%
*-commutative69.6%
associate-*r*71.6%
unpow271.6%
times-frac75.3%
associate-/l*79.1%
unpow279.1%
associate-/l*83.3%
unpow283.3%
associate-/r*83.3%
Simplified83.3%
Taylor expanded in D around 0 69.6%
associate-*r*71.6%
unpow271.6%
times-frac75.3%
associate-/l*79.1%
unpow279.1%
unpow279.1%
associate-*l/83.3%
*-commutative83.3%
associate-*l*83.3%
unpow283.3%
associate-/r/85.4%
*-commutative85.4%
unpow285.4%
Simplified85.4%
if 1.35e-305 < d Initial program 74.5%
metadata-eval74.5%
unpow1/274.5%
metadata-eval74.5%
unpow1/274.5%
*-commutative74.5%
associate-*l*74.5%
times-frac74.8%
metadata-eval74.8%
Simplified74.8%
associate-*r*74.8%
frac-times74.5%
*-commutative74.5%
metadata-eval74.5%
associate-*r/78.4%
metadata-eval78.4%
*-commutative78.4%
frac-times78.8%
associate-*l/78.8%
associate-*r/78.8%
div-inv78.8%
metadata-eval78.8%
Applied egg-rr78.8%
sqrt-div82.3%
Applied egg-rr82.3%
Final simplification79.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 (<= h -1.06e-224)
(*
(* d (- (pow (* h l) -0.5)))
(fma h (* (pow (* D (/ (/ M d) 2.0)) 2.0) (/ -0.5 l)) 1.0))
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (/ (* h (* 0.5 (pow (* M (* (/ D d) 0.5)) 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 (h <= -1.06e-224) {
tmp = (d * -pow((h * l), -0.5)) * fma(h, (pow((D * ((M / d) / 2.0)), 2.0) * (-0.5 / l)), 1.0);
} else {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((h * (0.5 * pow((M * ((D / d) * 0.5)), 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 (h <= -1.06e-224) tmp = Float64(Float64(d * Float64(-(Float64(h * l) ^ -0.5))) * fma(h, Float64((Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0) * Float64(-0.5 / l)), 1.0)); else tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(M * Float64(Float64(D / d) * 0.5)) ^ 2.0))) / l))); 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_] := If[LessEqual[h, -1.06e-224], N[(N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision] * N[(h * N[(N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(M * N[(N[(D / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.06 \cdot 10^{-224}:\\
\;\;\;\;\left(d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\right) \cdot \mathsf{fma}\left(h, {\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2} \cdot \frac{-0.5}{\ell}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(M \cdot \left(\frac{D}{d} \cdot 0.5\right)\right)}^{2}\right)}{\ell}\right)\\
\end{array}
\end{array}
if h < -1.06000000000000001e-224Initial program 62.9%
metadata-eval62.9%
unpow1/262.9%
metadata-eval62.9%
unpow1/262.9%
*-commutative62.9%
associate-*l*62.9%
times-frac62.9%
metadata-eval62.9%
Simplified62.9%
Applied egg-rr17.3%
expm1-def23.3%
expm1-log1p51.2%
*-commutative51.2%
sub-neg51.2%
+-commutative51.2%
distribute-rgt-neg-in51.2%
fma-def51.2%
associate-/l*51.2%
distribute-neg-frac51.2%
metadata-eval51.2%
associate-/l*51.2%
associate-*l/51.3%
fma-def51.3%
associate-*r*53.2%
Simplified52.3%
Taylor expanded in d around -inf 72.8%
mul-1-neg72.8%
*-commutative72.8%
distribute-rgt-neg-in72.8%
unpow-172.8%
sqr-pow72.9%
rem-sqrt-square72.9%
metadata-eval72.9%
sqr-pow72.7%
fabs-sqr72.7%
sqr-pow72.9%
Simplified72.9%
if -1.06000000000000001e-224 < h Initial program 75.5%
metadata-eval75.5%
unpow1/275.5%
metadata-eval75.5%
unpow1/275.5%
*-commutative75.5%
associate-*l*75.5%
times-frac75.7%
metadata-eval75.7%
Simplified75.7%
associate-*r*75.7%
frac-times75.5%
*-commutative75.5%
metadata-eval75.5%
associate-*r/79.0%
metadata-eval79.0%
*-commutative79.0%
frac-times79.3%
associate-*l/79.3%
associate-*r/79.3%
div-inv79.3%
metadata-eval79.3%
Applied egg-rr79.3%
Final simplification76.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 -3e-309)
(*
(* d (- (pow (* h l) -0.5)))
(fma h (* (pow (* D (/ (/ M d) 2.0)) 2.0) (/ -0.5 l)) 1.0))
(if (<= l 1.6e+196)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (/ (* 0.125 (/ (* D (/ h d)) (/ (/ d M) (* D M)))) l)))
(* d (* (pow h -0.5) (pow l -0.5))))))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 <= -3e-309) {
tmp = (d * -pow((h * l), -0.5)) * fma(h, (pow((D * ((M / d) / 2.0)), 2.0) * (-0.5 / l)), 1.0);
} else if (l <= 1.6e+196) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((0.125 * ((D * (h / d)) / ((d / M) / (D * M)))) / l));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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 <= -3e-309) tmp = Float64(Float64(d * Float64(-(Float64(h * l) ^ -0.5))) * fma(h, Float64((Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0) * Float64(-0.5 / l)), 1.0)); elseif (l <= 1.6e+196) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(0.125 * Float64(Float64(D * Float64(h / d)) / Float64(Float64(d / M) / Float64(D * M)))) / l))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); 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_] := If[LessEqual[l, -3e-309], N[(N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision] * N[(h * N[(N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.6e+196], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.125 * N[(N[(D * N[(h / d), $MachinePrecision]), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] / N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3 \cdot 10^{-309}:\\
\;\;\;\;\left(d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\right) \cdot \mathsf{fma}\left(h, {\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2} \cdot \frac{-0.5}{\ell}, 1\right)\\
\mathbf{elif}\;\ell \leq 1.6 \cdot 10^{+196}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{0.125 \cdot \frac{D \cdot \frac{h}{d}}{\frac{\frac{d}{M}}{D \cdot M}}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -3.000000000000001e-309Initial program 65.6%
metadata-eval65.6%
unpow1/265.6%
metadata-eval65.6%
unpow1/265.6%
*-commutative65.6%
associate-*l*65.6%
times-frac65.6%
metadata-eval65.6%
Simplified65.6%
Applied egg-rr19.5%
expm1-def25.0%
expm1-log1p52.8%
*-commutative52.8%
sub-neg52.8%
+-commutative52.8%
distribute-rgt-neg-in52.8%
fma-def52.8%
associate-/l*52.8%
distribute-neg-frac52.8%
metadata-eval52.8%
associate-/l*52.8%
associate-*l/52.8%
fma-def52.8%
associate-*r*54.6%
Simplified53.8%
Taylor expanded in d around -inf 73.1%
mul-1-neg73.1%
*-commutative73.1%
distribute-rgt-neg-in73.1%
unpow-173.1%
sqr-pow73.2%
rem-sqrt-square73.2%
metadata-eval73.2%
sqr-pow73.0%
fabs-sqr73.0%
sqr-pow73.2%
Simplified73.2%
if -3.000000000000001e-309 < l < 1.59999999999999996e196Initial program 78.5%
metadata-eval78.5%
unpow1/278.5%
metadata-eval78.5%
unpow1/278.5%
*-commutative78.5%
associate-*l*78.5%
times-frac78.9%
metadata-eval78.9%
Simplified78.9%
associate-*r*78.9%
frac-times78.5%
*-commutative78.5%
metadata-eval78.5%
associate-*r/83.2%
metadata-eval83.2%
*-commutative83.2%
frac-times83.6%
associate-*l/83.6%
associate-*r/83.6%
div-inv83.6%
metadata-eval83.6%
Applied egg-rr83.6%
Taylor expanded in M around 0 56.7%
*-commutative56.7%
*-commutative56.7%
associate-*r*56.7%
unpow256.7%
times-frac65.9%
associate-/l*66.7%
unpow266.7%
associate-/l*74.3%
unpow274.3%
associate-/r*76.2%
Simplified76.2%
associate-*l/76.1%
associate-/l/79.5%
Applied egg-rr79.5%
if 1.59999999999999996e196 < l Initial program 50.5%
metadata-eval50.5%
unpow1/250.5%
metadata-eval50.5%
unpow1/250.5%
*-commutative50.5%
associate-*l*50.5%
times-frac50.5%
metadata-eval50.5%
Simplified50.5%
Taylor expanded in d around inf 54.7%
*-un-lft-identity54.7%
*-commutative54.7%
Applied egg-rr54.7%
*-lft-identity54.7%
unpow-154.7%
sqr-pow54.7%
rem-sqrt-square54.7%
metadata-eval54.7%
sqr-pow54.6%
fabs-sqr54.6%
sqr-pow54.7%
Simplified54.7%
unpow-prod-down76.2%
Applied egg-rr76.2%
Final simplification76.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 -1.22e-101)
(*
(* d (sqrt (/ (/ 1.0 h) l)))
(- -1.0 (/ -0.5 (/ (/ l h) (pow (* D (/ 0.5 (/ d M))) 2.0)))))
(if (<= l 1.45e-186)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (/ -0.5 (/ l (* h (pow (* D (* (/ M d) 0.5)) 2.0))))))
(if (<= l 7.3e+195)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (/ (* 0.125 (* D (* (* (* M M) (/ D d)) (/ h d)))) l)))
(* d (* (pow h -0.5) (pow l -0.5)))))))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.22e-101) {
tmp = (d * sqrt(((1.0 / h) / l))) * (-1.0 - (-0.5 / ((l / h) / pow((D * (0.5 / (d / M))), 2.0))));
} else if (l <= 1.45e-186) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * pow((D * ((M / d) * 0.5)), 2.0)))));
} else if (l <= 7.3e+195) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((0.125 * (D * (((M * M) * (D / d)) * (h / d)))) / l));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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.22d-101)) then
tmp = (d * sqrt(((1.0d0 / h) / l))) * ((-1.0d0) - ((-0.5d0) / ((l / h) / ((d_1 * (0.5d0 / (d / m))) ** 2.0d0))))
else if (l <= 1.45d-186) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) / (l / (h * ((d_1 * ((m / d) * 0.5d0)) ** 2.0d0)))))
else if (l <= 7.3d+195) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - ((0.125d0 * (d_1 * (((m * m) * (d_1 / d)) * (h / d)))) / l))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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.22e-101) {
tmp = (d * Math.sqrt(((1.0 / h) / l))) * (-1.0 - (-0.5 / ((l / h) / Math.pow((D * (0.5 / (d / M))), 2.0))));
} else if (l <= 1.45e-186) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * Math.pow((D * ((M / d) * 0.5)), 2.0)))));
} else if (l <= 7.3e+195) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - ((0.125 * (D * (((M * M) * (D / d)) * (h / d)))) / l));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
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.22e-101: tmp = (d * math.sqrt(((1.0 / h) / l))) * (-1.0 - (-0.5 / ((l / h) / math.pow((D * (0.5 / (d / M))), 2.0)))) elif l <= 1.45e-186: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * math.pow((D * ((M / d) * 0.5)), 2.0))))) elif l <= 7.3e+195: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - ((0.125 * (D * (((M * M) * (D / d)) * (h / d)))) / l)) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) 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.22e-101) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / h) / l))) * Float64(-1.0 - Float64(-0.5 / Float64(Float64(l / h) / (Float64(D * Float64(0.5 / Float64(d / M))) ^ 2.0))))); elseif (l <= 1.45e-186) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 / Float64(l / Float64(h * (Float64(D * Float64(Float64(M / d) * 0.5)) ^ 2.0)))))); elseif (l <= 7.3e+195) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(0.125 * Float64(D * Float64(Float64(Float64(M * M) * Float64(D / d)) * Float64(h / d)))) / l))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); 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.22e-101)
tmp = (d * sqrt(((1.0 / h) / l))) * (-1.0 - (-0.5 / ((l / h) / ((D * (0.5 / (d / M))) ^ 2.0))));
elseif (l <= 1.45e-186)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * ((D * ((M / d) * 0.5)) ^ 2.0)))));
elseif (l <= 7.3e+195)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((0.125 * (D * (((M * M) * (D / d)) * (h / d)))) / l));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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.22e-101], N[(N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 / N[(N[(l / h), $MachinePrecision] / N[Power[N[(D * N[(0.5 / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.45e-186], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 / N[(l / N[(h * N[Power[N[(D * N[(N[(M / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.3e+195], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.125 * N[(D * N[(N[(N[(M * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.22 \cdot 10^{-101}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\right) \cdot \left(-1 - \frac{-0.5}{\frac{\frac{\ell}{h}}{{\left(D \cdot \frac{0.5}{\frac{d}{M}}\right)}^{2}}}\right)\\
\mathbf{elif}\;\ell \leq 1.45 \cdot 10^{-186}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \frac{-0.5}{\frac{\ell}{h \cdot {\left(D \cdot \left(\frac{M}{d} \cdot 0.5\right)\right)}^{2}}}\right)\\
\mathbf{elif}\;\ell \leq 7.3 \cdot 10^{+195}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{0.125 \cdot \left(D \cdot \left(\left(\left(M \cdot M\right) \cdot \frac{D}{d}\right) \cdot \frac{h}{d}\right)\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.2199999999999999e-101Initial program 60.6%
metadata-eval60.6%
unpow1/260.6%
metadata-eval60.6%
unpow1/260.6%
*-commutative60.6%
associate-*l*60.6%
times-frac60.6%
metadata-eval60.6%
Simplified60.6%
associate-*r*60.6%
frac-times60.6%
*-commutative60.6%
metadata-eval60.6%
associate-*r/60.5%
metadata-eval60.5%
*-commutative60.5%
frac-times60.5%
associate-*l/60.5%
associate-*r/60.5%
div-inv60.5%
metadata-eval60.5%
Applied egg-rr60.5%
pow160.5%
*-commutative60.5%
associate-/l*60.5%
*-commutative60.5%
associate-*l/60.5%
sqrt-unprod44.4%
*-commutative44.4%
frac-times33.6%
*-commutative33.6%
Applied egg-rr33.6%
unpow133.6%
*-commutative33.6%
times-frac44.4%
sub-neg44.4%
associate-/l*44.4%
distribute-neg-frac44.4%
metadata-eval44.4%
Simplified43.2%
Taylor expanded in d around -inf 68.1%
mul-1-neg68.1%
*-commutative68.1%
distribute-rgt-neg-in68.1%
*-commutative68.1%
associate-/r*68.1%
Simplified68.1%
if -1.2199999999999999e-101 < l < 1.4500000000000001e-186Initial program 77.5%
metadata-eval77.5%
unpow1/277.5%
metadata-eval77.5%
unpow1/277.5%
*-commutative77.5%
associate-*l*77.5%
times-frac78.0%
metadata-eval78.0%
Simplified78.0%
associate-*r*78.0%
frac-times77.5%
*-commutative77.5%
metadata-eval77.5%
associate-*r/84.8%
metadata-eval84.8%
*-commutative84.8%
frac-times85.3%
associate-*l/85.3%
associate-*r/85.3%
div-inv85.3%
metadata-eval85.3%
Applied egg-rr85.3%
pow185.3%
*-commutative85.3%
associate-/l*78.1%
*-commutative78.1%
associate-*l/78.1%
sqrt-unprod73.0%
*-commutative73.0%
frac-times48.8%
*-commutative48.8%
Applied egg-rr48.8%
unpow148.8%
*-commutative48.8%
times-frac73.0%
sub-neg73.0%
associate-/l*73.0%
distribute-neg-frac73.0%
metadata-eval73.0%
Simplified73.0%
*-un-lft-identity73.0%
associate-/l/80.3%
div-inv80.3%
clear-num80.3%
Applied egg-rr80.3%
*-lft-identity80.3%
*-commutative80.3%
Simplified80.3%
if 1.4500000000000001e-186 < l < 7.3000000000000004e195Initial program 77.5%
metadata-eval77.5%
unpow1/277.5%
metadata-eval77.5%
unpow1/277.5%
*-commutative77.5%
associate-*l*77.5%
times-frac77.5%
metadata-eval77.5%
Simplified77.5%
associate-*r*77.5%
frac-times77.5%
*-commutative77.5%
metadata-eval77.5%
associate-*r/80.0%
metadata-eval80.0%
*-commutative80.0%
frac-times80.1%
associate-*l/80.1%
associate-*r/80.1%
div-inv80.1%
metadata-eval80.1%
Applied egg-rr80.1%
Taylor expanded in M around 0 63.5%
*-commutative63.5%
*-commutative63.5%
associate-*r*62.3%
unpow262.3%
times-frac67.3%
associate-/l*68.5%
unpow268.5%
associate-/l*75.1%
unpow275.1%
associate-/r*76.4%
Simplified76.4%
Taylor expanded in D around 0 63.5%
associate-*r*62.3%
unpow262.3%
times-frac67.3%
associate-/l*68.5%
unpow268.5%
unpow268.5%
associate-*l/75.1%
*-commutative75.1%
associate-*l*76.2%
unpow276.2%
associate-/r/76.2%
*-commutative76.2%
unpow276.2%
Simplified76.2%
if 7.3000000000000004e195 < l Initial program 50.5%
metadata-eval50.5%
unpow1/250.5%
metadata-eval50.5%
unpow1/250.5%
*-commutative50.5%
associate-*l*50.5%
times-frac50.5%
metadata-eval50.5%
Simplified50.5%
Taylor expanded in d around inf 54.7%
*-un-lft-identity54.7%
*-commutative54.7%
Applied egg-rr54.7%
*-lft-identity54.7%
unpow-154.7%
sqr-pow54.7%
rem-sqrt-square54.7%
metadata-eval54.7%
sqr-pow54.6%
fabs-sqr54.6%
sqr-pow54.7%
Simplified54.7%
unpow-prod-down76.2%
Applied egg-rr76.2%
Final simplification74.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.75e-96)
(*
(* d (sqrt (/ (/ 1.0 h) l)))
(- -1.0 (/ -0.5 (/ (/ l h) (pow (* D (/ 0.5 (/ d M))) 2.0)))))
(if (<= l 5e+195)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (/ (* 0.125 (/ (* D (/ h d)) (/ (/ d M) (* D M)))) l)))
(* d (* (pow h -0.5) (pow l -0.5))))))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.75e-96) {
tmp = (d * sqrt(((1.0 / h) / l))) * (-1.0 - (-0.5 / ((l / h) / pow((D * (0.5 / (d / M))), 2.0))));
} else if (l <= 5e+195) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((0.125 * ((D * (h / d)) / ((d / M) / (D * M)))) / l));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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.75d-96)) then
tmp = (d * sqrt(((1.0d0 / h) / l))) * ((-1.0d0) - ((-0.5d0) / ((l / h) / ((d_1 * (0.5d0 / (d / m))) ** 2.0d0))))
else if (l <= 5d+195) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - ((0.125d0 * ((d_1 * (h / d)) / ((d / m) / (d_1 * m)))) / l))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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.75e-96) {
tmp = (d * Math.sqrt(((1.0 / h) / l))) * (-1.0 - (-0.5 / ((l / h) / Math.pow((D * (0.5 / (d / M))), 2.0))));
} else if (l <= 5e+195) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - ((0.125 * ((D * (h / d)) / ((d / M) / (D * M)))) / l));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
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.75e-96: tmp = (d * math.sqrt(((1.0 / h) / l))) * (-1.0 - (-0.5 / ((l / h) / math.pow((D * (0.5 / (d / M))), 2.0)))) elif l <= 5e+195: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - ((0.125 * ((D * (h / d)) / ((d / M) / (D * M)))) / l)) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) 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.75e-96) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / h) / l))) * Float64(-1.0 - Float64(-0.5 / Float64(Float64(l / h) / (Float64(D * Float64(0.5 / Float64(d / M))) ^ 2.0))))); elseif (l <= 5e+195) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(0.125 * Float64(Float64(D * Float64(h / d)) / Float64(Float64(d / M) / Float64(D * M)))) / l))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); 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.75e-96)
tmp = (d * sqrt(((1.0 / h) / l))) * (-1.0 - (-0.5 / ((l / h) / ((D * (0.5 / (d / M))) ^ 2.0))));
elseif (l <= 5e+195)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((0.125 * ((D * (h / d)) / ((d / M) / (D * M)))) / l));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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.75e-96], N[(N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 / N[(N[(l / h), $MachinePrecision] / N[Power[N[(D * N[(0.5 / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e+195], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.125 * N[(N[(D * N[(h / d), $MachinePrecision]), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] / N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.75 \cdot 10^{-96}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\right) \cdot \left(-1 - \frac{-0.5}{\frac{\frac{\ell}{h}}{{\left(D \cdot \frac{0.5}{\frac{d}{M}}\right)}^{2}}}\right)\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+195}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{0.125 \cdot \frac{D \cdot \frac{h}{d}}{\frac{\frac{d}{M}}{D \cdot M}}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.7499999999999999e-96Initial program 60.8%
metadata-eval60.8%
unpow1/260.8%
metadata-eval60.8%
unpow1/260.8%
*-commutative60.8%
associate-*l*60.8%
times-frac60.8%
metadata-eval60.8%
Simplified60.8%
associate-*r*60.8%
frac-times60.8%
*-commutative60.8%
metadata-eval60.8%
associate-*r/60.6%
metadata-eval60.6%
*-commutative60.6%
frac-times60.7%
associate-*l/60.7%
associate-*r/60.7%
div-inv60.7%
metadata-eval60.7%
Applied egg-rr60.7%
pow160.7%
*-commutative60.7%
associate-/l*60.7%
*-commutative60.7%
associate-*l/60.7%
sqrt-unprod44.2%
*-commutative44.2%
frac-times33.2%
*-commutative33.2%
Applied egg-rr33.2%
unpow133.2%
*-commutative33.2%
times-frac44.2%
sub-neg44.2%
associate-/l*44.3%
distribute-neg-frac44.3%
metadata-eval44.3%
Simplified43.0%
Taylor expanded in d around -inf 68.4%
mul-1-neg68.4%
*-commutative68.4%
distribute-rgt-neg-in68.4%
*-commutative68.4%
associate-/r*68.5%
Simplified68.5%
if -1.7499999999999999e-96 < l < 4.9999999999999998e195Initial program 77.2%
metadata-eval77.2%
unpow1/277.2%
metadata-eval77.2%
unpow1/277.2%
*-commutative77.2%
associate-*l*77.2%
times-frac77.4%
metadata-eval77.4%
Simplified77.4%
associate-*r*77.4%
frac-times77.2%
*-commutative77.2%
metadata-eval77.2%
associate-*r/81.9%
metadata-eval81.9%
*-commutative81.9%
frac-times82.2%
associate-*l/82.2%
associate-*r/82.2%
div-inv82.2%
metadata-eval82.2%
Applied egg-rr82.2%
Taylor expanded in M around 0 58.7%
*-commutative58.7%
*-commutative58.7%
associate-*r*58.7%
unpow258.7%
times-frac67.8%
associate-/l*68.4%
unpow268.4%
associate-/l*75.0%
unpow275.0%
associate-/r*76.4%
Simplified76.4%
associate-*l/75.7%
associate-/l/78.0%
Applied egg-rr78.0%
if 4.9999999999999998e195 < l Initial program 50.5%
metadata-eval50.5%
unpow1/250.5%
metadata-eval50.5%
unpow1/250.5%
*-commutative50.5%
associate-*l*50.5%
times-frac50.5%
metadata-eval50.5%
Simplified50.5%
Taylor expanded in d around inf 54.7%
*-un-lft-identity54.7%
*-commutative54.7%
Applied egg-rr54.7%
*-lft-identity54.7%
unpow-154.7%
sqr-pow54.7%
rem-sqrt-square54.7%
metadata-eval54.7%
sqr-pow54.6%
fabs-sqr54.6%
sqr-pow54.7%
Simplified54.7%
unpow-prod-down76.2%
Applied egg-rr76.2%
Final simplification74.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
(let* ((t_0 (sqrt (/ d h))) (t_1 (sqrt (/ d l))))
(if (<= M 9.5e-260)
(* t_0 t_1)
(if (<= M 210000000000.0)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (/ -0.5 (/ l (* h (pow (* D (* (/ M d) 0.5)) 2.0))))))
(*
t_0
(* t_1 (* -0.125 (/ (* D (* (/ M d) (* h (/ M d)))) (/ l D)))))))))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 / h));
double t_1 = sqrt((d / l));
double tmp;
if (M <= 9.5e-260) {
tmp = t_0 * t_1;
} else if (M <= 210000000000.0) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * pow((D * ((M / d) * 0.5)), 2.0)))));
} else {
tmp = t_0 * (t_1 * (-0.125 * ((D * ((M / d) * (h * (M / d)))) / (l / D))));
}
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) :: t_1
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = sqrt((d / l))
if (m <= 9.5d-260) then
tmp = t_0 * t_1
else if (m <= 210000000000.0d0) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) / (l / (h * ((d_1 * ((m / d) * 0.5d0)) ** 2.0d0)))))
else
tmp = t_0 * (t_1 * ((-0.125d0) * ((d_1 * ((m / d) * (h * (m / d)))) / (l / d_1))))
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 / h));
double t_1 = Math.sqrt((d / l));
double tmp;
if (M <= 9.5e-260) {
tmp = t_0 * t_1;
} else if (M <= 210000000000.0) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * Math.pow((D * ((M / d) * 0.5)), 2.0)))));
} else {
tmp = t_0 * (t_1 * (-0.125 * ((D * ((M / d) * (h * (M / d)))) / (l / D))));
}
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 / h)) t_1 = math.sqrt((d / l)) tmp = 0 if M <= 9.5e-260: tmp = t_0 * t_1 elif M <= 210000000000.0: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * math.pow((D * ((M / d) * 0.5)), 2.0))))) else: tmp = t_0 * (t_1 * (-0.125 * ((D * ((M / d) * (h * (M / d)))) / (l / D)))) 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 / h)) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (M <= 9.5e-260) tmp = Float64(t_0 * t_1); elseif (M <= 210000000000.0) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 / Float64(l / Float64(h * (Float64(D * Float64(Float64(M / d) * 0.5)) ^ 2.0)))))); else tmp = Float64(t_0 * Float64(t_1 * Float64(-0.125 * Float64(Float64(D * Float64(Float64(M / d) * Float64(h * Float64(M / d)))) / Float64(l / D))))); 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 / h));
t_1 = sqrt((d / l));
tmp = 0.0;
if (M <= 9.5e-260)
tmp = t_0 * t_1;
elseif (M <= 210000000000.0)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * ((D * ((M / d) * 0.5)) ^ 2.0)))));
else
tmp = t_0 * (t_1 * (-0.125 * ((D * ((M / d) * (h * (M / d)))) / (l / D))));
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[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, 9.5e-260], N[(t$95$0 * t$95$1), $MachinePrecision], If[LessEqual[M, 210000000000.0], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 / N[(l / N[(h * N[Power[N[(D * N[(N[(M / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(t$95$1 * N[(-0.125 * N[(N[(D * N[(N[(M / d), $MachinePrecision] * N[(h * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l / D), $MachinePrecision]), $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}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;M \leq 9.5 \cdot 10^{-260}:\\
\;\;\;\;t_0 \cdot t_1\\
\mathbf{elif}\;M \leq 210000000000:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \frac{-0.5}{\frac{\ell}{h \cdot {\left(D \cdot \left(\frac{M}{d} \cdot 0.5\right)\right)}^{2}}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(-0.125 \cdot \frac{D \cdot \left(\frac{M}{d} \cdot \left(h \cdot \frac{M}{d}\right)\right)}{\frac{\ell}{D}}\right)\right)\\
\end{array}
\end{array}
if M < 9.5000000000000001e-260Initial program 68.4%
associate-*l*68.4%
metadata-eval68.4%
unpow1/268.4%
metadata-eval68.4%
unpow1/268.4%
sub-neg68.4%
+-commutative68.4%
*-commutative68.4%
distribute-rgt-neg-in68.4%
fma-def68.4%
Simplified67.9%
Taylor expanded in h around 0 39.3%
if 9.5000000000000001e-260 < M < 2.1e11Initial program 73.9%
metadata-eval73.9%
unpow1/273.9%
metadata-eval73.9%
unpow1/273.9%
*-commutative73.9%
associate-*l*73.9%
times-frac74.0%
metadata-eval74.0%
Simplified74.0%
associate-*r*74.0%
frac-times73.9%
*-commutative73.9%
metadata-eval73.9%
associate-*r/74.1%
metadata-eval74.1%
*-commutative74.1%
frac-times74.1%
associate-*l/74.1%
associate-*r/74.1%
div-inv74.1%
metadata-eval74.1%
Applied egg-rr74.1%
pow174.1%
*-commutative74.1%
associate-/l*73.9%
*-commutative73.9%
associate-*l/73.9%
sqrt-unprod63.8%
*-commutative63.8%
frac-times44.4%
*-commutative44.4%
Applied egg-rr44.4%
unpow144.4%
*-commutative44.4%
times-frac63.8%
sub-neg63.8%
associate-/l*63.8%
distribute-neg-frac63.8%
metadata-eval63.8%
Simplified63.8%
*-un-lft-identity63.8%
associate-/l/63.9%
div-inv63.9%
clear-num63.9%
Applied egg-rr63.9%
*-lft-identity63.9%
*-commutative63.9%
Simplified63.9%
if 2.1e11 < M Initial program 69.4%
associate-*l*69.4%
metadata-eval69.4%
unpow1/269.4%
metadata-eval69.4%
unpow1/269.4%
sub-neg69.4%
+-commutative69.4%
*-commutative69.4%
distribute-rgt-neg-in69.4%
fma-def69.4%
Simplified69.4%
Taylor expanded in h around inf 29.8%
associate-*r/29.8%
*-commutative29.8%
associate-*r/29.8%
times-frac31.7%
unpow231.7%
associate-/l*34.0%
associate-/l*34.1%
unpow234.1%
unpow234.1%
associate-*l/36.0%
*-commutative36.0%
times-frac38.1%
Simplified38.1%
associate-*l/36.1%
associate-/r/38.3%
Applied egg-rr38.3%
Final simplification44.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 -1.2e-101)
(*
(* d (sqrt (/ (/ 1.0 h) l)))
(- -1.0 (/ -0.5 (/ (/ l h) (pow (* D (/ 0.5 (/ d M))) 2.0)))))
(if (<= l 1.85e+198)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (/ -0.5 (/ l (* h (pow (* D (* (/ M d) 0.5)) 2.0))))))
(* d (* (pow h -0.5) (pow l -0.5))))))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.2e-101) {
tmp = (d * sqrt(((1.0 / h) / l))) * (-1.0 - (-0.5 / ((l / h) / pow((D * (0.5 / (d / M))), 2.0))));
} else if (l <= 1.85e+198) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * pow((D * ((M / d) * 0.5)), 2.0)))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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.2d-101)) then
tmp = (d * sqrt(((1.0d0 / h) / l))) * ((-1.0d0) - ((-0.5d0) / ((l / h) / ((d_1 * (0.5d0 / (d / m))) ** 2.0d0))))
else if (l <= 1.85d+198) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) / (l / (h * ((d_1 * ((m / d) * 0.5d0)) ** 2.0d0)))))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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.2e-101) {
tmp = (d * Math.sqrt(((1.0 / h) / l))) * (-1.0 - (-0.5 / ((l / h) / Math.pow((D * (0.5 / (d / M))), 2.0))));
} else if (l <= 1.85e+198) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * Math.pow((D * ((M / d) * 0.5)), 2.0)))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -1.2e-101: tmp = (d * math.sqrt(((1.0 / h) / l))) * (-1.0 - (-0.5 / ((l / h) / math.pow((D * (0.5 / (d / M))), 2.0)))) elif l <= 1.85e+198: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * math.pow((D * ((M / d) * 0.5)), 2.0))))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.2e-101) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / h) / l))) * Float64(-1.0 - Float64(-0.5 / Float64(Float64(l / h) / (Float64(D * Float64(0.5 / Float64(d / M))) ^ 2.0))))); elseif (l <= 1.85e+198) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 / Float64(l / Float64(h * (Float64(D * Float64(Float64(M / d) * 0.5)) ^ 2.0)))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); 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.2e-101)
tmp = (d * sqrt(((1.0 / h) / l))) * (-1.0 - (-0.5 / ((l / h) / ((D * (0.5 / (d / M))) ^ 2.0))));
elseif (l <= 1.85e+198)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * ((D * ((M / d) * 0.5)) ^ 2.0)))));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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.2e-101], N[(N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 / N[(N[(l / h), $MachinePrecision] / N[Power[N[(D * N[(0.5 / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.85e+198], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 / N[(l / N[(h * N[Power[N[(D * N[(N[(M / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{-101}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\right) \cdot \left(-1 - \frac{-0.5}{\frac{\frac{\ell}{h}}{{\left(D \cdot \frac{0.5}{\frac{d}{M}}\right)}^{2}}}\right)\\
\mathbf{elif}\;\ell \leq 1.85 \cdot 10^{+198}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \frac{-0.5}{\frac{\ell}{h \cdot {\left(D \cdot \left(\frac{M}{d} \cdot 0.5\right)\right)}^{2}}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.2e-101Initial program 60.6%
metadata-eval60.6%
unpow1/260.6%
metadata-eval60.6%
unpow1/260.6%
*-commutative60.6%
associate-*l*60.6%
times-frac60.6%
metadata-eval60.6%
Simplified60.6%
associate-*r*60.6%
frac-times60.6%
*-commutative60.6%
metadata-eval60.6%
associate-*r/60.5%
metadata-eval60.5%
*-commutative60.5%
frac-times60.5%
associate-*l/60.5%
associate-*r/60.5%
div-inv60.5%
metadata-eval60.5%
Applied egg-rr60.5%
pow160.5%
*-commutative60.5%
associate-/l*60.5%
*-commutative60.5%
associate-*l/60.5%
sqrt-unprod44.4%
*-commutative44.4%
frac-times33.6%
*-commutative33.6%
Applied egg-rr33.6%
unpow133.6%
*-commutative33.6%
times-frac44.4%
sub-neg44.4%
associate-/l*44.4%
distribute-neg-frac44.4%
metadata-eval44.4%
Simplified43.2%
Taylor expanded in d around -inf 68.1%
mul-1-neg68.1%
*-commutative68.1%
distribute-rgt-neg-in68.1%
*-commutative68.1%
associate-/r*68.1%
Simplified68.1%
if -1.2e-101 < l < 1.8499999999999999e198Initial program 77.6%
metadata-eval77.6%
unpow1/277.6%
metadata-eval77.6%
unpow1/277.6%
*-commutative77.6%
associate-*l*77.6%
times-frac77.9%
metadata-eval77.9%
Simplified77.9%
associate-*r*77.9%
frac-times77.6%
*-commutative77.6%
metadata-eval77.6%
associate-*r/82.4%
metadata-eval82.4%
*-commutative82.4%
frac-times82.7%
associate-*l/82.7%
associate-*r/82.7%
div-inv82.7%
metadata-eval82.7%
Applied egg-rr82.7%
pow182.7%
*-commutative82.7%
associate-/l*78.2%
*-commutative78.2%
associate-*l/78.2%
sqrt-unprod68.9%
*-commutative68.9%
frac-times50.4%
*-commutative50.4%
Applied egg-rr50.4%
unpow150.4%
*-commutative50.4%
times-frac68.9%
sub-neg68.9%
associate-/l*68.9%
distribute-neg-frac68.9%
metadata-eval68.9%
Simplified68.9%
*-un-lft-identity68.9%
associate-/l/73.4%
div-inv73.4%
clear-num73.4%
Applied egg-rr73.4%
*-lft-identity73.4%
*-commutative73.4%
Simplified73.4%
if 1.8499999999999999e198 < l Initial program 48.1%
metadata-eval48.1%
unpow1/248.1%
metadata-eval48.1%
unpow1/248.1%
*-commutative48.1%
associate-*l*48.1%
times-frac48.1%
metadata-eval48.1%
Simplified48.1%
Taylor expanded in d around inf 52.6%
*-un-lft-identity52.6%
*-commutative52.6%
Applied egg-rr52.6%
*-lft-identity52.6%
unpow-152.6%
sqr-pow52.6%
rem-sqrt-square52.6%
metadata-eval52.6%
sqr-pow52.4%
fabs-sqr52.4%
sqr-pow52.6%
Simplified52.6%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification71.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 (<= M 2.7e-259)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (/ -0.5 (/ l (* h (pow (* D (* (/ M d) 0.5)) 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 (M <= 2.7e-259) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * pow((D * ((M / d) * 0.5)), 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 (m <= 2.7d-259) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) / (l / (h * ((d_1 * ((m / d) * 0.5d0)) ** 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 (M <= 2.7e-259) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * Math.pow((D * ((M / d) * 0.5)), 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 M <= 2.7e-259: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * math.pow((D * ((M / d) * 0.5)), 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 (M <= 2.7e-259) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 / Float64(l / Float64(h * (Float64(D * Float64(Float64(M / d) * 0.5)) ^ 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 (M <= 2.7e-259)
tmp = sqrt((d / h)) * sqrt((d / l));
else
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 / (l / (h * ((D * ((M / d) * 0.5)) ^ 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[M, 2.7e-259], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 / N[(l / N[(h * N[Power[N[(D * N[(N[(M / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $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 2.7 \cdot 10^{-259}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \frac{-0.5}{\frac{\ell}{h \cdot {\left(D \cdot \left(\frac{M}{d} \cdot 0.5\right)\right)}^{2}}}\right)\\
\end{array}
\end{array}
if M < 2.69999999999999984e-259Initial program 68.4%
associate-*l*68.4%
metadata-eval68.4%
unpow1/268.4%
metadata-eval68.4%
unpow1/268.4%
sub-neg68.4%
+-commutative68.4%
*-commutative68.4%
distribute-rgt-neg-in68.4%
fma-def68.4%
Simplified67.9%
Taylor expanded in h around 0 39.3%
if 2.69999999999999984e-259 < M Initial program 71.8%
metadata-eval71.8%
unpow1/271.8%
metadata-eval71.8%
unpow1/271.8%
*-commutative71.8%
associate-*l*71.8%
times-frac71.8%
metadata-eval71.8%
Simplified71.8%
associate-*r*71.8%
frac-times71.8%
*-commutative71.8%
metadata-eval71.8%
associate-*r/73.8%
metadata-eval73.8%
*-commutative73.8%
frac-times73.9%
associate-*l/73.9%
associate-*r/73.9%
div-inv73.9%
metadata-eval73.9%
Applied egg-rr73.9%
pow173.9%
*-commutative73.9%
associate-/l*71.8%
*-commutative71.8%
associate-*l/71.8%
sqrt-unprod62.8%
*-commutative62.8%
frac-times45.5%
*-commutative45.5%
Applied egg-rr45.5%
unpow145.5%
*-commutative45.5%
times-frac62.8%
sub-neg62.8%
associate-/l*62.8%
distribute-neg-frac62.8%
metadata-eval62.8%
Simplified62.8%
*-un-lft-identity62.8%
associate-/l/64.9%
div-inv64.9%
clear-num64.9%
Applied egg-rr64.9%
*-lft-identity64.9%
*-commutative64.9%
Simplified64.9%
Final simplification50.0%
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 h) (/ d l))))
(t_1
(*
t_0
(+ 1.0 (* -0.125 (* D (* (/ D l) (* M (* (/ M d) (/ h d))))))))))
(if (<= d -1e+106)
(*
t_0
(+ 1.0 (/ -0.5 (* 4.0 (* (* (/ d D) (/ d D)) (/ l (* M (* h M))))))))
(if (<= d -7.4e-283)
t_1
(if (<= d 8e-215)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (/ (* (* D M) (* D M)) d)))
(if (<= d 2.75e+138) t_1 (* d (* (pow h -0.5) (pow l -0.5)))))))))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 / h) * (d / l)));
double t_1 = t_0 * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d)))))));
double tmp;
if (d <= -1e+106) {
tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * M)))))));
} else if (d <= -7.4e-283) {
tmp = t_1;
} else if (d <= 8e-215) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (((D * M) * (D * M)) / d));
} else if (d <= 2.75e+138) {
tmp = t_1;
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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) :: t_1
real(8) :: tmp
t_0 = sqrt(((d / h) * (d / l)))
t_1 = t_0 * (1.0d0 + ((-0.125d0) * (d_1 * ((d_1 / l) * (m * ((m / d) * (h / d)))))))
if (d <= (-1d+106)) then
tmp = t_0 * (1.0d0 + ((-0.5d0) / (4.0d0 * (((d / d_1) * (d / d_1)) * (l / (m * (h * m)))))))
else if (d <= (-7.4d-283)) then
tmp = t_1
else if (d <= 8d-215) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (((d_1 * m) * (d_1 * m)) / d))
else if (d <= 2.75d+138) then
tmp = t_1
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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 / h) * (d / l)));
double t_1 = t_0 * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d)))))));
double tmp;
if (d <= -1e+106) {
tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * M)))))));
} else if (d <= -7.4e-283) {
tmp = t_1;
} else if (d <= 8e-215) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (((D * M) * (D * M)) / d));
} else if (d <= 2.75e+138) {
tmp = t_1;
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
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 / h) * (d / l))) t_1 = t_0 * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d))))))) tmp = 0 if d <= -1e+106: tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * M))))))) elif d <= -7.4e-283: tmp = t_1 elif d <= 8e-215: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (((D * M) * (D * M)) / d)) elif d <= 2.75e+138: tmp = t_1 else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) 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 / h) * Float64(d / l))) t_1 = Float64(t_0 * Float64(1.0 + Float64(-0.125 * Float64(D * Float64(Float64(D / l) * Float64(M * Float64(Float64(M / d) * Float64(h / d)))))))) tmp = 0.0 if (d <= -1e+106) tmp = Float64(t_0 * Float64(1.0 + Float64(-0.5 / Float64(4.0 * Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(l / Float64(M * Float64(h * M)))))))); elseif (d <= -7.4e-283) tmp = t_1; elseif (d <= 8e-215) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) / d))); elseif (d <= 2.75e+138) tmp = t_1; else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); 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 / h) * (d / l)));
t_1 = t_0 * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d)))))));
tmp = 0.0;
if (d <= -1e+106)
tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * M)))))));
elseif (d <= -7.4e-283)
tmp = t_1;
elseif (d <= 8e-215)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (((D * M) * (D * M)) / d));
elseif (d <= 2.75e+138)
tmp = t_1;
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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 / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(1.0 + N[(-0.125 * N[(D * N[(N[(D / l), $MachinePrecision] * N[(M * N[(N[(M / d), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1e+106], N[(t$95$0 * N[(1.0 + N[(-0.5 / N[(4.0 * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(l / N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.4e-283], t$95$1, If[LessEqual[d, 8e-215], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.75e+138], t$95$1, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
t_1 := t_0 \cdot \left(1 + -0.125 \cdot \left(D \cdot \left(\frac{D}{\ell} \cdot \left(M \cdot \left(\frac{M}{d} \cdot \frac{h}{d}\right)\right)\right)\right)\right)\\
\mathbf{if}\;d \leq -1 \cdot 10^{+106}:\\
\;\;\;\;t_0 \cdot \left(1 + \frac{-0.5}{4 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\ell}{M \cdot \left(h \cdot M\right)}\right)}\right)\\
\mathbf{elif}\;d \leq -7.4 \cdot 10^{-283}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq 8 \cdot 10^{-215}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d}\right)\\
\mathbf{elif}\;d \leq 2.75 \cdot 10^{+138}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -1.00000000000000009e106Initial program 71.8%
metadata-eval71.8%
unpow1/271.8%
metadata-eval71.8%
unpow1/271.8%
*-commutative71.8%
associate-*l*71.8%
times-frac71.8%
metadata-eval71.8%
Simplified71.8%
associate-*r*71.8%
frac-times71.8%
*-commutative71.8%
metadata-eval71.8%
associate-*r/72.3%
metadata-eval72.3%
*-commutative72.3%
frac-times72.3%
associate-*l/72.3%
associate-*r/72.3%
div-inv72.3%
metadata-eval72.3%
Applied egg-rr72.3%
pow172.3%
*-commutative72.3%
associate-/l*71.8%
*-commutative71.8%
associate-*l/71.8%
sqrt-unprod57.2%
*-commutative57.2%
frac-times39.1%
*-commutative39.1%
Applied egg-rr39.1%
unpow139.1%
*-commutative39.1%
times-frac57.2%
sub-neg57.2%
associate-/l*57.2%
distribute-neg-frac57.2%
metadata-eval57.2%
Simplified57.2%
Taylor expanded in l around 0 31.4%
associate-/r*35.8%
*-commutative35.8%
associate-/r*31.4%
times-frac33.1%
unpow233.1%
unpow233.1%
times-frac45.0%
unpow245.0%
associate-*l*47.4%
Simplified47.4%
if -1.00000000000000009e106 < d < -7.4000000000000001e-283 or 8.00000000000000033e-215 < d < 2.7499999999999999e138Initial program 73.6%
metadata-eval73.6%
unpow1/273.6%
metadata-eval73.6%
unpow1/273.6%
*-commutative73.6%
associate-*l*73.6%
times-frac73.7%
metadata-eval73.7%
Simplified73.7%
pow1/273.7%
sqr-pow73.6%
metadata-eval73.6%
metadata-eval73.6%
Applied egg-rr73.6%
Taylor expanded in M around 0 55.8%
*-commutative55.8%
times-frac56.8%
unpow256.8%
associate-/l*60.3%
associate-/l*58.0%
unpow258.0%
unpow258.0%
associate-*l/60.7%
*-commutative60.7%
times-frac71.0%
Simplified71.0%
pow171.0%
Applied egg-rr51.9%
unpow151.9%
times-frac62.6%
sub-neg62.6%
associate-*r*62.6%
distribute-rgt-neg-in62.6%
Simplified63.4%
if -7.4000000000000001e-283 < d < 8.00000000000000033e-215Initial program 40.0%
metadata-eval40.0%
unpow1/240.0%
metadata-eval40.0%
unpow1/240.0%
*-commutative40.0%
associate-*l*40.0%
times-frac41.3%
metadata-eval41.3%
Simplified41.3%
associate-*r*41.3%
frac-times40.0%
*-commutative40.0%
metadata-eval40.0%
associate-*r/40.0%
metadata-eval40.0%
*-commutative40.0%
frac-times41.3%
associate-*l/41.3%
associate-*r/41.3%
div-inv41.3%
metadata-eval41.3%
Applied egg-rr41.3%
Taylor expanded in d around 0 35.2%
associate-*r*35.2%
*-commutative35.2%
unpow235.2%
unpow235.2%
unswap-sqr52.1%
Simplified52.1%
if 2.7499999999999999e138 < d Initial program 75.7%
metadata-eval75.7%
unpow1/275.7%
metadata-eval75.7%
unpow1/275.7%
*-commutative75.7%
associate-*l*75.7%
times-frac75.7%
metadata-eval75.7%
Simplified75.7%
Taylor expanded in d around inf 67.2%
*-un-lft-identity67.2%
*-commutative67.2%
Applied egg-rr67.2%
*-lft-identity67.2%
unpow-167.2%
sqr-pow67.2%
rem-sqrt-square67.2%
metadata-eval67.2%
sqr-pow66.9%
fabs-sqr66.9%
sqr-pow67.2%
Simplified67.2%
unpow-prod-down85.9%
Applied egg-rr85.9%
Final simplification62.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 h) (/ d l))))
(t_1 (* (sqrt (/ d h)) (sqrt (/ d l)))))
(if (<= M 4.2e-199)
t_1
(if (<= M 3.5e-143)
(*
t_0
(+ 1.0 (/ -0.5 (/ (* (* l 4.0) (* d d)) (* h (* (* D M) (* D M)))))))
(if (<= M 7.4e-106)
t_1
(*
t_0
(+
1.0
(/ -0.5 (* 4.0 (* (* (/ d D) (/ d D)) (/ l (* M (* h M)))))))))))))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 / h) * (d / l)));
double t_1 = sqrt((d / h)) * sqrt((d / l));
double tmp;
if (M <= 4.2e-199) {
tmp = t_1;
} else if (M <= 3.5e-143) {
tmp = t_0 * (1.0 + (-0.5 / (((l * 4.0) * (d * d)) / (h * ((D * M) * (D * M))))));
} else if (M <= 7.4e-106) {
tmp = t_1;
} else {
tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt(((d / h) * (d / l)))
t_1 = sqrt((d / h)) * sqrt((d / l))
if (m <= 4.2d-199) then
tmp = t_1
else if (m <= 3.5d-143) then
tmp = t_0 * (1.0d0 + ((-0.5d0) / (((l * 4.0d0) * (d * d)) / (h * ((d_1 * m) * (d_1 * m))))))
else if (m <= 7.4d-106) then
tmp = t_1
else
tmp = t_0 * (1.0d0 + ((-0.5d0) / (4.0d0 * (((d / d_1) * (d / d_1)) * (l / (m * (h * 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 t_0 = Math.sqrt(((d / h) * (d / l)));
double t_1 = Math.sqrt((d / h)) * Math.sqrt((d / l));
double tmp;
if (M <= 4.2e-199) {
tmp = t_1;
} else if (M <= 3.5e-143) {
tmp = t_0 * (1.0 + (-0.5 / (((l * 4.0) * (d * d)) / (h * ((D * M) * (D * M))))));
} else if (M <= 7.4e-106) {
tmp = t_1;
} else {
tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * M)))))));
}
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 / h) * (d / l))) t_1 = math.sqrt((d / h)) * math.sqrt((d / l)) tmp = 0 if M <= 4.2e-199: tmp = t_1 elif M <= 3.5e-143: tmp = t_0 * (1.0 + (-0.5 / (((l * 4.0) * (d * d)) / (h * ((D * M) * (D * M)))))) elif M <= 7.4e-106: tmp = t_1 else: tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * M))))))) 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 / h) * Float64(d / l))) t_1 = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) tmp = 0.0 if (M <= 4.2e-199) tmp = t_1; elseif (M <= 3.5e-143) tmp = Float64(t_0 * Float64(1.0 + Float64(-0.5 / Float64(Float64(Float64(l * 4.0) * Float64(d * d)) / Float64(h * Float64(Float64(D * M) * Float64(D * M))))))); elseif (M <= 7.4e-106) tmp = t_1; else tmp = Float64(t_0 * Float64(1.0 + Float64(-0.5 / Float64(4.0 * Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(l / Float64(M * Float64(h * 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)
t_0 = sqrt(((d / h) * (d / l)));
t_1 = sqrt((d / h)) * sqrt((d / l));
tmp = 0.0;
if (M <= 4.2e-199)
tmp = t_1;
elseif (M <= 3.5e-143)
tmp = t_0 * (1.0 + (-0.5 / (((l * 4.0) * (d * d)) / (h * ((D * M) * (D * M))))));
elseif (M <= 7.4e-106)
tmp = t_1;
else
tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * 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_] := Block[{t$95$0 = N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 4.2e-199], t$95$1, If[LessEqual[M, 3.5e-143], N[(t$95$0 * N[(1.0 + N[(-0.5 / N[(N[(N[(l * 4.0), $MachinePrecision] * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(h * N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 7.4e-106], t$95$1, N[(t$95$0 * N[(1.0 + N[(-0.5 / N[(4.0 * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(l / N[(M * N[(h * 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}
t_0 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;M \leq 4.2 \cdot 10^{-199}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;M \leq 3.5 \cdot 10^{-143}:\\
\;\;\;\;t_0 \cdot \left(1 + \frac{-0.5}{\frac{\left(\ell \cdot 4\right) \cdot \left(d \cdot d\right)}{h \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right)}}\right)\\
\mathbf{elif}\;M \leq 7.4 \cdot 10^{-106}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(1 + \frac{-0.5}{4 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\ell}{M \cdot \left(h \cdot M\right)}\right)}\right)\\
\end{array}
\end{array}
if M < 4.20000000000000004e-199 or 3.50000000000000005e-143 < M < 7.39999999999999959e-106Initial program 70.4%
associate-*l*70.4%
metadata-eval70.4%
unpow1/270.4%
metadata-eval70.4%
unpow1/270.4%
sub-neg70.4%
+-commutative70.4%
*-commutative70.4%
distribute-rgt-neg-in70.4%
fma-def70.4%
Simplified70.0%
Taylor expanded in h around 0 43.6%
if 4.20000000000000004e-199 < M < 3.50000000000000005e-143Initial program 58.4%
metadata-eval58.4%
unpow1/258.4%
metadata-eval58.4%
unpow1/258.4%
*-commutative58.4%
associate-*l*58.4%
times-frac58.4%
metadata-eval58.4%
Simplified58.4%
associate-*r*58.4%
frac-times58.4%
*-commutative58.4%
metadata-eval58.4%
associate-*r/58.7%
metadata-eval58.7%
*-commutative58.7%
frac-times58.7%
associate-*l/58.7%
associate-*r/58.7%
div-inv58.7%
metadata-eval58.7%
Applied egg-rr58.7%
pow158.7%
*-commutative58.7%
associate-/l*58.4%
*-commutative58.4%
associate-*l/58.4%
sqrt-unprod58.2%
*-commutative58.2%
frac-times49.9%
*-commutative49.9%
Applied egg-rr49.9%
unpow149.9%
*-commutative49.9%
times-frac58.2%
sub-neg58.2%
associate-/l*58.2%
distribute-neg-frac58.2%
metadata-eval58.2%
Simplified58.2%
Taylor expanded in l around 0 33.3%
associate-*r/33.3%
*-commutative33.3%
associate-*r*33.3%
*-commutative33.3%
associate-*r*33.3%
unpow233.3%
unpow233.3%
unpow233.3%
unswap-sqr49.9%
Simplified49.9%
if 7.39999999999999959e-106 < M Initial program 70.3%
metadata-eval70.3%
unpow1/270.3%
metadata-eval70.3%
unpow1/270.3%
*-commutative70.3%
associate-*l*70.3%
times-frac70.4%
metadata-eval70.4%
Simplified70.4%
associate-*r*70.4%
frac-times70.3%
*-commutative70.3%
metadata-eval70.3%
associate-*r/73.2%
metadata-eval73.2%
*-commutative73.2%
frac-times73.3%
associate-*l/73.3%
associate-*r/73.3%
div-inv73.3%
metadata-eval73.3%
Applied egg-rr73.3%
pow173.3%
*-commutative73.3%
associate-/l*70.4%
*-commutative70.4%
associate-*l/70.4%
sqrt-unprod61.4%
*-commutative61.4%
frac-times43.1%
*-commutative43.1%
Applied egg-rr43.1%
unpow143.1%
*-commutative43.1%
times-frac61.4%
sub-neg61.4%
associate-/l*61.4%
distribute-neg-frac61.4%
metadata-eval61.4%
Simplified61.4%
Taylor expanded in l around 0 42.5%
associate-/r*43.9%
*-commutative43.9%
associate-/r*42.5%
times-frac40.9%
unpow240.9%
unpow240.9%
times-frac50.2%
unpow250.2%
associate-*l*55.7%
Simplified55.7%
Final simplification47.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
(let* ((t_0 (sqrt (* (/ d h) (/ d l)))))
(if (<= d -1e+98)
(*
t_0
(+ 1.0 (/ -0.5 (* 4.0 (* (* (/ d D) (/ d D)) (/ l (* M (* h M))))))))
(if (<= d 3.4e+138)
(* t_0 (+ 1.0 (* -0.125 (* D (* (/ D l) (* M (* (/ M d) (/ h d))))))))
(* d (* (pow h -0.5) (pow l -0.5)))))))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 / h) * (d / l)));
double tmp;
if (d <= -1e+98) {
tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * M)))))));
} else if (d <= 3.4e+138) {
tmp = t_0 * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d)))))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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 / h) * (d / l)))
if (d <= (-1d+98)) then
tmp = t_0 * (1.0d0 + ((-0.5d0) / (4.0d0 * (((d / d_1) * (d / d_1)) * (l / (m * (h * m)))))))
else if (d <= 3.4d+138) then
tmp = t_0 * (1.0d0 + ((-0.125d0) * (d_1 * ((d_1 / l) * (m * ((m / d) * (h / d)))))))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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 / h) * (d / l)));
double tmp;
if (d <= -1e+98) {
tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * M)))))));
} else if (d <= 3.4e+138) {
tmp = t_0 * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d)))))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
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 / h) * (d / l))) tmp = 0 if d <= -1e+98: tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * M))))))) elif d <= 3.4e+138: tmp = t_0 * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d))))))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) 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 / h) * Float64(d / l))) tmp = 0.0 if (d <= -1e+98) tmp = Float64(t_0 * Float64(1.0 + Float64(-0.5 / Float64(4.0 * Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(l / Float64(M * Float64(h * M)))))))); elseif (d <= 3.4e+138) tmp = Float64(t_0 * Float64(1.0 + Float64(-0.125 * Float64(D * Float64(Float64(D / l) * Float64(M * Float64(Float64(M / d) * Float64(h / d)))))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); 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 / h) * (d / l)));
tmp = 0.0;
if (d <= -1e+98)
tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * M)))))));
elseif (d <= 3.4e+138)
tmp = t_0 * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d)))))));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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 / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1e+98], N[(t$95$0 * N[(1.0 + N[(-0.5 / N[(4.0 * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(l / N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.4e+138], N[(t$95$0 * N[(1.0 + N[(-0.125 * N[(D * N[(N[(D / l), $MachinePrecision] * N[(M * N[(N[(M / d), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{if}\;d \leq -1 \cdot 10^{+98}:\\
\;\;\;\;t_0 \cdot \left(1 + \frac{-0.5}{4 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\ell}{M \cdot \left(h \cdot M\right)}\right)}\right)\\
\mathbf{elif}\;d \leq 3.4 \cdot 10^{+138}:\\
\;\;\;\;t_0 \cdot \left(1 + -0.125 \cdot \left(D \cdot \left(\frac{D}{\ell} \cdot \left(M \cdot \left(\frac{M}{d} \cdot \frac{h}{d}\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -9.99999999999999998e97Initial program 71.8%
metadata-eval71.8%
unpow1/271.8%
metadata-eval71.8%
unpow1/271.8%
*-commutative71.8%
associate-*l*71.8%
times-frac71.8%
metadata-eval71.8%
Simplified71.8%
associate-*r*71.8%
frac-times71.8%
*-commutative71.8%
metadata-eval71.8%
associate-*r/72.3%
metadata-eval72.3%
*-commutative72.3%
frac-times72.3%
associate-*l/72.3%
associate-*r/72.3%
div-inv72.3%
metadata-eval72.3%
Applied egg-rr72.3%
pow172.3%
*-commutative72.3%
associate-/l*71.8%
*-commutative71.8%
associate-*l/71.8%
sqrt-unprod57.2%
*-commutative57.2%
frac-times39.1%
*-commutative39.1%
Applied egg-rr39.1%
unpow139.1%
*-commutative39.1%
times-frac57.2%
sub-neg57.2%
associate-/l*57.2%
distribute-neg-frac57.2%
metadata-eval57.2%
Simplified57.2%
Taylor expanded in l around 0 31.4%
associate-/r*35.8%
*-commutative35.8%
associate-/r*31.4%
times-frac33.1%
unpow233.1%
unpow233.1%
times-frac45.0%
unpow245.0%
associate-*l*47.4%
Simplified47.4%
if -9.99999999999999998e97 < d < 3.40000000000000011e138Initial program 68.1%
metadata-eval68.1%
unpow1/268.1%
metadata-eval68.1%
unpow1/268.1%
*-commutative68.1%
associate-*l*68.1%
times-frac68.4%
metadata-eval68.4%
Simplified68.4%
pow1/268.4%
sqr-pow68.3%
metadata-eval68.3%
metadata-eval68.3%
Applied egg-rr68.3%
Taylor expanded in M around 0 48.3%
*-commutative48.3%
times-frac49.1%
unpow249.1%
associate-/l*52.6%
associate-/l*51.3%
unpow251.3%
unpow251.3%
associate-*l/54.7%
*-commutative54.7%
times-frac64.0%
Simplified64.0%
pow164.0%
Applied egg-rr43.4%
unpow143.4%
times-frac54.6%
sub-neg54.6%
associate-*r*54.6%
distribute-rgt-neg-in54.6%
Simplified55.2%
if 3.40000000000000011e138 < d Initial program 75.7%
metadata-eval75.7%
unpow1/275.7%
metadata-eval75.7%
unpow1/275.7%
*-commutative75.7%
associate-*l*75.7%
times-frac75.7%
metadata-eval75.7%
Simplified75.7%
Taylor expanded in d around inf 67.2%
*-un-lft-identity67.2%
*-commutative67.2%
Applied egg-rr67.2%
*-lft-identity67.2%
unpow-167.2%
sqr-pow67.2%
rem-sqrt-square67.2%
metadata-eval67.2%
sqr-pow66.9%
fabs-sqr66.9%
sqr-pow67.2%
Simplified67.2%
unpow-prod-down85.9%
Applied egg-rr85.9%
Final simplification58.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
(let* ((t_0 (sqrt (* (/ d h) (/ d l)))))
(if (or (<= d -2.3e+90) (not (<= d 1.38e+101)))
(*
t_0
(+ 1.0 (/ -0.5 (* 4.0 (* (* (/ d D) (/ d D)) (/ l (* M (* h M))))))))
(* t_0 (+ 1.0 (* -0.125 (* D (* (/ D l) (* M (* (/ M d) (/ h d)))))))))))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 / h) * (d / l)));
double tmp;
if ((d <= -2.3e+90) || !(d <= 1.38e+101)) {
tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * M)))))));
} else {
tmp = t_0 * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d)))))));
}
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 / h) * (d / l)))
if ((d <= (-2.3d+90)) .or. (.not. (d <= 1.38d+101))) then
tmp = t_0 * (1.0d0 + ((-0.5d0) / (4.0d0 * (((d / d_1) * (d / d_1)) * (l / (m * (h * m)))))))
else
tmp = t_0 * (1.0d0 + ((-0.125d0) * (d_1 * ((d_1 / l) * (m * ((m / d) * (h / d)))))))
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 / h) * (d / l)));
double tmp;
if ((d <= -2.3e+90) || !(d <= 1.38e+101)) {
tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * M)))))));
} else {
tmp = t_0 * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d)))))));
}
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 / h) * (d / l))) tmp = 0 if (d <= -2.3e+90) or not (d <= 1.38e+101): tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * M))))))) else: tmp = t_0 * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d))))))) 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 / h) * Float64(d / l))) tmp = 0.0 if ((d <= -2.3e+90) || !(d <= 1.38e+101)) tmp = Float64(t_0 * Float64(1.0 + Float64(-0.5 / Float64(4.0 * Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(l / Float64(M * Float64(h * M)))))))); else tmp = Float64(t_0 * Float64(1.0 + Float64(-0.125 * Float64(D * Float64(Float64(D / l) * Float64(M * Float64(Float64(M / d) * Float64(h / d)))))))); 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 / h) * (d / l)));
tmp = 0.0;
if ((d <= -2.3e+90) || ~((d <= 1.38e+101)))
tmp = t_0 * (1.0 + (-0.5 / (4.0 * (((d / D) * (d / D)) * (l / (M * (h * M)))))));
else
tmp = t_0 * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d)))))));
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 / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[d, -2.3e+90], N[Not[LessEqual[d, 1.38e+101]], $MachinePrecision]], N[(t$95$0 * N[(1.0 + N[(-0.5 / N[(4.0 * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(l / N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 + N[(-0.125 * N[(D * N[(N[(D / l), $MachinePrecision] * N[(M * N[(N[(M / d), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}{h} \cdot \frac{d}{\ell}}\\
\mathbf{if}\;d \leq -2.3 \cdot 10^{+90} \lor \neg \left(d \leq 1.38 \cdot 10^{+101}\right):\\
\;\;\;\;t_0 \cdot \left(1 + \frac{-0.5}{4 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\ell}{M \cdot \left(h \cdot M\right)}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(1 + -0.125 \cdot \left(D \cdot \left(\frac{D}{\ell} \cdot \left(M \cdot \left(\frac{M}{d} \cdot \frac{h}{d}\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if d < -2.3e90 or 1.38e101 < d Initial program 74.4%
metadata-eval74.4%
unpow1/274.4%
metadata-eval74.4%
unpow1/274.4%
*-commutative74.4%
associate-*l*74.4%
times-frac74.3%
metadata-eval74.3%
Simplified74.3%
associate-*r*74.3%
frac-times74.4%
*-commutative74.4%
metadata-eval74.4%
associate-*r/77.1%
metadata-eval77.1%
*-commutative77.1%
frac-times77.1%
associate-*l/77.1%
associate-*r/77.1%
div-inv77.1%
metadata-eval77.1%
Applied egg-rr77.1%
pow177.1%
*-commutative77.1%
associate-/l*74.4%
*-commutative74.4%
associate-*l/74.4%
sqrt-unprod63.6%
*-commutative63.6%
frac-times41.9%
*-commutative41.9%
Applied egg-rr41.9%
unpow141.9%
*-commutative41.9%
times-frac63.6%
sub-neg63.6%
associate-/l*63.7%
distribute-neg-frac63.7%
metadata-eval63.7%
Simplified63.7%
Taylor expanded in l around 0 41.1%
associate-/r*43.3%
*-commutative43.3%
associate-/r*41.1%
times-frac39.6%
unpow239.6%
unpow239.6%
times-frac53.9%
unpow253.9%
associate-*l*56.4%
Simplified56.4%
if -2.3e90 < d < 1.38e101Initial program 67.5%
metadata-eval67.5%
unpow1/267.5%
metadata-eval67.5%
unpow1/267.5%
*-commutative67.5%
associate-*l*67.5%
times-frac67.8%
metadata-eval67.8%
Simplified67.8%
pow1/267.8%
sqr-pow67.7%
metadata-eval67.7%
metadata-eval67.7%
Applied egg-rr67.7%
Taylor expanded in M around 0 48.2%
*-commutative48.2%
times-frac49.0%
unpow249.0%
associate-/l*52.6%
associate-/l*51.9%
unpow251.9%
unpow251.9%
associate-*l/55.4%
*-commutative55.4%
times-frac63.8%
Simplified63.8%
pow163.8%
Applied egg-rr42.5%
unpow142.5%
times-frac54.1%
sub-neg54.1%
associate-*r*54.1%
distribute-rgt-neg-in54.1%
Simplified54.8%
Final simplification55.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 (* (sqrt (* (/ d h) (/ d l))) (+ 1.0 (* -0.125 (* D (* (/ D l) (* M (* (/ M d) (/ h d)))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return sqrt(((d / h) * (d / l))) * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d)))))));
}
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 = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.125d0) * (d_1 * ((d_1 / l) * (m * ((m / d) * (h / d)))))))
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 Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d)))))));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d)))))))
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.125 * Float64(D * Float64(Float64(D / l) * Float64(M * Float64(Float64(M / d) * Float64(h / d)))))))) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.125 * (D * ((D / l) * (M * ((M / d) * (h / d)))))));
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[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(D * N[(N[(D / l), $MachinePrecision] * N[(M * N[(N[(M / d), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.125 \cdot \left(D \cdot \left(\frac{D}{\ell} \cdot \left(M \cdot \left(\frac{M}{d} \cdot \frac{h}{d}\right)\right)\right)\right)\right)
\end{array}
Initial program 69.8%
metadata-eval69.8%
unpow1/269.8%
metadata-eval69.8%
unpow1/269.8%
*-commutative69.8%
associate-*l*69.8%
times-frac70.0%
metadata-eval70.0%
Simplified70.0%
pow1/270.0%
sqr-pow69.9%
metadata-eval69.9%
metadata-eval69.9%
Applied egg-rr69.9%
Taylor expanded in M around 0 48.0%
*-commutative48.0%
times-frac48.1%
unpow248.1%
associate-/l*50.9%
associate-/l*51.6%
unpow251.6%
unpow251.6%
associate-*l/55.5%
*-commutative55.5%
times-frac64.3%
Simplified64.3%
pow164.3%
Applied egg-rr40.4%
unpow140.4%
times-frac54.6%
sub-neg54.6%
associate-*r*54.6%
distribute-rgt-neg-in54.6%
Simplified55.9%
Final simplification55.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 (/ (/ 1.0 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(((1.0 / 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(((1.0d0 / 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(((1.0 / h) / l));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(((1.0 / 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(Float64(1.0 / 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(((1.0 / 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[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}
\end{array}
Initial program 69.8%
metadata-eval69.8%
unpow1/269.8%
metadata-eval69.8%
unpow1/269.8%
*-commutative69.8%
associate-*l*69.8%
times-frac70.0%
metadata-eval70.0%
Simplified70.0%
associate-*r*70.0%
frac-times69.8%
*-commutative69.8%
metadata-eval69.8%
associate-*r/72.6%
metadata-eval72.6%
*-commutative72.6%
frac-times72.8%
associate-*l/72.8%
associate-*r/72.8%
div-inv72.8%
metadata-eval72.8%
Applied egg-rr72.8%
add-cube-cbrt72.2%
Applied egg-rr72.2%
Taylor expanded in d around inf 27.1%
*-commutative27.1%
*-commutative27.1%
associate-/r*27.1%
Simplified27.1%
Final simplification27.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 (* d (pow (* h l) -0.5)))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * pow((h * l), -0.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.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d * ((h * l) ** (-0.5d0))
end function
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.pow((h * l), -0.5);
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.pow((h * l), -0.5)
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * (Float64(h * l) ^ -0.5)) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * ((h * l) ^ -0.5);
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[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 69.8%
metadata-eval69.8%
unpow1/269.8%
metadata-eval69.8%
unpow1/269.8%
*-commutative69.8%
associate-*l*69.8%
times-frac70.0%
metadata-eval70.0%
Simplified70.0%
Taylor expanded in d around inf 27.1%
*-un-lft-identity27.1%
*-commutative27.1%
Applied egg-rr27.1%
*-lft-identity27.1%
unpow-127.1%
sqr-pow27.1%
rem-sqrt-square27.0%
metadata-eval27.0%
sqr-pow27.0%
fabs-sqr27.0%
sqr-pow27.0%
Simplified27.0%
Final simplification27.0%
herbie shell --seed 2023250
(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)))))