
(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 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1
(fma (pow (* 0.5 (* (/ 1.0 d) (* D M))) 2.0) (* -0.5 (/ h l)) 1.0))
(t_2
(*
(* d (pow (* h l) -0.5))
(- -1.0 (* -0.5 (* (/ h l) (pow (* (/ D d) (* M 0.5)) 2.0)))))))
(if (<= d -5.5e+138)
t_2
(if (<= d -1.36e-127)
(* t_0 (* (sqrt (/ d h)) t_1))
(if (<= d -7.5e-297) t_2 (* t_0 (* t_1 (/ (sqrt d) (sqrt h)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = fma(pow((0.5 * ((1.0 / d) * (D * M))), 2.0), (-0.5 * (h / l)), 1.0);
double t_2 = (d * pow((h * l), -0.5)) * (-1.0 - (-0.5 * ((h / l) * pow(((D / d) * (M * 0.5)), 2.0))));
double tmp;
if (d <= -5.5e+138) {
tmp = t_2;
} else if (d <= -1.36e-127) {
tmp = t_0 * (sqrt((d / h)) * t_1);
} else if (d <= -7.5e-297) {
tmp = t_2;
} else {
tmp = t_0 * (t_1 * (sqrt(d) / sqrt(h)));
}
return tmp;
}
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = fma((Float64(0.5 * Float64(Float64(1.0 / d) * Float64(D * M))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0) t_2 = Float64(Float64(d * (Float64(h * l) ^ -0.5)) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0))))) tmp = 0.0 if (d <= -5.5e+138) tmp = t_2; elseif (d <= -1.36e-127) tmp = Float64(t_0 * Float64(sqrt(Float64(d / h)) * t_1)); elseif (d <= -7.5e-297) tmp = t_2; else tmp = Float64(t_0 * Float64(t_1 * Float64(sqrt(d) / sqrt(h)))); end return tmp end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(0.5 * N[(N[(1.0 / d), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5.5e+138], t$95$2, If[LessEqual[d, -1.36e-127], N[(t$95$0 * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.5e-297], t$95$2, N[(t$95$0 * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \mathsf{fma}\left({\left(0.5 \cdot \left(\frac{1}{d} \cdot \left(D \cdot M\right)\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\\
t_2 := \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right)\right)\\
\mathbf{if}\;d \leq -5.5 \cdot 10^{+138}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq -1.36 \cdot 10^{-127}:\\
\;\;\;\;t_0 \cdot \left(\sqrt{\frac{d}{h}} \cdot t_1\right)\\
\mathbf{elif}\;d \leq -7.5 \cdot 10^{-297}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if d < -5.4999999999999999e138 or -1.3599999999999999e-127 < d < -7.4999999999999994e-297Initial program 55.7%
Simplified52.8%
Applied egg-rr25.9%
expm1-def25.9%
expm1-log1p45.8%
associate-*l/38.8%
*-commutative38.8%
Simplified38.8%
Taylor expanded in d around -inf 70.5%
mul-1-neg70.5%
distribute-rgt-neg-in70.5%
unpow-170.5%
sqr-pow70.6%
rem-sqrt-square70.6%
metadata-eval70.6%
sqr-pow70.5%
fabs-sqr70.5%
sqr-pow70.6%
Simplified70.6%
if -5.4999999999999999e138 < d < -1.3599999999999999e-127Initial program 75.2%
Simplified75.2%
clear-num75.2%
inv-pow75.2%
Applied egg-rr75.2%
unpow-175.2%
associate-/l/75.2%
associate-/r/75.2%
*-commutative75.2%
Simplified75.2%
if -7.4999999999999994e-297 < d Initial program 64.1%
Simplified63.1%
clear-num63.1%
inv-pow63.1%
Applied egg-rr63.1%
unpow-163.1%
associate-/l/64.0%
associate-/r/64.0%
*-commutative64.0%
Simplified64.0%
sqrt-div77.3%
Applied egg-rr77.3%
Final simplification75.1%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D M) (* d 2.0)) 2.0)))))))
(if (<= t_0 1e+297)
t_0
(if (<= t_0 INFINITY)
(* d (sqrt (/ 1.0 (* h l))))
(fma
-0.125
(* (/ (sqrt h) (pow l 1.5)) (* D (/ D (/ d (* M M)))))
(* d (sqrt (/ (/ 1.0 l) h))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D * M) / (d * 2.0)), 2.0))));
double tmp;
if (t_0 <= 1e+297) {
tmp = t_0;
} else if (t_0 <= ((double) INFINITY)) {
tmp = d * sqrt((1.0 / (h * l)));
} else {
tmp = fma(-0.125, ((sqrt(h) / pow(l, 1.5)) * (D * (D / (d / (M * M))))), (d * sqrt(((1.0 / l) / h))));
}
return tmp;
}
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0))))) tmp = 0.0 if (t_0 <= 1e+297) tmp = t_0; elseif (t_0 <= Inf) tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); else tmp = fma(-0.125, Float64(Float64(sqrt(h) / (l ^ 1.5)) * Float64(D * Float64(D / Float64(d / Float64(M * M))))), Float64(d * sqrt(Float64(Float64(1.0 / l) / h)))); end return tmp end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+297], t$95$0, If[LessEqual[t$95$0, Infinity], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.125 * N[(N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision] * N[(D * N[(D / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{if}\;t_0 \leq 10^{+297}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq \infty:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.125, \frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \left(D \cdot \frac{D}{\frac{d}{M \cdot M}}\right), d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 1e297Initial program 90.0%
if 1e297 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < +inf.0Initial program 34.6%
Simplified34.6%
Taylor expanded in d around inf 47.1%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 0.0%
Simplified0.0%
add-cube-cbrt0.0%
pow30.0%
Applied egg-rr0.0%
Taylor expanded in d around 0 18.9%
fma-def18.9%
*-commutative18.9%
unpow218.9%
associate-/l*18.8%
*-rgt-identity18.8%
associate-*r/18.8%
unpow218.8%
associate-*l*18.9%
associate-*r/18.9%
*-rgt-identity18.9%
*-commutative18.9%
associate-/r*18.9%
Simplified18.9%
sqrt-div21.2%
Applied egg-rr21.2%
sqr-pow21.2%
rem-sqrt-square25.8%
sqr-pow25.8%
fabs-sqr25.8%
sqr-pow25.8%
metadata-eval25.8%
Simplified25.8%
Final simplification71.3%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1
(*
(* d (pow (* h l) -0.5))
(- -1.0 (* -0.5 (* (/ h l) (pow (* (/ D d) (* M 0.5)) 2.0)))))))
(if (<= d -4.6e+138)
t_1
(if (<= d -1.7e-128)
(*
t_0
(*
(sqrt (/ d h))
(fma (pow (* 0.5 (* (/ 1.0 d) (* D M))) 2.0) (* -0.5 (/ h l)) 1.0)))
(if (<= d -7.5e-297)
t_1
(*
(* t_0 (* (sqrt d) (sqrt (/ 1.0 h))))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (d * pow((h * l), -0.5)) * (-1.0 - (-0.5 * ((h / l) * pow(((D / d) * (M * 0.5)), 2.0))));
double tmp;
if (d <= -4.6e+138) {
tmp = t_1;
} else if (d <= -1.7e-128) {
tmp = t_0 * (sqrt((d / h)) * fma(pow((0.5 * ((1.0 / d) * (D * M))), 2.0), (-0.5 * (h / l)), 1.0));
} else if (d <= -7.5e-297) {
tmp = t_1;
} else {
tmp = (t_0 * (sqrt(d) * sqrt((1.0 / h)))) * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.0))));
}
return tmp;
}
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64(d * (Float64(h * l) ^ -0.5)) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0))))) tmp = 0.0 if (d <= -4.6e+138) tmp = t_1; elseif (d <= -1.7e-128) tmp = Float64(t_0 * Float64(sqrt(Float64(d / h)) * fma((Float64(0.5 * Float64(Float64(1.0 / d) * Float64(D * M))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0))); elseif (d <= -7.5e-297) tmp = t_1; else tmp = Float64(Float64(t_0 * Float64(sqrt(d) * sqrt(Float64(1.0 / h)))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0))))); end return tmp end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.6e+138], t$95$1, If[LessEqual[d, -1.7e-128], N[(t$95$0 * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(0.5 * N[(N[(1.0 / d), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.5e-297], t$95$1, N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] * N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right)\right)\\
\mathbf{if}\;d \leq -4.6 \cdot 10^{+138}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -1.7 \cdot 10^{-128}:\\
\;\;\;\;t_0 \cdot \left(\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(\frac{1}{d} \cdot \left(D \cdot M\right)\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)\\
\mathbf{elif}\;d \leq -7.5 \cdot 10^{-297}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 \cdot \left(\sqrt{d} \cdot \sqrt{\frac{1}{h}}\right)\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -4.60000000000000015e138 or -1.69999999999999987e-128 < d < -7.4999999999999994e-297Initial program 55.7%
Simplified52.8%
Applied egg-rr25.9%
expm1-def25.9%
expm1-log1p45.8%
associate-*l/38.8%
*-commutative38.8%
Simplified38.8%
Taylor expanded in d around -inf 70.5%
mul-1-neg70.5%
distribute-rgt-neg-in70.5%
unpow-170.5%
sqr-pow70.6%
rem-sqrt-square70.6%
metadata-eval70.6%
sqr-pow70.5%
fabs-sqr70.5%
sqr-pow70.6%
Simplified70.6%
if -4.60000000000000015e138 < d < -1.69999999999999987e-128Initial program 75.2%
Simplified75.2%
clear-num75.2%
inv-pow75.2%
Applied egg-rr75.2%
unpow-175.2%
associate-/l/75.2%
associate-/r/75.2%
*-commutative75.2%
Simplified75.2%
if -7.4999999999999994e-297 < d Initial program 64.1%
Simplified62.9%
pow1/262.9%
div-inv62.8%
unpow-prod-down74.8%
pow1/274.8%
Applied egg-rr74.8%
unpow1/274.8%
Simplified74.8%
Final simplification73.8%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (pow (* (/ D d) (* M 0.5)) 2.0))
(t_2 (* (* d (pow (* h l) -0.5)) (- -1.0 (* -0.5 (* (/ h l) t_1))))))
(if (<= d -3.5e+138)
t_2
(if (<= d -1.9e-129)
(*
t_0
(*
(sqrt (/ d h))
(fma (pow (* 0.5 (* (/ 1.0 d) (* D M))) 2.0) (* -0.5 (/ h l)) 1.0)))
(if (<= d -7.5e-297)
t_2
(*
(* t_0 (* (sqrt d) (sqrt (/ 1.0 h))))
(- 1.0 (* 0.5 (/ (* h t_1) l)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = pow(((D / d) * (M * 0.5)), 2.0);
double t_2 = (d * pow((h * l), -0.5)) * (-1.0 - (-0.5 * ((h / l) * t_1)));
double tmp;
if (d <= -3.5e+138) {
tmp = t_2;
} else if (d <= -1.9e-129) {
tmp = t_0 * (sqrt((d / h)) * fma(pow((0.5 * ((1.0 / d) * (D * M))), 2.0), (-0.5 * (h / l)), 1.0));
} else if (d <= -7.5e-297) {
tmp = t_2;
} else {
tmp = (t_0 * (sqrt(d) * sqrt((1.0 / h)))) * (1.0 - (0.5 * ((h * t_1) / l)));
}
return tmp;
}
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0 t_2 = Float64(Float64(d * (Float64(h * l) ^ -0.5)) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * t_1)))) tmp = 0.0 if (d <= -3.5e+138) tmp = t_2; elseif (d <= -1.9e-129) tmp = Float64(t_0 * Float64(sqrt(Float64(d / h)) * fma((Float64(0.5 * Float64(Float64(1.0 / d) * Float64(D * M))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0))); elseif (d <= -7.5e-297) tmp = t_2; else tmp = Float64(Float64(t_0 * Float64(sqrt(d) * sqrt(Float64(1.0 / h)))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * t_1) / l)))); end return tmp end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.5e+138], t$95$2, If[LessEqual[d, -1.9e-129], N[(t$95$0 * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(0.5 * N[(N[(1.0 / d), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.5e-297], t$95$2, N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] * N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * t$95$1), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\\
t_2 := \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot t_1\right)\right)\\
\mathbf{if}\;d \leq -3.5 \cdot 10^{+138}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq -1.9 \cdot 10^{-129}:\\
\;\;\;\;t_0 \cdot \left(\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(\frac{1}{d} \cdot \left(D \cdot M\right)\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)\\
\mathbf{elif}\;d \leq -7.5 \cdot 10^{-297}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 \cdot \left(\sqrt{d} \cdot \sqrt{\frac{1}{h}}\right)\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot t_1}{\ell}\right)\\
\end{array}
\end{array}
if d < -3.4999999999999998e138 or -1.89999999999999992e-129 < d < -7.4999999999999994e-297Initial program 55.7%
Simplified52.8%
Applied egg-rr25.9%
expm1-def25.9%
expm1-log1p45.8%
associate-*l/38.8%
*-commutative38.8%
Simplified38.8%
Taylor expanded in d around -inf 70.5%
mul-1-neg70.5%
distribute-rgt-neg-in70.5%
unpow-170.5%
sqr-pow70.6%
rem-sqrt-square70.6%
metadata-eval70.6%
sqr-pow70.5%
fabs-sqr70.5%
sqr-pow70.6%
Simplified70.6%
if -3.4999999999999998e138 < d < -1.89999999999999992e-129Initial program 75.2%
Simplified75.2%
clear-num75.2%
inv-pow75.2%
Applied egg-rr75.2%
unpow-175.2%
associate-/l/75.2%
associate-/r/75.2%
*-commutative75.2%
Simplified75.2%
if -7.4999999999999994e-297 < d Initial program 64.1%
Simplified62.9%
pow1/262.9%
div-inv62.8%
unpow-prod-down74.8%
pow1/274.8%
Applied egg-rr74.8%
unpow1/274.8%
Simplified74.8%
associate-*r/63.2%
div-inv63.2%
metadata-eval63.2%
Applied egg-rr76.5%
Final simplification74.6%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1
(*
(* d (pow (* h l) -0.5))
(- -1.0 (* -0.5 (* (/ h l) (pow (* (/ D d) (* M 0.5)) 2.0)))))))
(if (<= d -1.95e+138)
t_1
(if (<= d -1.9e-129)
(*
t_0
(*
(sqrt (/ d h))
(fma (pow (* 0.5 (* (/ 1.0 d) (* D M))) 2.0) (* -0.5 (/ h l)) 1.0)))
(if (<= d -7.5e-297)
t_1
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))
(* t_0 (/ (sqrt d) (sqrt h)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (d * pow((h * l), -0.5)) * (-1.0 - (-0.5 * ((h / l) * pow(((D / d) * (M * 0.5)), 2.0))));
double tmp;
if (d <= -1.95e+138) {
tmp = t_1;
} else if (d <= -1.9e-129) {
tmp = t_0 * (sqrt((d / h)) * fma(pow((0.5 * ((1.0 / d) * (D * M))), 2.0), (-0.5 * (h / l)), 1.0));
} else if (d <= -7.5e-297) {
tmp = t_1;
} else {
tmp = (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.0)))) * (t_0 * (sqrt(d) / sqrt(h)));
}
return tmp;
}
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64(d * (Float64(h * l) ^ -0.5)) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0))))) tmp = 0.0 if (d <= -1.95e+138) tmp = t_1; elseif (d <= -1.9e-129) tmp = Float64(t_0 * Float64(sqrt(Float64(d / h)) * fma((Float64(0.5 * Float64(Float64(1.0 / d) * Float64(D * M))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0))); elseif (d <= -7.5e-297) tmp = t_1; else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)))) * Float64(t_0 * Float64(sqrt(d) / sqrt(h)))); end return tmp end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.95e+138], t$95$1, If[LessEqual[d, -1.9e-129], N[(t$95$0 * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(0.5 * N[(N[(1.0 / d), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.5e-297], t$95$1, N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right)\right)\\
\mathbf{if}\;d \leq -1.95 \cdot 10^{+138}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -1.9 \cdot 10^{-129}:\\
\;\;\;\;t_0 \cdot \left(\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(\frac{1}{d} \cdot \left(D \cdot M\right)\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)\\
\mathbf{elif}\;d \leq -7.5 \cdot 10^{-297}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if d < -1.9499999999999999e138 or -1.89999999999999992e-129 < d < -7.4999999999999994e-297Initial program 55.7%
Simplified52.8%
Applied egg-rr25.9%
expm1-def25.9%
expm1-log1p45.8%
associate-*l/38.8%
*-commutative38.8%
Simplified38.8%
Taylor expanded in d around -inf 70.5%
mul-1-neg70.5%
distribute-rgt-neg-in70.5%
unpow-170.5%
sqr-pow70.6%
rem-sqrt-square70.6%
metadata-eval70.6%
sqr-pow70.5%
fabs-sqr70.5%
sqr-pow70.6%
Simplified70.6%
if -1.9499999999999999e138 < d < -1.89999999999999992e-129Initial program 75.2%
Simplified75.2%
clear-num75.2%
inv-pow75.2%
Applied egg-rr75.2%
unpow-175.2%
associate-/l/75.2%
associate-/r/75.2%
*-commutative75.2%
Simplified75.2%
if -7.4999999999999994e-297 < d Initial program 64.1%
Simplified62.9%
sqrt-div77.3%
Applied egg-rr74.8%
Final simplification73.8%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* (/ D d) (* M 0.5)) 2.0))
(t_1 (* -0.5 (* (/ h l) t_0)))
(t_2 (sqrt (/ d l)))
(t_3 (* d (pow (* h l) -0.5))))
(if (<= h -1.45e-202)
(* t_3 (- -1.0 t_1))
(if (<= h 5.8e-212)
(* (- 1.0 (* 0.5 (/ (* h t_0) l))) (* t_2 (sqrt (/ d h))))
(if (<= h 5.5e+201)
(* (+ 1.0 t_1) t_3)
(*
t_2
(*
(/ (sqrt d) (sqrt h))
(* -0.125 (* (* (/ D d) (/ D d)) (/ (* M M) (/ l h)))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((D / d) * (M * 0.5)), 2.0);
double t_1 = -0.5 * ((h / l) * t_0);
double t_2 = sqrt((d / l));
double t_3 = d * pow((h * l), -0.5);
double tmp;
if (h <= -1.45e-202) {
tmp = t_3 * (-1.0 - t_1);
} else if (h <= 5.8e-212) {
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (t_2 * sqrt((d / h)));
} else if (h <= 5.5e+201) {
tmp = (1.0 + t_1) * t_3;
} else {
tmp = t_2 * ((sqrt(d) / sqrt(h)) * (-0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = ((d_1 / d) * (m * 0.5d0)) ** 2.0d0
t_1 = (-0.5d0) * ((h / l) * t_0)
t_2 = sqrt((d / l))
t_3 = d * ((h * l) ** (-0.5d0))
if (h <= (-1.45d-202)) then
tmp = t_3 * ((-1.0d0) - t_1)
else if (h <= 5.8d-212) then
tmp = (1.0d0 - (0.5d0 * ((h * t_0) / l))) * (t_2 * sqrt((d / h)))
else if (h <= 5.5d+201) then
tmp = (1.0d0 + t_1) * t_3
else
tmp = t_2 * ((sqrt(d) / sqrt(h)) * ((-0.125d0) * (((d_1 / d) * (d_1 / d)) * ((m * m) / (l / h)))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow(((D / d) * (M * 0.5)), 2.0);
double t_1 = -0.5 * ((h / l) * t_0);
double t_2 = Math.sqrt((d / l));
double t_3 = d * Math.pow((h * l), -0.5);
double tmp;
if (h <= -1.45e-202) {
tmp = t_3 * (-1.0 - t_1);
} else if (h <= 5.8e-212) {
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (t_2 * Math.sqrt((d / h)));
} else if (h <= 5.5e+201) {
tmp = (1.0 + t_1) * t_3;
} else {
tmp = t_2 * ((Math.sqrt(d) / Math.sqrt(h)) * (-0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow(((D / d) * (M * 0.5)), 2.0) t_1 = -0.5 * ((h / l) * t_0) t_2 = math.sqrt((d / l)) t_3 = d * math.pow((h * l), -0.5) tmp = 0 if h <= -1.45e-202: tmp = t_3 * (-1.0 - t_1) elif h <= 5.8e-212: tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (t_2 * math.sqrt((d / h))) elif h <= 5.5e+201: tmp = (1.0 + t_1) * t_3 else: tmp = t_2 * ((math.sqrt(d) / math.sqrt(h)) * (-0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0 t_1 = Float64(-0.5 * Float64(Float64(h / l) * t_0)) t_2 = sqrt(Float64(d / l)) t_3 = Float64(d * (Float64(h * l) ^ -0.5)) tmp = 0.0 if (h <= -1.45e-202) tmp = Float64(t_3 * Float64(-1.0 - t_1)); elseif (h <= 5.8e-212) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * t_0) / l))) * Float64(t_2 * sqrt(Float64(d / h)))); elseif (h <= 5.5e+201) tmp = Float64(Float64(1.0 + t_1) * t_3); else tmp = Float64(t_2 * Float64(Float64(sqrt(d) / sqrt(h)) * Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) / Float64(l / h)))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = ((D / d) * (M * 0.5)) ^ 2.0;
t_1 = -0.5 * ((h / l) * t_0);
t_2 = sqrt((d / l));
t_3 = d * ((h * l) ^ -0.5);
tmp = 0.0;
if (h <= -1.45e-202)
tmp = t_3 * (-1.0 - t_1);
elseif (h <= 5.8e-212)
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (t_2 * sqrt((d / h)));
elseif (h <= 5.5e+201)
tmp = (1.0 + t_1) * t_3;
else
tmp = t_2 * ((sqrt(d) / sqrt(h)) * (-0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(-0.5 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.45e-202], N[(t$95$3 * N[(-1.0 - t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5.8e-212], N[(N[(1.0 - N[(0.5 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5.5e+201], N[(N[(1.0 + t$95$1), $MachinePrecision] * t$95$3), $MachinePrecision], N[(t$95$2 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\\
t_1 := -0.5 \cdot \left(\frac{h}{\ell} \cdot t_0\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;h \leq -1.45 \cdot 10^{-202}:\\
\;\;\;\;t_3 \cdot \left(-1 - t_1\right)\\
\mathbf{elif}\;h \leq 5.8 \cdot 10^{-212}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot t_0}{\ell}\right) \cdot \left(t_2 \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;h \leq 5.5 \cdot 10^{+201}:\\
\;\;\;\;\left(1 + t_1\right) \cdot t_3\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\right)\\
\end{array}
\end{array}
if h < -1.44999999999999994e-202Initial program 64.5%
Simplified63.6%
Applied egg-rr24.4%
expm1-def30.6%
expm1-log1p52.9%
associate-*l/46.9%
*-commutative46.9%
Simplified46.9%
Taylor expanded in d around -inf 69.6%
mul-1-neg69.6%
distribute-rgt-neg-in69.6%
unpow-169.6%
sqr-pow69.7%
rem-sqrt-square69.7%
metadata-eval69.7%
sqr-pow69.5%
fabs-sqr69.5%
sqr-pow69.7%
Simplified69.7%
if -1.44999999999999994e-202 < h < 5.7999999999999999e-212Initial program 67.1%
Simplified64.9%
associate-*r/69.3%
div-inv69.3%
metadata-eval69.3%
Applied egg-rr69.3%
if 5.7999999999999999e-212 < h < 5.49999999999999946e201Initial program 71.7%
Simplified71.1%
Applied egg-rr19.4%
expm1-def28.1%
expm1-log1p52.7%
associate-*l/47.1%
*-commutative47.1%
Simplified47.1%
Taylor expanded in d around 0 83.5%
unpow-183.5%
sqr-pow83.5%
rem-sqrt-square83.5%
metadata-eval83.5%
sqr-pow83.3%
fabs-sqr83.3%
sqr-pow83.5%
Simplified83.5%
if 5.49999999999999946e201 < h Initial program 31.4%
Simplified26.6%
Taylor expanded in M around inf 17.5%
times-frac17.8%
unpow217.8%
unpow217.8%
times-frac18.0%
associate-/l*17.7%
unpow217.7%
Simplified17.7%
sqrt-div66.1%
Applied egg-rr52.6%
Final simplification72.6%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* -0.5 (* (/ h l) (pow (* (/ D d) (* M 0.5)) 2.0))))
(t_1 (* d (pow (* h l) -0.5))))
(if (<= h -4.8e-235)
(* t_1 (- -1.0 t_0))
(if (<= h 5.4e-207)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(* (+ 1.0 t_0) t_1)))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = -0.5 * ((h / l) * pow(((D / d) * (M * 0.5)), 2.0));
double t_1 = d * pow((h * l), -0.5);
double tmp;
if (h <= -4.8e-235) {
tmp = t_1 * (-1.0 - t_0);
} else if (h <= 5.4e-207) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.0)))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = (1.0 + t_0) * t_1;
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-0.5d0) * ((h / l) * (((d_1 / d) * (m * 0.5d0)) ** 2.0d0))
t_1 = d * ((h * l) ** (-0.5d0))
if (h <= (-4.8d-235)) then
tmp = t_1 * ((-1.0d0) - t_0)
else if (h <= 5.4d-207) then
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0)))) * (sqrt((d / l)) * sqrt((d / h)))
else
tmp = (1.0d0 + t_0) * t_1
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = -0.5 * ((h / l) * Math.pow(((D / d) * (M * 0.5)), 2.0));
double t_1 = d * Math.pow((h * l), -0.5);
double tmp;
if (h <= -4.8e-235) {
tmp = t_1 * (-1.0 - t_0);
} else if (h <= 5.4e-207) {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0)))) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
} else {
tmp = (1.0 + t_0) * t_1;
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = -0.5 * ((h / l) * math.pow(((D / d) * (M * 0.5)), 2.0)) t_1 = d * math.pow((h * l), -0.5) tmp = 0 if h <= -4.8e-235: tmp = t_1 * (-1.0 - t_0) elif h <= 5.4e-207: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0)))) * (math.sqrt((d / l)) * math.sqrt((d / h))) else: tmp = (1.0 + t_0) * t_1 return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0))) t_1 = Float64(d * (Float64(h * l) ^ -0.5)) tmp = 0.0 if (h <= -4.8e-235) tmp = Float64(t_1 * Float64(-1.0 - t_0)); elseif (h <= 5.4e-207) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(1.0 + t_0) * t_1); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = -0.5 * ((h / l) * (((D / d) * (M * 0.5)) ^ 2.0));
t_1 = d * ((h * l) ^ -0.5);
tmp = 0.0;
if (h <= -4.8e-235)
tmp = t_1 * (-1.0 - t_0);
elseif (h <= 5.4e-207)
tmp = (1.0 - (0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 2.0)))) * (sqrt((d / l)) * sqrt((d / h)));
else
tmp = (1.0 + t_0) * t_1;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -4.8e-235], N[(t$95$1 * N[(-1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5.4e-207], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right)\\
t_1 := d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;h \leq -4.8 \cdot 10^{-235}:\\
\;\;\;\;t_1 \cdot \left(-1 - t_0\right)\\
\mathbf{elif}\;h \leq 5.4 \cdot 10^{-207}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t_0\right) \cdot t_1\\
\end{array}
\end{array}
if h < -4.80000000000000022e-235Initial program 63.8%
Simplified62.9%
Applied egg-rr25.1%
expm1-def30.8%
expm1-log1p52.4%
associate-*l/47.6%
*-commutative47.6%
Simplified47.6%
Taylor expanded in d around -inf 68.6%
mul-1-neg68.6%
distribute-rgt-neg-in68.6%
unpow-168.6%
sqr-pow68.6%
rem-sqrt-square68.6%
metadata-eval68.6%
sqr-pow68.5%
fabs-sqr68.5%
sqr-pow68.6%
Simplified68.6%
if -4.80000000000000022e-235 < h < 5.4e-207Initial program 70.0%
Simplified67.3%
if 5.4e-207 < h Initial program 63.0%
Simplified61.5%
Applied egg-rr16.2%
expm1-def22.9%
expm1-log1p44.3%
associate-*l/39.1%
*-commutative39.1%
Simplified39.1%
Taylor expanded in d around 0 72.3%
unpow-172.3%
sqr-pow72.3%
rem-sqrt-square72.3%
metadata-eval72.3%
sqr-pow72.2%
fabs-sqr72.2%
sqr-pow72.3%
Simplified72.3%
Final simplification70.0%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* (/ D d) (* M 0.5)) 2.0))
(t_1 (* -0.5 (* (/ h l) t_0)))
(t_2 (* d (pow (* h l) -0.5))))
(if (<= h -1.45e-202)
(* t_2 (- -1.0 t_1))
(if (<= h 9.6e-207)
(* (- 1.0 (* 0.5 (/ (* h t_0) l))) (* (sqrt (/ d l)) (sqrt (/ d h))))
(* (+ 1.0 t_1) t_2)))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((D / d) * (M * 0.5)), 2.0);
double t_1 = -0.5 * ((h / l) * t_0);
double t_2 = d * pow((h * l), -0.5);
double tmp;
if (h <= -1.45e-202) {
tmp = t_2 * (-1.0 - t_1);
} else if (h <= 9.6e-207) {
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = (1.0 + t_1) * t_2;
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = ((d_1 / d) * (m * 0.5d0)) ** 2.0d0
t_1 = (-0.5d0) * ((h / l) * t_0)
t_2 = d * ((h * l) ** (-0.5d0))
if (h <= (-1.45d-202)) then
tmp = t_2 * ((-1.0d0) - t_1)
else if (h <= 9.6d-207) then
tmp = (1.0d0 - (0.5d0 * ((h * t_0) / l))) * (sqrt((d / l)) * sqrt((d / h)))
else
tmp = (1.0d0 + t_1) * t_2
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow(((D / d) * (M * 0.5)), 2.0);
double t_1 = -0.5 * ((h / l) * t_0);
double t_2 = d * Math.pow((h * l), -0.5);
double tmp;
if (h <= -1.45e-202) {
tmp = t_2 * (-1.0 - t_1);
} else if (h <= 9.6e-207) {
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
} else {
tmp = (1.0 + t_1) * t_2;
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow(((D / d) * (M * 0.5)), 2.0) t_1 = -0.5 * ((h / l) * t_0) t_2 = d * math.pow((h * l), -0.5) tmp = 0 if h <= -1.45e-202: tmp = t_2 * (-1.0 - t_1) elif h <= 9.6e-207: tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (math.sqrt((d / l)) * math.sqrt((d / h))) else: tmp = (1.0 + t_1) * t_2 return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0 t_1 = Float64(-0.5 * Float64(Float64(h / l) * t_0)) t_2 = Float64(d * (Float64(h * l) ^ -0.5)) tmp = 0.0 if (h <= -1.45e-202) tmp = Float64(t_2 * Float64(-1.0 - t_1)); elseif (h <= 9.6e-207) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * t_0) / l))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(1.0 + t_1) * t_2); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = ((D / d) * (M * 0.5)) ^ 2.0;
t_1 = -0.5 * ((h / l) * t_0);
t_2 = d * ((h * l) ^ -0.5);
tmp = 0.0;
if (h <= -1.45e-202)
tmp = t_2 * (-1.0 - t_1);
elseif (h <= 9.6e-207)
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (sqrt((d / l)) * sqrt((d / h)));
else
tmp = (1.0 + t_1) * t_2;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(-0.5 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.45e-202], N[(t$95$2 * N[(-1.0 - t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 9.6e-207], N[(N[(1.0 - N[(0.5 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\\
t_1 := -0.5 \cdot \left(\frac{h}{\ell} \cdot t_0\right)\\
t_2 := d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;h \leq -1.45 \cdot 10^{-202}:\\
\;\;\;\;t_2 \cdot \left(-1 - t_1\right)\\
\mathbf{elif}\;h \leq 9.6 \cdot 10^{-207}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot t_0}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t_1\right) \cdot t_2\\
\end{array}
\end{array}
if h < -1.44999999999999994e-202Initial program 64.5%
Simplified63.6%
Applied egg-rr24.4%
expm1-def30.6%
expm1-log1p52.9%
associate-*l/46.9%
*-commutative46.9%
Simplified46.9%
Taylor expanded in d around -inf 69.6%
mul-1-neg69.6%
distribute-rgt-neg-in69.6%
unpow-169.6%
sqr-pow69.7%
rem-sqrt-square69.7%
metadata-eval69.7%
sqr-pow69.5%
fabs-sqr69.5%
sqr-pow69.7%
Simplified69.7%
if -1.44999999999999994e-202 < h < 9.59999999999999956e-207Initial program 67.1%
Simplified64.9%
associate-*r/69.3%
div-inv69.3%
metadata-eval69.3%
Applied egg-rr69.3%
if 9.59999999999999956e-207 < h Initial program 63.0%
Simplified61.5%
Applied egg-rr16.2%
expm1-def22.9%
expm1-log1p44.3%
associate-*l/39.1%
*-commutative39.1%
Simplified39.1%
Taylor expanded in d around 0 72.3%
unpow-172.3%
sqr-pow72.3%
rem-sqrt-square72.3%
metadata-eval72.3%
sqr-pow72.2%
fabs-sqr72.2%
sqr-pow72.3%
Simplified72.3%
Final simplification70.7%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* -0.125 (* (sqrt (/ h (pow l 3.0))) (* D (* M (* (/ D d) M))))))
(t_1
(*
(sqrt (/ (* d (/ d l)) h))
(+
1.0
(* -0.5 (* (/ 0.25 l) (/ (* D (* D (* M M))) (* d (/ d h)))))))))
(if (<= d -2.2e+104)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d -2.1e-140)
t_1
(if (<= d -2e-310)
(/ d (+ (+ 1.0 (sqrt (* h l))) -1.0))
(if (<= d 6.6e-238)
t_0
(if (<= d 1.95e-150)
(/ d (* (sqrt h) (sqrt l)))
(if (<= d 5.5e-60)
t_0
(if (<= d 2.8e+126)
t_1
(* d (* (pow h -0.5) (pow l -0.5))))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = -0.125 * (sqrt((h / pow(l, 3.0))) * (D * (M * ((D / d) * M))));
double t_1 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double tmp;
if (d <= -2.2e+104) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= -2.1e-140) {
tmp = t_1;
} else if (d <= -2e-310) {
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
} else if (d <= 6.6e-238) {
tmp = t_0;
} else if (d <= 1.95e-150) {
tmp = d / (sqrt(h) * sqrt(l));
} else if (d <= 5.5e-60) {
tmp = t_0;
} else if (d <= 2.8e+126) {
tmp = t_1;
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-0.125d0) * (sqrt((h / (l ** 3.0d0))) * (d_1 * (m * ((d_1 / d) * m))))
t_1 = sqrt(((d * (d / l)) / h)) * (1.0d0 + ((-0.5d0) * ((0.25d0 / l) * ((d_1 * (d_1 * (m * m))) / (d * (d / h))))))
if (d <= (-2.2d+104)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (d <= (-2.1d-140)) then
tmp = t_1
else if (d <= (-2d-310)) then
tmp = d / ((1.0d0 + sqrt((h * l))) + (-1.0d0))
else if (d <= 6.6d-238) then
tmp = t_0
else if (d <= 1.95d-150) then
tmp = d / (sqrt(h) * sqrt(l))
else if (d <= 5.5d-60) then
tmp = t_0
else if (d <= 2.8d+126) then
tmp = t_1
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = -0.125 * (Math.sqrt((h / Math.pow(l, 3.0))) * (D * (M * ((D / d) * M))));
double t_1 = Math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double tmp;
if (d <= -2.2e+104) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (d <= -2.1e-140) {
tmp = t_1;
} else if (d <= -2e-310) {
tmp = d / ((1.0 + Math.sqrt((h * l))) + -1.0);
} else if (d <= 6.6e-238) {
tmp = t_0;
} else if (d <= 1.95e-150) {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
} else if (d <= 5.5e-60) {
tmp = t_0;
} else if (d <= 2.8e+126) {
tmp = t_1;
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = -0.125 * (math.sqrt((h / math.pow(l, 3.0))) * (D * (M * ((D / d) * M)))) t_1 = math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h)))))) tmp = 0 if d <= -2.2e+104: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif d <= -2.1e-140: tmp = t_1 elif d <= -2e-310: tmp = d / ((1.0 + math.sqrt((h * l))) + -1.0) elif d <= 6.6e-238: tmp = t_0 elif d <= 1.95e-150: tmp = d / (math.sqrt(h) * math.sqrt(l)) elif d <= 5.5e-60: tmp = t_0 elif d <= 2.8e+126: tmp = t_1 else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(-0.125 * Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(D * Float64(M * Float64(Float64(D / d) * M))))) t_1 = Float64(sqrt(Float64(Float64(d * Float64(d / l)) / h)) * Float64(1.0 + Float64(-0.5 * Float64(Float64(0.25 / l) * Float64(Float64(D * Float64(D * Float64(M * M))) / Float64(d * Float64(d / h))))))) tmp = 0.0 if (d <= -2.2e+104) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= -2.1e-140) tmp = t_1; elseif (d <= -2e-310) tmp = Float64(d / Float64(Float64(1.0 + sqrt(Float64(h * l))) + -1.0)); elseif (d <= 6.6e-238) tmp = t_0; elseif (d <= 1.95e-150) tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); elseif (d <= 5.5e-60) tmp = t_0; elseif (d <= 2.8e+126) tmp = t_1; else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = -0.125 * (sqrt((h / (l ^ 3.0))) * (D * (M * ((D / d) * M))));
t_1 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
tmp = 0.0;
if (d <= -2.2e+104)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (d <= -2.1e-140)
tmp = t_1;
elseif (d <= -2e-310)
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
elseif (d <= 6.6e-238)
tmp = t_0;
elseif (d <= 1.95e-150)
tmp = d / (sqrt(h) * sqrt(l));
elseif (d <= 5.5e-60)
tmp = t_0;
elseif (d <= 2.8e+126)
tmp = t_1;
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(-0.125 * N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(D * N[(M * N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(N[(d * N[(d / l), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(0.25 / l), $MachinePrecision] * N[(N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.2e+104], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.1e-140], t$95$1, If[LessEqual[d, -2e-310], N[(d / N[(N[(1.0 + N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.6e-238], t$95$0, If[LessEqual[d, 1.95e-150], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.5e-60], t$95$0, If[LessEqual[d, 2.8e+126], t$95$1, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := -0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(D \cdot \left(M \cdot \left(\frac{D}{d} \cdot M\right)\right)\right)\right)\\
t_1 := \sqrt{\frac{d \cdot \frac{d}{\ell}}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{0.25}{\ell} \cdot \frac{D \cdot \left(D \cdot \left(M \cdot M\right)\right)}{d \cdot \frac{d}{h}}\right)\right)\\
\mathbf{if}\;d \leq -2.2 \cdot 10^{+104}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -2.1 \cdot 10^{-140}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\left(1 + \sqrt{h \cdot \ell}\right) + -1}\\
\mathbf{elif}\;d \leq 6.6 \cdot 10^{-238}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.95 \cdot 10^{-150}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{elif}\;d \leq 5.5 \cdot 10^{-60}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 2.8 \cdot 10^{+126}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -2.2e104Initial program 71.3%
Simplified69.0%
Taylor expanded in M around 0 49.6%
if -2.2e104 < d < -2.10000000000000017e-140 or 5.4999999999999997e-60 < d < 2.80000000000000009e126Initial program 76.0%
Simplified76.0%
Applied egg-rr21.7%
expm1-def32.6%
expm1-log1p61.7%
associate-*l/64.0%
*-commutative64.0%
Simplified64.0%
Taylor expanded in h around 0 55.0%
associate-*r/55.0%
*-commutative55.0%
times-frac58.7%
associate-*r*58.8%
associate-/l*58.8%
unpow258.8%
associate-*l*61.3%
unpow261.3%
unpow261.3%
associate-*r/61.3%
Simplified61.3%
if -2.10000000000000017e-140 < d < -1.999999999999994e-310Initial program 41.1%
Simplified38.0%
Taylor expanded in d around inf 29.1%
pow129.1%
sqrt-div26.1%
metadata-eval26.1%
Applied egg-rr26.1%
unpow126.1%
associate-*r/26.1%
*-rgt-identity26.1%
Simplified26.1%
expm1-log1p-u26.1%
Applied egg-rr26.1%
expm1-udef47.6%
log1p-udef47.6%
add-exp-log47.6%
Applied egg-rr47.6%
if -1.999999999999994e-310 < d < 6.59999999999999939e-238 or 1.9500000000000001e-150 < d < 5.4999999999999997e-60Initial program 58.8%
Simplified56.1%
pow1/256.1%
metadata-eval56.1%
add-cbrt-cube34.5%
pow1/334.0%
metadata-eval34.0%
metadata-eval34.0%
pow-prod-up34.0%
metadata-eval34.0%
metadata-eval34.0%
pow-prod-up34.0%
metadata-eval34.0%
Applied egg-rr34.0%
unpow1/334.5%
Simplified34.5%
Taylor expanded in d around 0 59.8%
*-commutative59.8%
unpow259.8%
associate-*l*62.5%
associate-*r/65.3%
associate-*l/60.0%
*-commutative60.0%
unpow260.0%
associate-*l*65.4%
Simplified65.4%
if 6.59999999999999939e-238 < d < 1.9500000000000001e-150Initial program 61.3%
Simplified59.5%
Taylor expanded in d around inf 41.4%
pow141.4%
sqrt-div41.4%
metadata-eval41.4%
Applied egg-rr41.4%
unpow141.4%
associate-*r/41.3%
*-rgt-identity41.3%
Simplified41.3%
sqrt-prod49.1%
Applied egg-rr49.1%
if 2.80000000000000009e126 < d Initial program 55.9%
Simplified55.7%
Taylor expanded in d around inf 75.1%
pow1/275.1%
Applied egg-rr75.1%
unpow1/275.1%
unpow-175.1%
sqr-pow75.1%
rem-sqrt-square75.1%
metadata-eval75.1%
sqr-pow74.7%
fabs-sqr74.7%
sqr-pow75.1%
Simplified75.1%
unpow-prod-down81.0%
Applied egg-rr81.0%
Final simplification59.4%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(sqrt (/ (* d (/ d l)) h))
(+
1.0
(* -0.5 (* (/ 0.25 l) (/ (* D (* D (* M M))) (* d (/ d h))))))))
(t_1 (sqrt (/ h (pow l 3.0)))))
(if (<= d -2.4e+103)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d -2.95e-142)
t_0
(if (<= d -2e-310)
(/ d (+ (+ 1.0 (sqrt (* h l))) -1.0))
(if (<= d 1.7e-238)
(* -0.125 (* t_1 (* D (* M (* (/ D d) M)))))
(if (<= d 2.3e-150)
(/ d (* (sqrt h) (sqrt l)))
(if (<= d 5.4e-60)
(* -0.125 (* (/ (* D M) (/ d D)) (* M t_1)))
(if (<= d 3.4e+126)
t_0
(* d (* (pow h -0.5) (pow l -0.5))))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double t_1 = sqrt((h / pow(l, 3.0)));
double tmp;
if (d <= -2.4e+103) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= -2.95e-142) {
tmp = t_0;
} else if (d <= -2e-310) {
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
} else if (d <= 1.7e-238) {
tmp = -0.125 * (t_1 * (D * (M * ((D / d) * M))));
} else if (d <= 2.3e-150) {
tmp = d / (sqrt(h) * sqrt(l));
} else if (d <= 5.4e-60) {
tmp = -0.125 * (((D * M) / (d / D)) * (M * t_1));
} else if (d <= 3.4e+126) {
tmp = t_0;
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt(((d * (d / l)) / h)) * (1.0d0 + ((-0.5d0) * ((0.25d0 / l) * ((d_1 * (d_1 * (m * m))) / (d * (d / h))))))
t_1 = sqrt((h / (l ** 3.0d0)))
if (d <= (-2.4d+103)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (d <= (-2.95d-142)) then
tmp = t_0
else if (d <= (-2d-310)) then
tmp = d / ((1.0d0 + sqrt((h * l))) + (-1.0d0))
else if (d <= 1.7d-238) then
tmp = (-0.125d0) * (t_1 * (d_1 * (m * ((d_1 / d) * m))))
else if (d <= 2.3d-150) then
tmp = d / (sqrt(h) * sqrt(l))
else if (d <= 5.4d-60) then
tmp = (-0.125d0) * (((d_1 * m) / (d / d_1)) * (m * t_1))
else if (d <= 3.4d+126) then
tmp = t_0
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double t_1 = Math.sqrt((h / Math.pow(l, 3.0)));
double tmp;
if (d <= -2.4e+103) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (d <= -2.95e-142) {
tmp = t_0;
} else if (d <= -2e-310) {
tmp = d / ((1.0 + Math.sqrt((h * l))) + -1.0);
} else if (d <= 1.7e-238) {
tmp = -0.125 * (t_1 * (D * (M * ((D / d) * M))));
} else if (d <= 2.3e-150) {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
} else if (d <= 5.4e-60) {
tmp = -0.125 * (((D * M) / (d / D)) * (M * t_1));
} else if (d <= 3.4e+126) {
tmp = t_0;
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h)))))) t_1 = math.sqrt((h / math.pow(l, 3.0))) tmp = 0 if d <= -2.4e+103: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif d <= -2.95e-142: tmp = t_0 elif d <= -2e-310: tmp = d / ((1.0 + math.sqrt((h * l))) + -1.0) elif d <= 1.7e-238: tmp = -0.125 * (t_1 * (D * (M * ((D / d) * M)))) elif d <= 2.3e-150: tmp = d / (math.sqrt(h) * math.sqrt(l)) elif d <= 5.4e-60: tmp = -0.125 * (((D * M) / (d / D)) * (M * t_1)) elif d <= 3.4e+126: tmp = t_0 else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d * Float64(d / l)) / h)) * Float64(1.0 + Float64(-0.5 * Float64(Float64(0.25 / l) * Float64(Float64(D * Float64(D * Float64(M * M))) / Float64(d * Float64(d / h))))))) t_1 = sqrt(Float64(h / (l ^ 3.0))) tmp = 0.0 if (d <= -2.4e+103) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= -2.95e-142) tmp = t_0; elseif (d <= -2e-310) tmp = Float64(d / Float64(Float64(1.0 + sqrt(Float64(h * l))) + -1.0)); elseif (d <= 1.7e-238) tmp = Float64(-0.125 * Float64(t_1 * Float64(D * Float64(M * Float64(Float64(D / d) * M))))); elseif (d <= 2.3e-150) tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); elseif (d <= 5.4e-60) tmp = Float64(-0.125 * Float64(Float64(Float64(D * M) / Float64(d / D)) * Float64(M * t_1))); elseif (d <= 3.4e+126) tmp = t_0; else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
t_1 = sqrt((h / (l ^ 3.0)));
tmp = 0.0;
if (d <= -2.4e+103)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (d <= -2.95e-142)
tmp = t_0;
elseif (d <= -2e-310)
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
elseif (d <= 1.7e-238)
tmp = -0.125 * (t_1 * (D * (M * ((D / d) * M))));
elseif (d <= 2.3e-150)
tmp = d / (sqrt(h) * sqrt(l));
elseif (d <= 5.4e-60)
tmp = -0.125 * (((D * M) / (d / D)) * (M * t_1));
elseif (d <= 3.4e+126)
tmp = t_0;
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d * N[(d / l), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(0.25 / l), $MachinePrecision] * N[(N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2.4e+103], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.95e-142], t$95$0, If[LessEqual[d, -2e-310], N[(d / N[(N[(1.0 + N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.7e-238], N[(-0.125 * N[(t$95$1 * N[(D * N[(M * N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.3e-150], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.4e-60], N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(M * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.4e+126], t$95$0, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d \cdot \frac{d}{\ell}}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{0.25}{\ell} \cdot \frac{D \cdot \left(D \cdot \left(M \cdot M\right)\right)}{d \cdot \frac{d}{h}}\right)\right)\\
t_1 := \sqrt{\frac{h}{{\ell}^{3}}}\\
\mathbf{if}\;d \leq -2.4 \cdot 10^{+103}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -2.95 \cdot 10^{-142}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\left(1 + \sqrt{h \cdot \ell}\right) + -1}\\
\mathbf{elif}\;d \leq 1.7 \cdot 10^{-238}:\\
\;\;\;\;-0.125 \cdot \left(t_1 \cdot \left(D \cdot \left(M \cdot \left(\frac{D}{d} \cdot M\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq 2.3 \cdot 10^{-150}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{elif}\;d \leq 5.4 \cdot 10^{-60}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot M}{\frac{d}{D}} \cdot \left(M \cdot t_1\right)\right)\\
\mathbf{elif}\;d \leq 3.4 \cdot 10^{+126}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -2.3999999999999998e103Initial program 71.3%
Simplified69.0%
Taylor expanded in M around 0 49.6%
if -2.3999999999999998e103 < d < -2.94999999999999983e-142 or 5.40000000000000001e-60 < d < 3.39999999999999989e126Initial program 76.0%
Simplified76.0%
Applied egg-rr21.7%
expm1-def32.6%
expm1-log1p61.7%
associate-*l/64.0%
*-commutative64.0%
Simplified64.0%
Taylor expanded in h around 0 55.0%
associate-*r/55.0%
*-commutative55.0%
times-frac58.7%
associate-*r*58.8%
associate-/l*58.8%
unpow258.8%
associate-*l*61.3%
unpow261.3%
unpow261.3%
associate-*r/61.3%
Simplified61.3%
if -2.94999999999999983e-142 < d < -1.999999999999994e-310Initial program 41.1%
Simplified38.0%
Taylor expanded in d around inf 29.1%
pow129.1%
sqrt-div26.1%
metadata-eval26.1%
Applied egg-rr26.1%
unpow126.1%
associate-*r/26.1%
*-rgt-identity26.1%
Simplified26.1%
expm1-log1p-u26.1%
Applied egg-rr26.1%
expm1-udef47.6%
log1p-udef47.6%
add-exp-log47.6%
Applied egg-rr47.6%
if -1.999999999999994e-310 < d < 1.69999999999999992e-238Initial program 56.8%
Simplified52.3%
pow1/252.3%
metadata-eval52.3%
add-cbrt-cube38.6%
pow1/338.4%
metadata-eval38.4%
metadata-eval38.4%
pow-prod-up38.4%
metadata-eval38.4%
metadata-eval38.4%
pow-prod-up38.4%
metadata-eval38.4%
Applied egg-rr38.4%
unpow1/338.6%
Simplified38.6%
Taylor expanded in d around 0 73.1%
*-commutative73.1%
unpow273.1%
associate-*l*73.0%
associate-*r/77.8%
associate-*l/68.9%
*-commutative68.9%
unpow268.9%
associate-*l*68.8%
Simplified68.8%
if 1.69999999999999992e-238 < d < 2.30000000000000003e-150Initial program 61.3%
Simplified59.5%
Taylor expanded in d around inf 41.4%
pow141.4%
sqrt-div41.4%
metadata-eval41.4%
Applied egg-rr41.4%
unpow141.4%
associate-*r/41.3%
*-rgt-identity41.3%
Simplified41.3%
sqrt-prod49.1%
Applied egg-rr49.1%
if 2.30000000000000003e-150 < d < 5.40000000000000001e-60Initial program 61.6%
Simplified61.7%
add-cube-cbrt61.7%
pow361.7%
Applied egg-rr61.7%
Taylor expanded in d around 0 40.4%
unpow240.4%
associate-*l/40.4%
unpow240.4%
associate-*r*53.8%
associate-*l*53.9%
associate-/l*53.9%
associate-*l/60.6%
Simplified60.6%
if 3.39999999999999989e126 < d Initial program 55.9%
Simplified55.7%
Taylor expanded in d around inf 75.1%
pow1/275.1%
Applied egg-rr75.1%
unpow1/275.1%
unpow-175.1%
sqr-pow75.1%
rem-sqrt-square75.1%
metadata-eval75.1%
sqr-pow74.7%
fabs-sqr74.7%
sqr-pow75.1%
Simplified75.1%
unpow-prod-down81.0%
Applied egg-rr81.0%
Final simplification59.4%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(sqrt (/ (* d (/ d l)) h))
(+
1.0
(* -0.5 (* (/ 0.25 l) (/ (* D (* D (* M M))) (* d (/ d h))))))))
(t_1 (sqrt (/ h (pow l 3.0)))))
(if (<= d -2.5e+104)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d -3.4e-136)
t_0
(if (<= d -7.5e-306)
(/ d (+ (+ 1.0 (sqrt (* h l))) -1.0))
(if (<= d 6.6e-238)
(* -0.125 (/ (* t_1 (* M (* M (* D D)))) d))
(if (<= d 2e-150)
(/ d (* (sqrt h) (sqrt l)))
(if (<= d 5.4e-60)
(* -0.125 (* (/ (* D M) (/ d D)) (* M t_1)))
(if (<= d 2.55e+126)
t_0
(* d (* (pow h -0.5) (pow l -0.5))))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double t_1 = sqrt((h / pow(l, 3.0)));
double tmp;
if (d <= -2.5e+104) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= -3.4e-136) {
tmp = t_0;
} else if (d <= -7.5e-306) {
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
} else if (d <= 6.6e-238) {
tmp = -0.125 * ((t_1 * (M * (M * (D * D)))) / d);
} else if (d <= 2e-150) {
tmp = d / (sqrt(h) * sqrt(l));
} else if (d <= 5.4e-60) {
tmp = -0.125 * (((D * M) / (d / D)) * (M * t_1));
} else if (d <= 2.55e+126) {
tmp = t_0;
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt(((d * (d / l)) / h)) * (1.0d0 + ((-0.5d0) * ((0.25d0 / l) * ((d_1 * (d_1 * (m * m))) / (d * (d / h))))))
t_1 = sqrt((h / (l ** 3.0d0)))
if (d <= (-2.5d+104)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (d <= (-3.4d-136)) then
tmp = t_0
else if (d <= (-7.5d-306)) then
tmp = d / ((1.0d0 + sqrt((h * l))) + (-1.0d0))
else if (d <= 6.6d-238) then
tmp = (-0.125d0) * ((t_1 * (m * (m * (d_1 * d_1)))) / d)
else if (d <= 2d-150) then
tmp = d / (sqrt(h) * sqrt(l))
else if (d <= 5.4d-60) then
tmp = (-0.125d0) * (((d_1 * m) / (d / d_1)) * (m * t_1))
else if (d <= 2.55d+126) then
tmp = t_0
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double t_1 = Math.sqrt((h / Math.pow(l, 3.0)));
double tmp;
if (d <= -2.5e+104) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (d <= -3.4e-136) {
tmp = t_0;
} else if (d <= -7.5e-306) {
tmp = d / ((1.0 + Math.sqrt((h * l))) + -1.0);
} else if (d <= 6.6e-238) {
tmp = -0.125 * ((t_1 * (M * (M * (D * D)))) / d);
} else if (d <= 2e-150) {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
} else if (d <= 5.4e-60) {
tmp = -0.125 * (((D * M) / (d / D)) * (M * t_1));
} else if (d <= 2.55e+126) {
tmp = t_0;
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h)))))) t_1 = math.sqrt((h / math.pow(l, 3.0))) tmp = 0 if d <= -2.5e+104: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif d <= -3.4e-136: tmp = t_0 elif d <= -7.5e-306: tmp = d / ((1.0 + math.sqrt((h * l))) + -1.0) elif d <= 6.6e-238: tmp = -0.125 * ((t_1 * (M * (M * (D * D)))) / d) elif d <= 2e-150: tmp = d / (math.sqrt(h) * math.sqrt(l)) elif d <= 5.4e-60: tmp = -0.125 * (((D * M) / (d / D)) * (M * t_1)) elif d <= 2.55e+126: tmp = t_0 else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d * Float64(d / l)) / h)) * Float64(1.0 + Float64(-0.5 * Float64(Float64(0.25 / l) * Float64(Float64(D * Float64(D * Float64(M * M))) / Float64(d * Float64(d / h))))))) t_1 = sqrt(Float64(h / (l ^ 3.0))) tmp = 0.0 if (d <= -2.5e+104) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= -3.4e-136) tmp = t_0; elseif (d <= -7.5e-306) tmp = Float64(d / Float64(Float64(1.0 + sqrt(Float64(h * l))) + -1.0)); elseif (d <= 6.6e-238) tmp = Float64(-0.125 * Float64(Float64(t_1 * Float64(M * Float64(M * Float64(D * D)))) / d)); elseif (d <= 2e-150) tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); elseif (d <= 5.4e-60) tmp = Float64(-0.125 * Float64(Float64(Float64(D * M) / Float64(d / D)) * Float64(M * t_1))); elseif (d <= 2.55e+126) tmp = t_0; else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
t_1 = sqrt((h / (l ^ 3.0)));
tmp = 0.0;
if (d <= -2.5e+104)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (d <= -3.4e-136)
tmp = t_0;
elseif (d <= -7.5e-306)
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
elseif (d <= 6.6e-238)
tmp = -0.125 * ((t_1 * (M * (M * (D * D)))) / d);
elseif (d <= 2e-150)
tmp = d / (sqrt(h) * sqrt(l));
elseif (d <= 5.4e-60)
tmp = -0.125 * (((D * M) / (d / D)) * (M * t_1));
elseif (d <= 2.55e+126)
tmp = t_0;
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d * N[(d / l), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(0.25 / l), $MachinePrecision] * N[(N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2.5e+104], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3.4e-136], t$95$0, If[LessEqual[d, -7.5e-306], N[(d / N[(N[(1.0 + N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.6e-238], N[(-0.125 * N[(N[(t$95$1 * N[(M * N[(M * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2e-150], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.4e-60], N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(M * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.55e+126], t$95$0, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d \cdot \frac{d}{\ell}}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{0.25}{\ell} \cdot \frac{D \cdot \left(D \cdot \left(M \cdot M\right)\right)}{d \cdot \frac{d}{h}}\right)\right)\\
t_1 := \sqrt{\frac{h}{{\ell}^{3}}}\\
\mathbf{if}\;d \leq -2.5 \cdot 10^{+104}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -3.4 \cdot 10^{-136}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -7.5 \cdot 10^{-306}:\\
\;\;\;\;\frac{d}{\left(1 + \sqrt{h \cdot \ell}\right) + -1}\\
\mathbf{elif}\;d \leq 6.6 \cdot 10^{-238}:\\
\;\;\;\;-0.125 \cdot \frac{t_1 \cdot \left(M \cdot \left(M \cdot \left(D \cdot D\right)\right)\right)}{d}\\
\mathbf{elif}\;d \leq 2 \cdot 10^{-150}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{elif}\;d \leq 5.4 \cdot 10^{-60}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot M}{\frac{d}{D}} \cdot \left(M \cdot t_1\right)\right)\\
\mathbf{elif}\;d \leq 2.55 \cdot 10^{+126}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -2.4999999999999998e104Initial program 71.3%
Simplified69.0%
Taylor expanded in M around 0 49.6%
if -2.4999999999999998e104 < d < -3.4e-136 or 5.40000000000000001e-60 < d < 2.5500000000000001e126Initial program 76.0%
Simplified76.0%
Applied egg-rr21.7%
expm1-def32.6%
expm1-log1p61.7%
associate-*l/64.0%
*-commutative64.0%
Simplified64.0%
Taylor expanded in h around 0 55.0%
associate-*r/55.0%
*-commutative55.0%
times-frac58.7%
associate-*r*58.8%
associate-/l*58.8%
unpow258.8%
associate-*l*61.3%
unpow261.3%
unpow261.3%
associate-*r/61.3%
Simplified61.3%
if -3.4e-136 < d < -7.5000000000000003e-306Initial program 42.4%
Simplified39.2%
Taylor expanded in d around inf 30.0%
pow130.0%
sqrt-div26.8%
metadata-eval26.8%
Applied egg-rr26.8%
unpow126.8%
associate-*r/26.8%
*-rgt-identity26.8%
Simplified26.8%
expm1-log1p-u26.8%
Applied egg-rr26.8%
expm1-udef49.1%
log1p-udef49.1%
add-exp-log49.1%
Applied egg-rr49.1%
if -7.5000000000000003e-306 < d < 6.59999999999999939e-238Initial program 54.3%
Simplified50.1%
Taylor expanded in d around 0 69.9%
associate-*l/70.0%
*-commutative70.0%
unpow270.0%
associate-*l*69.9%
unpow269.9%
Simplified69.9%
if 6.59999999999999939e-238 < d < 2.00000000000000001e-150Initial program 61.3%
Simplified59.5%
Taylor expanded in d around inf 41.4%
pow141.4%
sqrt-div41.4%
metadata-eval41.4%
Applied egg-rr41.4%
unpow141.4%
associate-*r/41.3%
*-rgt-identity41.3%
Simplified41.3%
sqrt-prod49.1%
Applied egg-rr49.1%
if 2.00000000000000001e-150 < d < 5.40000000000000001e-60Initial program 61.6%
Simplified61.7%
add-cube-cbrt61.7%
pow361.7%
Applied egg-rr61.7%
Taylor expanded in d around 0 40.4%
unpow240.4%
associate-*l/40.4%
unpow240.4%
associate-*r*53.8%
associate-*l*53.9%
associate-/l*53.9%
associate-*l/60.6%
Simplified60.6%
if 2.5500000000000001e126 < d Initial program 55.9%
Simplified55.7%
Taylor expanded in d around inf 75.1%
pow1/275.1%
Applied egg-rr75.1%
unpow1/275.1%
unpow-175.1%
sqr-pow75.1%
rem-sqrt-square75.1%
metadata-eval75.1%
sqr-pow74.7%
fabs-sqr74.7%
sqr-pow75.1%
Simplified75.1%
unpow-prod-down81.0%
Applied egg-rr81.0%
Final simplification59.7%
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 (/ d l)) h))
(+
1.0
(* -0.5 (* (/ 0.25 l) (/ (* D (* D (* M M))) (* d (/ d h))))))))
(t_1 (sqrt (/ h (pow l 3.0)))))
(if (<= d -2.8e+105)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d -2.1e-138)
t_0
(if (<= d -7.5e-306)
(/ d (+ (+ 1.0 (sqrt (* h l))) -1.0))
(if (<= d 6.5e-238)
(* -0.125 (/ (* t_1 (* (* M M) (* D D))) d))
(if (<= d 4e-151)
(/ d (* (sqrt h) (sqrt l)))
(if (<= d 5.4e-60)
(* -0.125 (* (/ (* D M) (/ d D)) (* M t_1)))
(if (<= d 2.7e+126)
t_0
(* d (* (pow h -0.5) (pow l -0.5))))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double t_1 = sqrt((h / pow(l, 3.0)));
double tmp;
if (d <= -2.8e+105) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= -2.1e-138) {
tmp = t_0;
} else if (d <= -7.5e-306) {
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
} else if (d <= 6.5e-238) {
tmp = -0.125 * ((t_1 * ((M * M) * (D * D))) / d);
} else if (d <= 4e-151) {
tmp = d / (sqrt(h) * sqrt(l));
} else if (d <= 5.4e-60) {
tmp = -0.125 * (((D * M) / (d / D)) * (M * t_1));
} else if (d <= 2.7e+126) {
tmp = t_0;
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt(((d * (d / l)) / h)) * (1.0d0 + ((-0.5d0) * ((0.25d0 / l) * ((d_1 * (d_1 * (m * m))) / (d * (d / h))))))
t_1 = sqrt((h / (l ** 3.0d0)))
if (d <= (-2.8d+105)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (d <= (-2.1d-138)) then
tmp = t_0
else if (d <= (-7.5d-306)) then
tmp = d / ((1.0d0 + sqrt((h * l))) + (-1.0d0))
else if (d <= 6.5d-238) then
tmp = (-0.125d0) * ((t_1 * ((m * m) * (d_1 * d_1))) / d)
else if (d <= 4d-151) then
tmp = d / (sqrt(h) * sqrt(l))
else if (d <= 5.4d-60) then
tmp = (-0.125d0) * (((d_1 * m) / (d / d_1)) * (m * t_1))
else if (d <= 2.7d+126) then
tmp = t_0
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double t_1 = Math.sqrt((h / Math.pow(l, 3.0)));
double tmp;
if (d <= -2.8e+105) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (d <= -2.1e-138) {
tmp = t_0;
} else if (d <= -7.5e-306) {
tmp = d / ((1.0 + Math.sqrt((h * l))) + -1.0);
} else if (d <= 6.5e-238) {
tmp = -0.125 * ((t_1 * ((M * M) * (D * D))) / d);
} else if (d <= 4e-151) {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
} else if (d <= 5.4e-60) {
tmp = -0.125 * (((D * M) / (d / D)) * (M * t_1));
} else if (d <= 2.7e+126) {
tmp = t_0;
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h)))))) t_1 = math.sqrt((h / math.pow(l, 3.0))) tmp = 0 if d <= -2.8e+105: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif d <= -2.1e-138: tmp = t_0 elif d <= -7.5e-306: tmp = d / ((1.0 + math.sqrt((h * l))) + -1.0) elif d <= 6.5e-238: tmp = -0.125 * ((t_1 * ((M * M) * (D * D))) / d) elif d <= 4e-151: tmp = d / (math.sqrt(h) * math.sqrt(l)) elif d <= 5.4e-60: tmp = -0.125 * (((D * M) / (d / D)) * (M * t_1)) elif d <= 2.7e+126: tmp = t_0 else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d * Float64(d / l)) / h)) * Float64(1.0 + Float64(-0.5 * Float64(Float64(0.25 / l) * Float64(Float64(D * Float64(D * Float64(M * M))) / Float64(d * Float64(d / h))))))) t_1 = sqrt(Float64(h / (l ^ 3.0))) tmp = 0.0 if (d <= -2.8e+105) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= -2.1e-138) tmp = t_0; elseif (d <= -7.5e-306) tmp = Float64(d / Float64(Float64(1.0 + sqrt(Float64(h * l))) + -1.0)); elseif (d <= 6.5e-238) tmp = Float64(-0.125 * Float64(Float64(t_1 * Float64(Float64(M * M) * Float64(D * D))) / d)); elseif (d <= 4e-151) tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); elseif (d <= 5.4e-60) tmp = Float64(-0.125 * Float64(Float64(Float64(D * M) / Float64(d / D)) * Float64(M * t_1))); elseif (d <= 2.7e+126) tmp = t_0; else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
t_1 = sqrt((h / (l ^ 3.0)));
tmp = 0.0;
if (d <= -2.8e+105)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (d <= -2.1e-138)
tmp = t_0;
elseif (d <= -7.5e-306)
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
elseif (d <= 6.5e-238)
tmp = -0.125 * ((t_1 * ((M * M) * (D * D))) / d);
elseif (d <= 4e-151)
tmp = d / (sqrt(h) * sqrt(l));
elseif (d <= 5.4e-60)
tmp = -0.125 * (((D * M) / (d / D)) * (M * t_1));
elseif (d <= 2.7e+126)
tmp = t_0;
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d * N[(d / l), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(0.25 / l), $MachinePrecision] * N[(N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2.8e+105], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.1e-138], t$95$0, If[LessEqual[d, -7.5e-306], N[(d / N[(N[(1.0 + N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.5e-238], N[(-0.125 * N[(N[(t$95$1 * N[(N[(M * M), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4e-151], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.4e-60], N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(M * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.7e+126], t$95$0, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d \cdot \frac{d}{\ell}}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{0.25}{\ell} \cdot \frac{D \cdot \left(D \cdot \left(M \cdot M\right)\right)}{d \cdot \frac{d}{h}}\right)\right)\\
t_1 := \sqrt{\frac{h}{{\ell}^{3}}}\\
\mathbf{if}\;d \leq -2.8 \cdot 10^{+105}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -2.1 \cdot 10^{-138}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -7.5 \cdot 10^{-306}:\\
\;\;\;\;\frac{d}{\left(1 + \sqrt{h \cdot \ell}\right) + -1}\\
\mathbf{elif}\;d \leq 6.5 \cdot 10^{-238}:\\
\;\;\;\;-0.125 \cdot \frac{t_1 \cdot \left(\left(M \cdot M\right) \cdot \left(D \cdot D\right)\right)}{d}\\
\mathbf{elif}\;d \leq 4 \cdot 10^{-151}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{elif}\;d \leq 5.4 \cdot 10^{-60}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot M}{\frac{d}{D}} \cdot \left(M \cdot t_1\right)\right)\\
\mathbf{elif}\;d \leq 2.7 \cdot 10^{+126}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -2.8000000000000001e105Initial program 71.3%
Simplified69.0%
Taylor expanded in M around 0 49.6%
if -2.8000000000000001e105 < d < -2.09999999999999986e-138 or 5.40000000000000001e-60 < d < 2.70000000000000002e126Initial program 76.0%
Simplified76.0%
Applied egg-rr21.7%
expm1-def32.6%
expm1-log1p61.7%
associate-*l/64.0%
*-commutative64.0%
Simplified64.0%
Taylor expanded in h around 0 55.0%
associate-*r/55.0%
*-commutative55.0%
times-frac58.7%
associate-*r*58.8%
associate-/l*58.8%
unpow258.8%
associate-*l*61.3%
unpow261.3%
unpow261.3%
associate-*r/61.3%
Simplified61.3%
if -2.09999999999999986e-138 < d < -7.5000000000000003e-306Initial program 42.4%
Simplified39.2%
Taylor expanded in d around inf 30.0%
pow130.0%
sqrt-div26.8%
metadata-eval26.8%
Applied egg-rr26.8%
unpow126.8%
associate-*r/26.8%
*-rgt-identity26.8%
Simplified26.8%
expm1-log1p-u26.8%
Applied egg-rr26.8%
expm1-udef49.1%
log1p-udef49.1%
add-exp-log49.1%
Applied egg-rr49.1%
if -7.5000000000000003e-306 < d < 6.5000000000000006e-238Initial program 54.3%
Simplified50.1%
Taylor expanded in d around 0 69.9%
associate-*l/70.0%
unpow270.0%
unpow270.0%
Simplified70.0%
if 6.5000000000000006e-238 < d < 3.9999999999999998e-151Initial program 61.3%
Simplified59.5%
Taylor expanded in d around inf 41.4%
pow141.4%
sqrt-div41.4%
metadata-eval41.4%
Applied egg-rr41.4%
unpow141.4%
associate-*r/41.3%
*-rgt-identity41.3%
Simplified41.3%
sqrt-prod49.1%
Applied egg-rr49.1%
if 3.9999999999999998e-151 < d < 5.40000000000000001e-60Initial program 61.6%
Simplified61.7%
add-cube-cbrt61.7%
pow361.7%
Applied egg-rr61.7%
Taylor expanded in d around 0 40.4%
unpow240.4%
associate-*l/40.4%
unpow240.4%
associate-*r*53.8%
associate-*l*53.9%
associate-/l*53.9%
associate-*l/60.6%
Simplified60.6%
if 2.70000000000000002e126 < d Initial program 55.9%
Simplified55.7%
Taylor expanded in d around inf 75.1%
pow1/275.1%
Applied egg-rr75.1%
unpow1/275.1%
unpow-175.1%
sqr-pow75.1%
rem-sqrt-square75.1%
metadata-eval75.1%
sqr-pow74.7%
fabs-sqr74.7%
sqr-pow75.1%
Simplified75.1%
unpow-prod-down81.0%
Applied egg-rr81.0%
Final simplification59.7%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* -0.5 (* (/ h l) (pow (* (/ D d) (* M 0.5)) 2.0))))
(t_1 (* d (pow (* h l) -0.5))))
(if (<= h -4.8e-235)
(* t_1 (- -1.0 t_0))
(if (<= h 4.8e-211)
(*
(+ 1.0 (* (/ h l) (* -0.125 (pow (* D (/ M d)) 2.0))))
(sqrt (* (/ d l) (/ d h))))
(* (+ 1.0 t_0) t_1)))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = -0.5 * ((h / l) * pow(((D / d) * (M * 0.5)), 2.0));
double t_1 = d * pow((h * l), -0.5);
double tmp;
if (h <= -4.8e-235) {
tmp = t_1 * (-1.0 - t_0);
} else if (h <= 4.8e-211) {
tmp = (1.0 + ((h / l) * (-0.125 * pow((D * (M / d)), 2.0)))) * sqrt(((d / l) * (d / h)));
} else {
tmp = (1.0 + t_0) * t_1;
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-0.5d0) * ((h / l) * (((d_1 / d) * (m * 0.5d0)) ** 2.0d0))
t_1 = d * ((h * l) ** (-0.5d0))
if (h <= (-4.8d-235)) then
tmp = t_1 * ((-1.0d0) - t_0)
else if (h <= 4.8d-211) then
tmp = (1.0d0 + ((h / l) * ((-0.125d0) * ((d_1 * (m / d)) ** 2.0d0)))) * sqrt(((d / l) * (d / h)))
else
tmp = (1.0d0 + t_0) * t_1
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = -0.5 * ((h / l) * Math.pow(((D / d) * (M * 0.5)), 2.0));
double t_1 = d * Math.pow((h * l), -0.5);
double tmp;
if (h <= -4.8e-235) {
tmp = t_1 * (-1.0 - t_0);
} else if (h <= 4.8e-211) {
tmp = (1.0 + ((h / l) * (-0.125 * Math.pow((D * (M / d)), 2.0)))) * Math.sqrt(((d / l) * (d / h)));
} else {
tmp = (1.0 + t_0) * t_1;
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = -0.5 * ((h / l) * math.pow(((D / d) * (M * 0.5)), 2.0)) t_1 = d * math.pow((h * l), -0.5) tmp = 0 if h <= -4.8e-235: tmp = t_1 * (-1.0 - t_0) elif h <= 4.8e-211: tmp = (1.0 + ((h / l) * (-0.125 * math.pow((D * (M / d)), 2.0)))) * math.sqrt(((d / l) * (d / h))) else: tmp = (1.0 + t_0) * t_1 return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0))) t_1 = Float64(d * (Float64(h * l) ^ -0.5)) tmp = 0.0 if (h <= -4.8e-235) tmp = Float64(t_1 * Float64(-1.0 - t_0)); elseif (h <= 4.8e-211) tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.125 * (Float64(D * Float64(M / d)) ^ 2.0)))) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); else tmp = Float64(Float64(1.0 + t_0) * t_1); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = -0.5 * ((h / l) * (((D / d) * (M * 0.5)) ^ 2.0));
t_1 = d * ((h * l) ^ -0.5);
tmp = 0.0;
if (h <= -4.8e-235)
tmp = t_1 * (-1.0 - t_0);
elseif (h <= 4.8e-211)
tmp = (1.0 + ((h / l) * (-0.125 * ((D * (M / d)) ^ 2.0)))) * sqrt(((d / l) * (d / h)));
else
tmp = (1.0 + t_0) * t_1;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -4.8e-235], N[(t$95$1 * N[(-1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 4.8e-211], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.125 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right)\\
t_1 := d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;h \leq -4.8 \cdot 10^{-235}:\\
\;\;\;\;t_1 \cdot \left(-1 - t_0\right)\\
\mathbf{elif}\;h \leq 4.8 \cdot 10^{-211}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t_0\right) \cdot t_1\\
\end{array}
\end{array}
if h < -4.80000000000000022e-235Initial program 63.8%
Simplified62.9%
Applied egg-rr25.1%
expm1-def30.8%
expm1-log1p52.4%
associate-*l/47.6%
*-commutative47.6%
Simplified47.6%
Taylor expanded in d around -inf 68.6%
mul-1-neg68.6%
distribute-rgt-neg-in68.6%
unpow-168.6%
sqr-pow68.6%
rem-sqrt-square68.6%
metadata-eval68.6%
sqr-pow68.5%
fabs-sqr68.5%
sqr-pow68.6%
Simplified68.6%
if -4.80000000000000022e-235 < h < 4.8000000000000004e-211Initial program 70.0%
Simplified67.3%
Applied egg-rr32.1%
expm1-def41.8%
expm1-log1p59.7%
*-commutative59.7%
Simplified61.3%
fma-udef61.3%
Applied egg-rr61.3%
if 4.8000000000000004e-211 < h Initial program 63.0%
Simplified61.5%
Applied egg-rr16.2%
expm1-def22.9%
expm1-log1p44.3%
associate-*l/39.1%
*-commutative39.1%
Simplified39.1%
Taylor expanded in d around 0 72.3%
unpow-172.3%
sqr-pow72.3%
rem-sqrt-square72.3%
metadata-eval72.3%
sqr-pow72.2%
fabs-sqr72.2%
sqr-pow72.3%
Simplified72.3%
Final simplification69.1%
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.45e-213)
(*
(+ 1.0 (* (/ h l) (* -0.125 (pow (* D (/ M d)) 2.0))))
(sqrt (* (/ d l) (/ d h))))
(*
(+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ D d) (* M 0.5)) 2.0))))
(* d (pow (* h l) -0.5)))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 1.45e-213) {
tmp = (1.0 + ((h / l) * (-0.125 * pow((D * (M / d)), 2.0)))) * sqrt(((d / l) * (d / h)));
} else {
tmp = (1.0 + (-0.5 * ((h / l) * pow(((D / d) * (M * 0.5)), 2.0)))) * (d * pow((h * l), -0.5));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= 1.45d-213) then
tmp = (1.0d0 + ((h / l) * ((-0.125d0) * ((d_1 * (m / d)) ** 2.0d0)))) * sqrt(((d / l) * (d / h)))
else
tmp = (1.0d0 + ((-0.5d0) * ((h / l) * (((d_1 / d) * (m * 0.5d0)) ** 2.0d0)))) * (d * ((h * l) ** (-0.5d0)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 1.45e-213) {
tmp = (1.0 + ((h / l) * (-0.125 * Math.pow((D * (M / d)), 2.0)))) * Math.sqrt(((d / l) * (d / h)));
} else {
tmp = (1.0 + (-0.5 * ((h / l) * Math.pow(((D / d) * (M * 0.5)), 2.0)))) * (d * Math.pow((h * l), -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= 1.45e-213: tmp = (1.0 + ((h / l) * (-0.125 * math.pow((D * (M / d)), 2.0)))) * math.sqrt(((d / l) * (d / h))) else: tmp = (1.0 + (-0.5 * ((h / l) * math.pow(((D / d) * (M * 0.5)), 2.0)))) * (d * math.pow((h * l), -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= 1.45e-213) tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.125 * (Float64(D * Float64(M / d)) ^ 2.0)))) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); else tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0)))) * Float64(d * (Float64(h * l) ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= 1.45e-213)
tmp = (1.0 + ((h / l) * (-0.125 * ((D * (M / d)) ^ 2.0)))) * sqrt(((d / l) * (d / h)));
else
tmp = (1.0 + (-0.5 * ((h / l) * (((D / d) * (M * 0.5)) ^ 2.0)))) * (d * ((h * l) ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, 1.45e-213], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.125 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 1.45 \cdot 10^{-213}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right)\right) \cdot \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)\\
\end{array}
\end{array}
if h < 1.45e-213Initial program 65.3%
Simplified64.0%
Applied egg-rr26.8%
expm1-def33.4%
expm1-log1p54.2%
*-commutative54.2%
Simplified54.6%
fma-udef54.6%
Applied egg-rr54.6%
if 1.45e-213 < h Initial program 63.0%
Simplified61.5%
Applied egg-rr16.2%
expm1-def22.9%
expm1-log1p44.3%
associate-*l/39.1%
*-commutative39.1%
Simplified39.1%
Taylor expanded in d around 0 72.3%
unpow-172.3%
sqr-pow72.3%
rem-sqrt-square72.3%
metadata-eval72.3%
sqr-pow72.2%
fabs-sqr72.2%
sqr-pow72.3%
Simplified72.3%
Final simplification62.0%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h 1.08e-247)
(*
(+ 1.0 (* (/ h l) (* -0.125 (pow (* D (/ M d)) 2.0))))
(sqrt (* (/ d l) (/ d h))))
(if (<= h 2.2e-47)
(/ d (* (sqrt h) (sqrt l)))
(* -0.125 (* (/ (* D M) (/ d D)) (* M (sqrt (/ h (pow l 3.0)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 1.08e-247) {
tmp = (1.0 + ((h / l) * (-0.125 * pow((D * (M / d)), 2.0)))) * sqrt(((d / l) * (d / h)));
} else if (h <= 2.2e-47) {
tmp = d / (sqrt(h) * sqrt(l));
} else {
tmp = -0.125 * (((D * M) / (d / D)) * (M * sqrt((h / pow(l, 3.0)))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= 1.08d-247) then
tmp = (1.0d0 + ((h / l) * ((-0.125d0) * ((d_1 * (m / d)) ** 2.0d0)))) * sqrt(((d / l) * (d / h)))
else if (h <= 2.2d-47) then
tmp = d / (sqrt(h) * sqrt(l))
else
tmp = (-0.125d0) * (((d_1 * m) / (d / d_1)) * (m * sqrt((h / (l ** 3.0d0)))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 1.08e-247) {
tmp = (1.0 + ((h / l) * (-0.125 * Math.pow((D * (M / d)), 2.0)))) * Math.sqrt(((d / l) * (d / h)));
} else if (h <= 2.2e-47) {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
} else {
tmp = -0.125 * (((D * M) / (d / D)) * (M * Math.sqrt((h / Math.pow(l, 3.0)))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= 1.08e-247: tmp = (1.0 + ((h / l) * (-0.125 * math.pow((D * (M / d)), 2.0)))) * math.sqrt(((d / l) * (d / h))) elif h <= 2.2e-47: tmp = d / (math.sqrt(h) * math.sqrt(l)) else: tmp = -0.125 * (((D * M) / (d / D)) * (M * math.sqrt((h / math.pow(l, 3.0))))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= 1.08e-247) tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.125 * (Float64(D * Float64(M / d)) ^ 2.0)))) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); elseif (h <= 2.2e-47) tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); else tmp = Float64(-0.125 * Float64(Float64(Float64(D * M) / Float64(d / D)) * Float64(M * sqrt(Float64(h / (l ^ 3.0)))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= 1.08e-247)
tmp = (1.0 + ((h / l) * (-0.125 * ((D * (M / d)) ^ 2.0)))) * sqrt(((d / l) * (d / h)));
elseif (h <= 2.2e-47)
tmp = d / (sqrt(h) * sqrt(l));
else
tmp = -0.125 * (((D * M) / (d / D)) * (M * sqrt((h / (l ^ 3.0)))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, 1.08e-247], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.125 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.2e-47], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(M * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 1.08 \cdot 10^{-247}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{elif}\;h \leq 2.2 \cdot 10^{-47}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot M}{\frac{d}{D}} \cdot \left(M \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\right)\\
\end{array}
\end{array}
if h < 1.08e-247Initial program 64.6%
Simplified63.2%
Applied egg-rr25.6%
expm1-def31.4%
expm1-log1p52.9%
*-commutative52.9%
Simplified53.4%
fma-udef53.4%
Applied egg-rr53.4%
if 1.08e-247 < h < 2.20000000000000019e-47Initial program 66.6%
Simplified66.6%
Taylor expanded in d around inf 70.1%
pow170.1%
sqrt-div70.1%
metadata-eval70.1%
Applied egg-rr70.1%
unpow170.1%
associate-*r/70.1%
*-rgt-identity70.1%
Simplified70.1%
sqrt-prod72.6%
Applied egg-rr72.6%
if 2.20000000000000019e-47 < h Initial program 62.7%
Simplified60.6%
add-cube-cbrt60.3%
pow360.4%
Applied egg-rr60.4%
Taylor expanded in d around 0 47.3%
unpow247.3%
associate-*l/44.5%
unpow244.5%
associate-*r*47.3%
associate-*l*47.4%
associate-/l*49.9%
associate-*l/54.0%
Simplified54.0%
Final simplification56.6%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(sqrt (/ (* d (/ d l)) h))
(+
1.0
(* -0.5 (* (/ 0.25 l) (/ (* D (* D (* M M))) (* d (/ d h)))))))))
(if (<= d -2.8e+105)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d -3.3e-137)
t_0
(if (<= d 2.8e-305)
(/ d (+ (+ 1.0 (sqrt (* h l))) -1.0))
(if (<= d 1e-151)
(/ d (* (sqrt h) (sqrt l)))
(if (<= d 3.4e+126) t_0 (* d (* (pow h -0.5) (pow l -0.5))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double tmp;
if (d <= -2.8e+105) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= -3.3e-137) {
tmp = t_0;
} else if (d <= 2.8e-305) {
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
} else if (d <= 1e-151) {
tmp = d / (sqrt(h) * sqrt(l));
} else if (d <= 3.4e+126) {
tmp = t_0;
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((d * (d / l)) / h)) * (1.0d0 + ((-0.5d0) * ((0.25d0 / l) * ((d_1 * (d_1 * (m * m))) / (d * (d / h))))))
if (d <= (-2.8d+105)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (d <= (-3.3d-137)) then
tmp = t_0
else if (d <= 2.8d-305) then
tmp = d / ((1.0d0 + sqrt((h * l))) + (-1.0d0))
else if (d <= 1d-151) then
tmp = d / (sqrt(h) * sqrt(l))
else if (d <= 3.4d+126) then
tmp = t_0
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double tmp;
if (d <= -2.8e+105) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (d <= -3.3e-137) {
tmp = t_0;
} else if (d <= 2.8e-305) {
tmp = d / ((1.0 + Math.sqrt((h * l))) + -1.0);
} else if (d <= 1e-151) {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
} else if (d <= 3.4e+126) {
tmp = t_0;
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h)))))) tmp = 0 if d <= -2.8e+105: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif d <= -3.3e-137: tmp = t_0 elif d <= 2.8e-305: tmp = d / ((1.0 + math.sqrt((h * l))) + -1.0) elif d <= 1e-151: tmp = d / (math.sqrt(h) * math.sqrt(l)) elif d <= 3.4e+126: tmp = t_0 else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d * Float64(d / l)) / h)) * Float64(1.0 + Float64(-0.5 * Float64(Float64(0.25 / l) * Float64(Float64(D * Float64(D * Float64(M * M))) / Float64(d * Float64(d / h))))))) tmp = 0.0 if (d <= -2.8e+105) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= -3.3e-137) tmp = t_0; elseif (d <= 2.8e-305) tmp = Float64(d / Float64(Float64(1.0 + sqrt(Float64(h * l))) + -1.0)); elseif (d <= 1e-151) tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); elseif (d <= 3.4e+126) tmp = t_0; else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
tmp = 0.0;
if (d <= -2.8e+105)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (d <= -3.3e-137)
tmp = t_0;
elseif (d <= 2.8e-305)
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
elseif (d <= 1e-151)
tmp = d / (sqrt(h) * sqrt(l));
elseif (d <= 3.4e+126)
tmp = t_0;
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d * N[(d / l), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(0.25 / l), $MachinePrecision] * N[(N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.8e+105], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3.3e-137], t$95$0, If[LessEqual[d, 2.8e-305], N[(d / N[(N[(1.0 + N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1e-151], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.4e+126], t$95$0, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d \cdot \frac{d}{\ell}}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{0.25}{\ell} \cdot \frac{D \cdot \left(D \cdot \left(M \cdot M\right)\right)}{d \cdot \frac{d}{h}}\right)\right)\\
\mathbf{if}\;d \leq -2.8 \cdot 10^{+105}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -3.3 \cdot 10^{-137}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 2.8 \cdot 10^{-305}:\\
\;\;\;\;\frac{d}{\left(1 + \sqrt{h \cdot \ell}\right) + -1}\\
\mathbf{elif}\;d \leq 10^{-151}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{elif}\;d \leq 3.4 \cdot 10^{+126}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -2.8000000000000001e105Initial program 71.3%
Simplified69.0%
Taylor expanded in M around 0 49.6%
if -2.8000000000000001e105 < d < -3.3000000000000002e-137 or 9.9999999999999994e-152 < d < 3.39999999999999989e126Initial program 74.1%
Simplified74.1%
Applied egg-rr20.2%
expm1-def29.3%
expm1-log1p60.1%
associate-*l/61.9%
*-commutative61.9%
Simplified61.9%
Taylor expanded in h around 0 48.4%
associate-*r/48.4%
*-commutative48.4%
times-frac54.4%
associate-*r*54.5%
associate-/l*54.5%
unpow254.5%
associate-*l*57.6%
unpow257.6%
unpow257.6%
associate-*r/57.6%
Simplified57.6%
if -3.3000000000000002e-137 < d < 2.80000000000000014e-305Initial program 39.8%
Simplified36.8%
Taylor expanded in d around inf 28.3%
pow128.3%
sqrt-div25.3%
metadata-eval25.3%
Applied egg-rr25.3%
unpow125.3%
associate-*r/25.3%
*-rgt-identity25.3%
Simplified25.3%
expm1-log1p-u25.3%
Applied egg-rr25.3%
expm1-udef46.2%
log1p-udef46.2%
add-exp-log46.2%
Applied egg-rr46.2%
if 2.80000000000000014e-305 < d < 9.9999999999999994e-152Initial program 59.6%
Simplified56.4%
Taylor expanded in d around inf 30.2%
pow130.2%
sqrt-div30.3%
metadata-eval30.3%
Applied egg-rr30.3%
unpow130.3%
associate-*r/30.2%
*-rgt-identity30.2%
Simplified30.2%
sqrt-prod34.6%
Applied egg-rr34.6%
if 3.39999999999999989e126 < d Initial program 55.9%
Simplified55.7%
Taylor expanded in d around inf 75.1%
pow1/275.1%
Applied egg-rr75.1%
unpow1/275.1%
unpow-175.1%
sqr-pow75.1%
rem-sqrt-square75.1%
metadata-eval75.1%
sqr-pow74.7%
fabs-sqr74.7%
sqr-pow75.1%
Simplified75.1%
unpow-prod-down81.0%
Applied egg-rr81.0%
Final simplification53.6%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(sqrt (/ (* d (/ d l)) h))
(+
1.0
(* -0.5 (* (/ 0.25 l) (/ (* D (* D (* M M))) (* d (/ d h)))))))))
(if (<= d -4e-140)
t_0
(if (<= d -2e-310)
(/ d (+ (+ 1.0 (sqrt (* h l))) -1.0))
(if (<= d 2.6e-153)
(/ d (* (sqrt h) (sqrt l)))
(if (<= d 3.1e+126) t_0 (* d (* (pow h -0.5) (pow l -0.5)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double tmp;
if (d <= -4e-140) {
tmp = t_0;
} else if (d <= -2e-310) {
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
} else if (d <= 2.6e-153) {
tmp = d / (sqrt(h) * sqrt(l));
} else if (d <= 3.1e+126) {
tmp = t_0;
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((d * (d / l)) / h)) * (1.0d0 + ((-0.5d0) * ((0.25d0 / l) * ((d_1 * (d_1 * (m * m))) / (d * (d / h))))))
if (d <= (-4d-140)) then
tmp = t_0
else if (d <= (-2d-310)) then
tmp = d / ((1.0d0 + sqrt((h * l))) + (-1.0d0))
else if (d <= 2.6d-153) then
tmp = d / (sqrt(h) * sqrt(l))
else if (d <= 3.1d+126) then
tmp = t_0
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double tmp;
if (d <= -4e-140) {
tmp = t_0;
} else if (d <= -2e-310) {
tmp = d / ((1.0 + Math.sqrt((h * l))) + -1.0);
} else if (d <= 2.6e-153) {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
} else if (d <= 3.1e+126) {
tmp = t_0;
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h)))))) tmp = 0 if d <= -4e-140: tmp = t_0 elif d <= -2e-310: tmp = d / ((1.0 + math.sqrt((h * l))) + -1.0) elif d <= 2.6e-153: tmp = d / (math.sqrt(h) * math.sqrt(l)) elif d <= 3.1e+126: tmp = t_0 else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d * Float64(d / l)) / h)) * Float64(1.0 + Float64(-0.5 * Float64(Float64(0.25 / l) * Float64(Float64(D * Float64(D * Float64(M * M))) / Float64(d * Float64(d / h))))))) tmp = 0.0 if (d <= -4e-140) tmp = t_0; elseif (d <= -2e-310) tmp = Float64(d / Float64(Float64(1.0 + sqrt(Float64(h * l))) + -1.0)); elseif (d <= 2.6e-153) tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); elseif (d <= 3.1e+126) tmp = t_0; else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
tmp = 0.0;
if (d <= -4e-140)
tmp = t_0;
elseif (d <= -2e-310)
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
elseif (d <= 2.6e-153)
tmp = d / (sqrt(h) * sqrt(l));
elseif (d <= 3.1e+126)
tmp = t_0;
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d * N[(d / l), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(0.25 / l), $MachinePrecision] * N[(N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4e-140], t$95$0, If[LessEqual[d, -2e-310], N[(d / N[(N[(1.0 + N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.6e-153], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.1e+126], t$95$0, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d \cdot \frac{d}{\ell}}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{0.25}{\ell} \cdot \frac{D \cdot \left(D \cdot \left(M \cdot M\right)\right)}{d \cdot \frac{d}{h}}\right)\right)\\
\mathbf{if}\;d \leq -4 \cdot 10^{-140}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\left(1 + \sqrt{h \cdot \ell}\right) + -1}\\
\mathbf{elif}\;d \leq 2.6 \cdot 10^{-153}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{elif}\;d \leq 3.1 \cdot 10^{+126}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -3.9999999999999999e-140 or 2.6000000000000001e-153 < d < 3.1e126Initial program 73.2%
Simplified72.5%
Applied egg-rr23.7%
expm1-def31.4%
expm1-log1p59.1%
associate-*l/56.5%
*-commutative56.5%
Simplified56.5%
Taylor expanded in h around 0 40.1%
associate-*r/40.1%
*-commutative40.1%
times-frac44.2%
associate-*r*44.3%
associate-/l*42.9%
unpow242.9%
associate-*l*46.6%
unpow246.6%
unpow246.6%
associate-*r/47.3%
Simplified47.3%
if -3.9999999999999999e-140 < d < -1.999999999999994e-310Initial program 41.1%
Simplified38.0%
Taylor expanded in d around inf 29.1%
pow129.1%
sqrt-div26.1%
metadata-eval26.1%
Applied egg-rr26.1%
unpow126.1%
associate-*r/26.1%
*-rgt-identity26.1%
Simplified26.1%
expm1-log1p-u26.1%
Applied egg-rr26.1%
expm1-udef47.6%
log1p-udef47.6%
add-exp-log47.6%
Applied egg-rr47.6%
if -1.999999999999994e-310 < d < 2.6000000000000001e-153Initial program 58.3%
Simplified55.2%
Taylor expanded in d around inf 29.6%
pow129.6%
sqrt-div29.6%
metadata-eval29.6%
Applied egg-rr29.6%
unpow129.6%
associate-*r/29.6%
*-rgt-identity29.6%
Simplified29.6%
sqrt-prod33.9%
Applied egg-rr33.9%
if 3.1e126 < d Initial program 55.9%
Simplified55.7%
Taylor expanded in d around inf 75.1%
pow1/275.1%
Applied egg-rr75.1%
unpow1/275.1%
unpow-175.1%
sqr-pow75.1%
rem-sqrt-square75.1%
metadata-eval75.1%
sqr-pow74.7%
fabs-sqr74.7%
sqr-pow75.1%
Simplified75.1%
unpow-prod-down81.0%
Applied egg-rr81.0%
Final simplification49.2%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(sqrt (/ (* d (/ d l)) h))
(+
1.0
(* -0.5 (* (/ 0.25 l) (/ (* D (* D (* M M))) (* d (/ d h)))))))))
(if (<= d -2.8e-143)
t_0
(if (<= d -2e-310)
(/ d (+ (+ 1.0 (sqrt (* h l))) -1.0))
(if (or (<= d 1.48e-153) (not (<= d 3.2e+126)))
(/ d (* (sqrt h) (sqrt l)))
t_0)))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double tmp;
if (d <= -2.8e-143) {
tmp = t_0;
} else if (d <= -2e-310) {
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
} else if ((d <= 1.48e-153) || !(d <= 3.2e+126)) {
tmp = d / (sqrt(h) * sqrt(l));
} else {
tmp = t_0;
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((d * (d / l)) / h)) * (1.0d0 + ((-0.5d0) * ((0.25d0 / l) * ((d_1 * (d_1 * (m * m))) / (d * (d / h))))))
if (d <= (-2.8d-143)) then
tmp = t_0
else if (d <= (-2d-310)) then
tmp = d / ((1.0d0 + sqrt((h * l))) + (-1.0d0))
else if ((d <= 1.48d-153) .or. (.not. (d <= 3.2d+126))) then
tmp = d / (sqrt(h) * sqrt(l))
else
tmp = t_0
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double tmp;
if (d <= -2.8e-143) {
tmp = t_0;
} else if (d <= -2e-310) {
tmp = d / ((1.0 + Math.sqrt((h * l))) + -1.0);
} else if ((d <= 1.48e-153) || !(d <= 3.2e+126)) {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
} else {
tmp = t_0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h)))))) tmp = 0 if d <= -2.8e-143: tmp = t_0 elif d <= -2e-310: tmp = d / ((1.0 + math.sqrt((h * l))) + -1.0) elif (d <= 1.48e-153) or not (d <= 3.2e+126): tmp = d / (math.sqrt(h) * math.sqrt(l)) else: tmp = t_0 return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d * Float64(d / l)) / h)) * Float64(1.0 + Float64(-0.5 * Float64(Float64(0.25 / l) * Float64(Float64(D * Float64(D * Float64(M * M))) / Float64(d * Float64(d / h))))))) tmp = 0.0 if (d <= -2.8e-143) tmp = t_0; elseif (d <= -2e-310) tmp = Float64(d / Float64(Float64(1.0 + sqrt(Float64(h * l))) + -1.0)); elseif ((d <= 1.48e-153) || !(d <= 3.2e+126)) tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); else tmp = t_0; end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
tmp = 0.0;
if (d <= -2.8e-143)
tmp = t_0;
elseif (d <= -2e-310)
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
elseif ((d <= 1.48e-153) || ~((d <= 3.2e+126)))
tmp = d / (sqrt(h) * sqrt(l));
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d * N[(d / l), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(0.25 / l), $MachinePrecision] * N[(N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.8e-143], t$95$0, If[LessEqual[d, -2e-310], N[(d / N[(N[(1.0 + N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 1.48e-153], N[Not[LessEqual[d, 3.2e+126]], $MachinePrecision]], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d \cdot \frac{d}{\ell}}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{0.25}{\ell} \cdot \frac{D \cdot \left(D \cdot \left(M \cdot M\right)\right)}{d \cdot \frac{d}{h}}\right)\right)\\
\mathbf{if}\;d \leq -2.8 \cdot 10^{-143}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\left(1 + \sqrt{h \cdot \ell}\right) + -1}\\
\mathbf{elif}\;d \leq 1.48 \cdot 10^{-153} \lor \neg \left(d \leq 3.2 \cdot 10^{+126}\right):\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d < -2.7999999999999999e-143 or 1.47999999999999995e-153 < d < 3.1999999999999998e126Initial program 73.2%
Simplified72.5%
Applied egg-rr23.7%
expm1-def31.4%
expm1-log1p59.1%
associate-*l/56.5%
*-commutative56.5%
Simplified56.5%
Taylor expanded in h around 0 40.1%
associate-*r/40.1%
*-commutative40.1%
times-frac44.2%
associate-*r*44.3%
associate-/l*42.9%
unpow242.9%
associate-*l*46.6%
unpow246.6%
unpow246.6%
associate-*r/47.3%
Simplified47.3%
if -2.7999999999999999e-143 < d < -1.999999999999994e-310Initial program 41.1%
Simplified38.0%
Taylor expanded in d around inf 29.1%
pow129.1%
sqrt-div26.1%
metadata-eval26.1%
Applied egg-rr26.1%
unpow126.1%
associate-*r/26.1%
*-rgt-identity26.1%
Simplified26.1%
expm1-log1p-u26.1%
Applied egg-rr26.1%
expm1-udef47.6%
log1p-udef47.6%
add-exp-log47.6%
Applied egg-rr47.6%
if -1.999999999999994e-310 < d < 1.47999999999999995e-153 or 3.1999999999999998e126 < d Initial program 57.3%
Simplified55.4%
Taylor expanded in d around inf 48.3%
pow148.3%
sqrt-div48.3%
metadata-eval48.3%
Applied egg-rr48.3%
unpow148.3%
associate-*r/48.2%
*-rgt-identity48.2%
Simplified48.2%
sqrt-prod53.1%
Applied egg-rr53.1%
Final simplification49.1%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* h l)))
(t_1
(*
(sqrt (/ (* d (/ d l)) h))
(+
1.0
(* -0.5 (* (/ 0.25 l) (/ (* D (* D (* M M))) (* d (/ d h)))))))))
(if (<= d -1.65e-143)
t_1
(if (<= d -2e-276)
(/ d (+ (+ 1.0 t_0) -1.0))
(if (<= d 2.2e-152)
(* d (/ 1.0 t_0))
(if (<= d 3.2e+126) t_1 (* d (pow (* h l) -0.5))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double t_1 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double tmp;
if (d <= -1.65e-143) {
tmp = t_1;
} else if (d <= -2e-276) {
tmp = d / ((1.0 + t_0) + -1.0);
} else if (d <= 2.2e-152) {
tmp = d * (1.0 / t_0);
} else if (d <= 3.2e+126) {
tmp = t_1;
} else {
tmp = d * pow((h * l), -0.5);
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((h * l))
t_1 = sqrt(((d * (d / l)) / h)) * (1.0d0 + ((-0.5d0) * ((0.25d0 / l) * ((d_1 * (d_1 * (m * m))) / (d * (d / h))))))
if (d <= (-1.65d-143)) then
tmp = t_1
else if (d <= (-2d-276)) then
tmp = d / ((1.0d0 + t_0) + (-1.0d0))
else if (d <= 2.2d-152) then
tmp = d * (1.0d0 / t_0)
else if (d <= 3.2d+126) then
tmp = t_1
else
tmp = d * ((h * l) ** (-0.5d0))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h * l));
double t_1 = Math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
double tmp;
if (d <= -1.65e-143) {
tmp = t_1;
} else if (d <= -2e-276) {
tmp = d / ((1.0 + t_0) + -1.0);
} else if (d <= 2.2e-152) {
tmp = d * (1.0 / t_0);
} else if (d <= 3.2e+126) {
tmp = t_1;
} else {
tmp = d * Math.pow((h * l), -0.5);
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) t_1 = math.sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h)))))) tmp = 0 if d <= -1.65e-143: tmp = t_1 elif d <= -2e-276: tmp = d / ((1.0 + t_0) + -1.0) elif d <= 2.2e-152: tmp = d * (1.0 / t_0) elif d <= 3.2e+126: tmp = t_1 else: tmp = d * math.pow((h * l), -0.5) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) t_1 = Float64(sqrt(Float64(Float64(d * Float64(d / l)) / h)) * Float64(1.0 + Float64(-0.5 * Float64(Float64(0.25 / l) * Float64(Float64(D * Float64(D * Float64(M * M))) / Float64(d * Float64(d / h))))))) tmp = 0.0 if (d <= -1.65e-143) tmp = t_1; elseif (d <= -2e-276) tmp = Float64(d / Float64(Float64(1.0 + t_0) + -1.0)); elseif (d <= 2.2e-152) tmp = Float64(d * Float64(1.0 / t_0)); elseif (d <= 3.2e+126) tmp = t_1; else tmp = Float64(d * (Float64(h * l) ^ -0.5)); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h * l));
t_1 = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((0.25 / l) * ((D * (D * (M * M))) / (d * (d / h))))));
tmp = 0.0;
if (d <= -1.65e-143)
tmp = t_1;
elseif (d <= -2e-276)
tmp = d / ((1.0 + t_0) + -1.0);
elseif (d <= 2.2e-152)
tmp = d * (1.0 / t_0);
elseif (d <= 3.2e+126)
tmp = t_1;
else
tmp = d * ((h * l) ^ -0.5);
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(N[(d * N[(d / l), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(0.25 / l), $MachinePrecision] * N[(N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.65e-143], t$95$1, If[LessEqual[d, -2e-276], N[(d / N[(N[(1.0 + t$95$0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.2e-152], N[(d * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.2e+126], t$95$1, N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
t_1 := \sqrt{\frac{d \cdot \frac{d}{\ell}}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{0.25}{\ell} \cdot \frac{D \cdot \left(D \cdot \left(M \cdot M\right)\right)}{d \cdot \frac{d}{h}}\right)\right)\\
\mathbf{if}\;d \leq -1.65 \cdot 10^{-143}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-276}:\\
\;\;\;\;\frac{d}{\left(1 + t_0\right) + -1}\\
\mathbf{elif}\;d \leq 2.2 \cdot 10^{-152}:\\
\;\;\;\;d \cdot \frac{1}{t_0}\\
\mathbf{elif}\;d \leq 3.2 \cdot 10^{+126}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\end{array}
\end{array}
if d < -1.65e-143 or 2.19999999999999985e-152 < d < 3.1999999999999998e126Initial program 73.2%
Simplified72.5%
Applied egg-rr23.7%
expm1-def31.4%
expm1-log1p59.1%
associate-*l/56.5%
*-commutative56.5%
Simplified56.5%
Taylor expanded in h around 0 40.1%
associate-*r/40.1%
*-commutative40.1%
times-frac44.2%
associate-*r*44.3%
associate-/l*42.9%
unpow242.9%
associate-*l*46.6%
unpow246.6%
unpow246.6%
associate-*r/47.3%
Simplified47.3%
if -1.65e-143 < d < -2e-276Initial program 44.1%
Simplified39.8%
Taylor expanded in d around inf 23.8%
pow123.8%
sqrt-div19.6%
metadata-eval19.6%
Applied egg-rr19.6%
unpow119.6%
associate-*r/19.6%
*-rgt-identity19.6%
Simplified19.6%
expm1-log1p-u19.6%
Applied egg-rr19.6%
expm1-udef49.5%
log1p-udef49.5%
add-exp-log49.5%
Applied egg-rr49.5%
if -2e-276 < d < 2.19999999999999985e-152Initial program 54.2%
Simplified51.6%
Taylor expanded in d around inf 31.7%
*-un-lft-identity31.7%
sqrt-div31.8%
metadata-eval31.8%
Applied egg-rr31.8%
*-lft-identity31.8%
Simplified31.8%
if 3.1999999999999998e126 < d Initial program 55.9%
Simplified55.7%
Taylor expanded in d around inf 75.1%
pow1/275.1%
Applied egg-rr75.1%
unpow1/275.1%
unpow-175.1%
sqr-pow75.1%
rem-sqrt-square75.1%
metadata-eval75.1%
sqr-pow74.7%
fabs-sqr74.7%
sqr-pow75.1%
Simplified75.1%
Final simplification47.7%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= h -3.8e-249) (/ d (+ (+ 1.0 (sqrt (* h l))) -1.0)) (* d (sqrt (/ 1.0 (* h l))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -3.8e-249) {
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
} else {
tmp = d * sqrt((1.0 / (h * l)));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= (-3.8d-249)) then
tmp = d / ((1.0d0 + sqrt((h * l))) + (-1.0d0))
else
tmp = d * sqrt((1.0d0 / (h * l)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -3.8e-249) {
tmp = d / ((1.0 + Math.sqrt((h * l))) + -1.0);
} else {
tmp = d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -3.8e-249: tmp = d / ((1.0 + math.sqrt((h * l))) + -1.0) else: tmp = d * math.sqrt((1.0 / (h * l))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -3.8e-249) tmp = Float64(d / Float64(Float64(1.0 + sqrt(Float64(h * l))) + -1.0)); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= -3.8e-249)
tmp = d / ((1.0 + sqrt((h * l))) + -1.0);
else
tmp = d * sqrt((1.0 / (h * l)));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -3.8e-249], N[(d / N[(N[(1.0 + N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -3.8 \cdot 10^{-249}:\\
\;\;\;\;\frac{d}{\left(1 + \sqrt{h \cdot \ell}\right) + -1}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if h < -3.8000000000000001e-249Initial program 64.5%
Simplified63.6%
Taylor expanded in d around inf 14.4%
pow114.4%
sqrt-div13.6%
metadata-eval13.6%
Applied egg-rr13.6%
unpow113.6%
associate-*r/13.6%
*-rgt-identity13.6%
Simplified13.6%
expm1-log1p-u13.6%
Applied egg-rr13.6%
expm1-udef24.6%
log1p-udef24.6%
add-exp-log24.6%
Applied egg-rr24.6%
if -3.8000000000000001e-249 < h Initial program 64.2%
Simplified62.5%
Taylor expanded in d around inf 38.2%
Final simplification32.1%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (sqrt (/ 1.0 (* h l)))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt((1.0 / (h * l)));
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d * sqrt((1.0d0 / (h * l)))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt((1.0 / (h * l)));
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt((1.0 / (h * l)))
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt((1.0 / (h * l)));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{1}{h \cdot \ell}}
\end{array}
Initial program 64.3%
Simplified63.0%
Taylor expanded in d around inf 27.5%
Final simplification27.5%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (pow (* h l) -0.5)))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * pow((h * l), -0.5);
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d * ((h * l) ** (-0.5d0))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.pow((h * l), -0.5);
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.pow((h * l), -0.5)
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * (Float64(h * l) ^ -0.5)) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * ((h * l) ^ -0.5);
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 64.3%
Simplified63.0%
Taylor expanded in d around inf 27.5%
pow1/227.5%
Applied egg-rr27.5%
unpow1/227.5%
unpow-127.5%
sqr-pow27.5%
rem-sqrt-square27.1%
metadata-eval27.1%
sqr-pow27.0%
fabs-sqr27.0%
sqr-pow27.1%
Simplified27.1%
Final simplification27.1%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ d (sqrt (* h l))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((h * l));
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d / sqrt((h * l))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((h * l));
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d / math.sqrt((h * l))
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(h * l))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((h * l));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 64.3%
Simplified63.0%
Taylor expanded in d around inf 27.5%
pow127.5%
sqrt-div27.1%
metadata-eval27.1%
Applied egg-rr27.1%
unpow127.1%
associate-*r/27.1%
*-rgt-identity27.1%
Simplified27.1%
Final simplification27.1%
herbie shell --seed 2023293
(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)))))