
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -100000000.0)
(*
(* d (* (pow (- l) -0.5) (pow (/ -1.0 h) 0.5)))
(+ -1.0 (* 0.5 (* (pow (* D (/ (/ M d) 2.0)) 2.0) (/ h l)))))
(if (<= l -5e-310)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l))))
(*
(/ (sqrt d) (sqrt h))
(*
(/ (sqrt d) (sqrt l))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D d)) 2.0)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -100000000.0) {
tmp = (d * (pow(-l, -0.5) * pow((-1.0 / h), 0.5))) * (-1.0 + (0.5 * (pow((D * ((M / d) / 2.0)), 2.0) * (h / l))));
} else if (l <= -5e-310) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else {
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D / d)), 2.0)))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-100000000.0d0)) then
tmp = (d * ((-l ** (-0.5d0)) * (((-1.0d0) / h) ** 0.5d0))) * ((-1.0d0) + (0.5d0 * (((d_1 * ((m / d) / 2.0d0)) ** 2.0d0) * (h / l))))
else if (l <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + (0.5d0 * ((h * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l)))
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_1 / d)) ** 2.0d0)))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -100000000.0) {
tmp = (d * (Math.pow(-l, -0.5) * Math.pow((-1.0 / h), 0.5))) * (-1.0 + (0.5 * (Math.pow((D * ((M / d) / 2.0)), 2.0) * (h / l))));
} else if (l <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D / d)), 2.0)))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -100000000.0: tmp = (d * (math.pow(-l, -0.5) * math.pow((-1.0 / h), 0.5))) * (-1.0 + (0.5 * (math.pow((D * ((M / d) / 2.0)), 2.0) * (h / l)))) elif l <= -5e-310: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * math.pow((D * (0.5 * (M / d))), 2.0)) / l))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D / d)), 2.0))))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -100000000.0) tmp = Float64(Float64(d * Float64((Float64(-l) ^ -0.5) * (Float64(-1.0 / h) ^ 0.5))) * Float64(-1.0 + Float64(0.5 * Float64((Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0) * Float64(h / l))))); elseif (l <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0)))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -100000000.0)
tmp = (d * ((-l ^ -0.5) * ((-1.0 / h) ^ 0.5))) * (-1.0 + (0.5 * (((D * ((M / d) / 2.0)) ^ 2.0) * (h / l))));
elseif (l <= -5e-310)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * ((D * (0.5 * (M / d))) ^ 2.0)) / l)));
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D / d)) ^ 2.0)))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -100000000.0], N[(N[(d * N[(N[Power[(-l), -0.5], $MachinePrecision] * N[Power[N[(-1.0 / h), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -100000000:\\
\;\;\;\;\left(d \cdot \left({\left(-\ell\right)}^{-0.5} \cdot {\left(\frac{-1}{h}\right)}^{0.5}\right)\right) \cdot \left(-1 + 0.5 \cdot \left({\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if l < -1e8Initial program 57.7%
metadata-eval57.7%
unpow1/257.7%
metadata-eval57.7%
unpow1/257.7%
*-commutative57.7%
associate-*l*57.7%
times-frac57.9%
metadata-eval57.9%
Simplified57.9%
expm1-log1p-u45.0%
expm1-udef27.7%
Applied egg-rr20.9%
expm1-def35.5%
expm1-log1p46.0%
sub-neg46.0%
+-commutative46.0%
associate-*l/43.3%
associate-/l*44.7%
+-commutative44.7%
sub-neg44.7%
associate-/l*44.7%
associate-*r/44.7%
associate-*l/44.7%
associate-/l*47.4%
associate-*r/44.7%
Simplified44.6%
Taylor expanded in d around -inf 64.1%
mul-1-neg64.1%
associate-/r*65.5%
distribute-rgt-neg-in65.5%
associate-/l/64.1%
unpow-164.1%
sqr-pow64.1%
rem-sqrt-square64.1%
metadata-eval64.1%
sqr-pow63.9%
fabs-sqr63.9%
sqr-pow64.1%
Simplified64.1%
Taylor expanded in h around -inf 73.0%
distribute-lft-in73.0%
exp-sum73.2%
*-commutative73.2%
exp-to-pow74.1%
mul-1-neg74.1%
*-commutative74.1%
*-commutative74.1%
associate-*l*74.1%
metadata-eval74.1%
exp-to-pow77.7%
Simplified77.7%
if -1e8 < l < -4.999999999999985e-310Initial program 63.5%
metadata-eval63.5%
unpow1/263.5%
metadata-eval63.5%
unpow1/263.5%
*-commutative63.5%
associate-*l*63.5%
times-frac63.3%
metadata-eval63.3%
Simplified63.3%
expm1-log1p-u26.1%
expm1-udef23.1%
Applied egg-rr18.2%
expm1-def21.2%
expm1-log1p57.8%
sub-neg57.8%
+-commutative57.8%
associate-*l/57.9%
associate-/l*57.9%
+-commutative57.9%
sub-neg57.9%
associate-/l*57.9%
associate-*r/58.0%
associate-*l/58.0%
associate-/l*64.2%
associate-*r/57.9%
Simplified56.1%
Taylor expanded in d around -inf 71.1%
associate-*r*71.1%
mul-1-neg71.1%
*-commutative71.1%
Simplified71.1%
associate-*r/88.1%
div-inv88.1%
metadata-eval88.1%
Applied egg-rr88.1%
if -4.999999999999985e-310 < l Initial program 65.1%
associate-*l*65.2%
metadata-eval65.2%
unpow1/265.2%
metadata-eval65.2%
unpow1/265.2%
associate-*l*65.2%
metadata-eval65.2%
times-frac65.1%
Simplified65.1%
sqrt-div78.0%
Applied egg-rr78.0%
sqrt-div85.5%
Applied egg-rr85.5%
Final simplification83.8%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -100000000.0)
(*
(* d (* (pow (- l) -0.5) (pow (/ -1.0 h) 0.5)))
(+ -1.0 (* 0.5 (* (pow (* D (/ (/ M d) 2.0)) 2.0) (/ h l)))))
(if (<= l -5e-310)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l))))
(*
(/ (sqrt d) (sqrt h))
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D d)) 2.0))))
(sqrt (/ d l)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -100000000.0) {
tmp = (d * (pow(-l, -0.5) * pow((-1.0 / h), 0.5))) * (-1.0 + (0.5 * (pow((D * ((M / d) / 2.0)), 2.0) * (h / l))));
} else if (l <= -5e-310) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else {
tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D / d)), 2.0)))) * sqrt((d / l)));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-100000000.0d0)) then
tmp = (d * ((-l ** (-0.5d0)) * (((-1.0d0) / h) ** 0.5d0))) * ((-1.0d0) + (0.5d0 * (((d_1 * ((m / d) / 2.0d0)) ** 2.0d0) * (h / l))))
else if (l <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + (0.5d0 * ((h * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l)))
else
tmp = (sqrt(d) / sqrt(h)) * ((1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_1 / d)) ** 2.0d0)))) * sqrt((d / l)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -100000000.0) {
tmp = (d * (Math.pow(-l, -0.5) * Math.pow((-1.0 / h), 0.5))) * (-1.0 + (0.5 * (Math.pow((D * ((M / d) / 2.0)), 2.0) * (h / l))));
} else if (l <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D / d)), 2.0)))) * Math.sqrt((d / l)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -100000000.0: tmp = (d * (math.pow(-l, -0.5) * math.pow((-1.0 / h), 0.5))) * (-1.0 + (0.5 * (math.pow((D * ((M / d) / 2.0)), 2.0) * (h / l)))) elif l <= -5e-310: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * math.pow((D * (0.5 * (M / d))), 2.0)) / l))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * ((1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D / d)), 2.0)))) * math.sqrt((d / l))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -100000000.0) tmp = Float64(Float64(d * Float64((Float64(-l) ^ -0.5) * (Float64(-1.0 / h) ^ 0.5))) * Float64(-1.0 + Float64(0.5 * Float64((Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0) * Float64(h / l))))); elseif (l <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0)))) * sqrt(Float64(d / l)))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -100000000.0)
tmp = (d * ((-l ^ -0.5) * ((-1.0 / h) ^ 0.5))) * (-1.0 + (0.5 * (((D * ((M / d) / 2.0)) ^ 2.0) * (h / l))));
elseif (l <= -5e-310)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * ((D * (0.5 * (M / d))) ^ 2.0)) / l)));
else
tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D / d)) ^ 2.0)))) * sqrt((d / l)));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -100000000.0], N[(N[(d * N[(N[Power[(-l), -0.5], $MachinePrecision] * N[Power[N[(-1.0 / h), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -100000000:\\
\;\;\;\;\left(d \cdot \left({\left(-\ell\right)}^{-0.5} \cdot {\left(\frac{-1}{h}\right)}^{0.5}\right)\right) \cdot \left(-1 + 0.5 \cdot \left({\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\end{array}
\end{array}
if l < -1e8Initial program 57.7%
metadata-eval57.7%
unpow1/257.7%
metadata-eval57.7%
unpow1/257.7%
*-commutative57.7%
associate-*l*57.7%
times-frac57.9%
metadata-eval57.9%
Simplified57.9%
expm1-log1p-u45.0%
expm1-udef27.7%
Applied egg-rr20.9%
expm1-def35.5%
expm1-log1p46.0%
sub-neg46.0%
+-commutative46.0%
associate-*l/43.3%
associate-/l*44.7%
+-commutative44.7%
sub-neg44.7%
associate-/l*44.7%
associate-*r/44.7%
associate-*l/44.7%
associate-/l*47.4%
associate-*r/44.7%
Simplified44.6%
Taylor expanded in d around -inf 64.1%
mul-1-neg64.1%
associate-/r*65.5%
distribute-rgt-neg-in65.5%
associate-/l/64.1%
unpow-164.1%
sqr-pow64.1%
rem-sqrt-square64.1%
metadata-eval64.1%
sqr-pow63.9%
fabs-sqr63.9%
sqr-pow64.1%
Simplified64.1%
Taylor expanded in h around -inf 73.0%
distribute-lft-in73.0%
exp-sum73.2%
*-commutative73.2%
exp-to-pow74.1%
mul-1-neg74.1%
*-commutative74.1%
*-commutative74.1%
associate-*l*74.1%
metadata-eval74.1%
exp-to-pow77.7%
Simplified77.7%
if -1e8 < l < -4.999999999999985e-310Initial program 63.5%
metadata-eval63.5%
unpow1/263.5%
metadata-eval63.5%
unpow1/263.5%
*-commutative63.5%
associate-*l*63.5%
times-frac63.3%
metadata-eval63.3%
Simplified63.3%
expm1-log1p-u26.1%
expm1-udef23.1%
Applied egg-rr18.2%
expm1-def21.2%
expm1-log1p57.8%
sub-neg57.8%
+-commutative57.8%
associate-*l/57.9%
associate-/l*57.9%
+-commutative57.9%
sub-neg57.9%
associate-/l*57.9%
associate-*r/58.0%
associate-*l/58.0%
associate-/l*64.2%
associate-*r/57.9%
Simplified56.1%
Taylor expanded in d around -inf 71.1%
associate-*r*71.1%
mul-1-neg71.1%
*-commutative71.1%
Simplified71.1%
associate-*r/88.1%
div-inv88.1%
metadata-eval88.1%
Applied egg-rr88.1%
if -4.999999999999985e-310 < l Initial program 65.1%
associate-*l*65.2%
metadata-eval65.2%
unpow1/265.2%
metadata-eval65.2%
unpow1/265.2%
associate-*l*65.2%
metadata-eval65.2%
times-frac65.1%
Simplified65.1%
sqrt-div78.0%
Applied egg-rr78.0%
Final simplification79.9%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* 0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l))))
(if (<= l -250000.0)
(*
(* d (* (pow (- l) -0.5) (pow (/ -1.0 h) 0.5)))
(+ -1.0 (* 0.5 (* (pow (* D (/ (/ M d) 2.0)) 2.0) (/ h l)))))
(if (<= l -5e-310)
(* (* d (sqrt (/ 1.0 (* l h)))) (+ -1.0 t_0))
(* (- 1.0 t_0) (* d (pow (* l h) -0.5)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l);
double tmp;
if (l <= -250000.0) {
tmp = (d * (pow(-l, -0.5) * pow((-1.0 / h), 0.5))) * (-1.0 + (0.5 * (pow((D * ((M / d) / 2.0)), 2.0) * (h / l))));
} else if (l <= -5e-310) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else {
tmp = (1.0 - t_0) * (d * pow((l * h), -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 = 0.5d0 * ((h * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l)
if (l <= (-250000.0d0)) then
tmp = (d * ((-l ** (-0.5d0)) * (((-1.0d0) / h) ** 0.5d0))) * ((-1.0d0) + (0.5d0 * (((d_1 * ((m / d) / 2.0d0)) ** 2.0d0) * (h / l))))
else if (l <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + t_0)
else
tmp = (1.0d0 - t_0) * (d * ((l * h) ** (-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.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l);
double tmp;
if (l <= -250000.0) {
tmp = (d * (Math.pow(-l, -0.5) * Math.pow((-1.0 / h), 0.5))) * (-1.0 + (0.5 * (Math.pow((D * ((M / d) / 2.0)), 2.0) * (h / l))));
} else if (l <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else {
tmp = (1.0 - t_0) * (d * Math.pow((l * h), -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.5 * ((h * math.pow((D * (0.5 * (M / d))), 2.0)) / l) tmp = 0 if l <= -250000.0: tmp = (d * (math.pow(-l, -0.5) * math.pow((-1.0 / h), 0.5))) * (-1.0 + (0.5 * (math.pow((D * ((M / d) / 2.0)), 2.0) * (h / l)))) elif l <= -5e-310: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0) else: tmp = (1.0 - t_0) * (d * math.pow((l * h), -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l)) tmp = 0.0 if (l <= -250000.0) tmp = Float64(Float64(d * Float64((Float64(-l) ^ -0.5) * (Float64(-1.0 / h) ^ 0.5))) * Float64(-1.0 + Float64(0.5 * Float64((Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0) * Float64(h / l))))); elseif (l <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + t_0)); else tmp = Float64(Float64(1.0 - t_0) * Float64(d * (Float64(l * h) ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.5 * ((h * ((D * (0.5 * (M / d))) ^ 2.0)) / l);
tmp = 0.0;
if (l <= -250000.0)
tmp = (d * ((-l ^ -0.5) * ((-1.0 / h) ^ 0.5))) * (-1.0 + (0.5 * (((D * ((M / d) / 2.0)) ^ 2.0) * (h / l))));
elseif (l <= -5e-310)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
else
tmp = (1.0 - t_0) * (d * ((l * h) ^ -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.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -250000.0], N[(N[(d * N[(N[Power[(-l), -0.5], $MachinePrecision] * N[Power[N[(-1.0 / h), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\\
\mathbf{if}\;\ell \leq -250000:\\
\;\;\;\;\left(d \cdot \left({\left(-\ell\right)}^{-0.5} \cdot {\left(\frac{-1}{h}\right)}^{0.5}\right)\right) \cdot \left(-1 + 0.5 \cdot \left({\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + t_0\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t_0\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -2.5e5Initial program 57.7%
metadata-eval57.7%
unpow1/257.7%
metadata-eval57.7%
unpow1/257.7%
*-commutative57.7%
associate-*l*57.7%
times-frac57.9%
metadata-eval57.9%
Simplified57.9%
expm1-log1p-u45.0%
expm1-udef27.7%
Applied egg-rr20.9%
expm1-def35.5%
expm1-log1p46.0%
sub-neg46.0%
+-commutative46.0%
associate-*l/43.3%
associate-/l*44.7%
+-commutative44.7%
sub-neg44.7%
associate-/l*44.7%
associate-*r/44.7%
associate-*l/44.7%
associate-/l*47.4%
associate-*r/44.7%
Simplified44.6%
Taylor expanded in d around -inf 64.1%
mul-1-neg64.1%
associate-/r*65.5%
distribute-rgt-neg-in65.5%
associate-/l/64.1%
unpow-164.1%
sqr-pow64.1%
rem-sqrt-square64.1%
metadata-eval64.1%
sqr-pow63.9%
fabs-sqr63.9%
sqr-pow64.1%
Simplified64.1%
Taylor expanded in h around -inf 73.0%
distribute-lft-in73.0%
exp-sum73.2%
*-commutative73.2%
exp-to-pow74.1%
mul-1-neg74.1%
*-commutative74.1%
*-commutative74.1%
associate-*l*74.1%
metadata-eval74.1%
exp-to-pow77.7%
Simplified77.7%
if -2.5e5 < l < -4.999999999999985e-310Initial program 63.5%
metadata-eval63.5%
unpow1/263.5%
metadata-eval63.5%
unpow1/263.5%
*-commutative63.5%
associate-*l*63.5%
times-frac63.3%
metadata-eval63.3%
Simplified63.3%
expm1-log1p-u26.1%
expm1-udef23.1%
Applied egg-rr18.2%
expm1-def21.2%
expm1-log1p57.8%
sub-neg57.8%
+-commutative57.8%
associate-*l/57.9%
associate-/l*57.9%
+-commutative57.9%
sub-neg57.9%
associate-/l*57.9%
associate-*r/58.0%
associate-*l/58.0%
associate-/l*64.2%
associate-*r/57.9%
Simplified56.1%
Taylor expanded in d around -inf 71.1%
associate-*r*71.1%
mul-1-neg71.1%
*-commutative71.1%
Simplified71.1%
associate-*r/88.1%
div-inv88.1%
metadata-eval88.1%
Applied egg-rr88.1%
if -4.999999999999985e-310 < l Initial program 65.1%
metadata-eval65.1%
unpow1/265.1%
metadata-eval65.1%
unpow1/265.1%
*-commutative65.1%
associate-*l*65.1%
times-frac65.1%
metadata-eval65.1%
Simplified65.1%
expm1-log1p-u32.8%
expm1-udef28.3%
Applied egg-rr21.9%
expm1-def25.1%
expm1-log1p51.4%
sub-neg51.4%
+-commutative51.4%
associate-*l/52.9%
associate-/l*52.6%
+-commutative52.6%
sub-neg52.6%
associate-/l*52.6%
associate-*r/52.6%
associate-*l/52.6%
associate-/l*55.7%
associate-*r/52.6%
Simplified52.6%
associate-*r/4.2%
div-inv4.2%
metadata-eval4.2%
Applied egg-rr55.7%
Taylor expanded in d around 0 76.9%
*-commutative71.7%
*-commutative71.7%
unpow-171.7%
sqr-pow71.7%
rem-sqrt-square71.7%
metadata-eval71.7%
sqr-pow71.5%
fabs-sqr71.5%
sqr-pow71.7%
Simplified76.9%
Final simplification79.3%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -2.9e-273)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (* 0.25 (* (/ D (/ l D)) (* (/ M d) (/ (* h M) d)))))))
(if (<= d 3.1e+127)
(*
(- 1.0 (* 0.5 (* (pow (* D (/ (/ M d) 2.0)) 2.0) (/ h l))))
(* d (pow (* l h) -0.5)))
(* d (* (pow h -0.5) (pow l -0.5))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.9e-273) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))))));
} else if (d <= 3.1e+127) {
tmp = (1.0 - (0.5 * (pow((D * ((M / d) / 2.0)), 2.0) * (h / l)))) * (d * pow((l * h), -0.5));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-2.9d-273)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + (0.5d0 * (0.25d0 * ((d_1 / (l / d_1)) * ((m / d) * ((h * m) / d))))))
else if (d <= 3.1d+127) then
tmp = (1.0d0 - (0.5d0 * (((d_1 * ((m / d) / 2.0d0)) ** 2.0d0) * (h / l)))) * (d * ((l * h) ** (-0.5d0)))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.9e-273) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))))));
} else if (d <= 3.1e+127) {
tmp = (1.0 - (0.5 * (Math.pow((D * ((M / d) / 2.0)), 2.0) * (h / l)))) * (d * Math.pow((l * h), -0.5));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -2.9e-273: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d)))))) elif d <= 3.1e+127: tmp = (1.0 - (0.5 * (math.pow((D * ((M / d) / 2.0)), 2.0) * (h / l)))) * (d * math.pow((l * h), -0.5)) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -2.9e-273) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(0.25 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M / d) * Float64(Float64(h * M) / d))))))); elseif (d <= 3.1e+127) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0) * Float64(h / l)))) * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -2.9e-273)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))))));
elseif (d <= 3.1e+127)
tmp = (1.0 - (0.5 * (((D * ((M / d) / 2.0)) ^ 2.0) * (h / l)))) * (d * ((l * h) ^ -0.5));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -2.9e-273], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(0.25 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.1e+127], N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.9 \cdot 10^{-273}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{M}{d} \cdot \frac{h \cdot M}{d}\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq 3.1 \cdot 10^{+127}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left({\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -2.89999999999999986e-273Initial program 61.1%
metadata-eval61.1%
unpow1/261.1%
metadata-eval61.1%
unpow1/261.1%
*-commutative61.1%
associate-*l*61.1%
times-frac61.1%
metadata-eval61.1%
Simplified61.1%
expm1-log1p-u37.8%
expm1-udef26.2%
Applied egg-rr20.1%
expm1-def30.0%
expm1-log1p51.7%
sub-neg51.7%
+-commutative51.7%
associate-*l/50.2%
associate-/l*51.0%
+-commutative51.0%
sub-neg51.0%
associate-/l*51.0%
associate-*r/51.0%
associate-*l/51.0%
associate-/l*55.3%
associate-*r/51.0%
Simplified50.2%
Taylor expanded in d around -inf 68.1%
associate-*r*68.1%
mul-1-neg68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in D around 0 48.1%
times-frac29.3%
*-commutative29.3%
unpow229.3%
associate-/l*31.8%
*-commutative31.8%
unpow231.8%
associate-*r*33.5%
unpow233.5%
times-frac45.2%
Simplified64.7%
if -2.89999999999999986e-273 < d < 3.1000000000000002e127Initial program 62.2%
metadata-eval62.2%
unpow1/262.2%
metadata-eval62.2%
unpow1/262.2%
*-commutative62.2%
associate-*l*62.2%
times-frac62.2%
metadata-eval62.2%
Simplified62.2%
expm1-log1p-u24.1%
expm1-udef19.8%
Applied egg-rr16.2%
expm1-def18.6%
expm1-log1p48.9%
sub-neg48.9%
+-commutative48.9%
associate-*l/50.0%
associate-/l*48.5%
+-commutative48.5%
sub-neg48.5%
associate-/l*48.5%
associate-*r/48.5%
associate-*l/48.5%
associate-/l*50.6%
associate-*r/48.5%
Simplified48.6%
Taylor expanded in d around 0 70.6%
*-commutative70.6%
*-commutative70.6%
unpow-170.6%
sqr-pow70.6%
rem-sqrt-square70.6%
metadata-eval70.6%
sqr-pow70.5%
fabs-sqr70.5%
sqr-pow70.6%
Simplified70.6%
if 3.1000000000000002e127 < d Initial program 68.8%
metadata-eval68.8%
unpow1/268.8%
metadata-eval68.8%
unpow1/268.8%
*-commutative68.8%
associate-*l*68.8%
times-frac68.8%
metadata-eval68.8%
Simplified68.8%
Taylor expanded in d around inf 68.1%
*-un-lft-identity68.1%
associate-/r*69.1%
Applied egg-rr69.1%
*-lft-identity69.1%
associate-/l/68.1%
unpow-168.1%
sqr-pow68.1%
rem-sqrt-square68.1%
metadata-eval68.1%
sqr-pow67.8%
fabs-sqr67.8%
sqr-pow68.1%
Simplified68.1%
unpow-prod-down82.1%
Applied egg-rr82.1%
Final simplification69.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 (* d (pow (* l h) -0.5))))
(if (<= h -4.5e+205)
(* 0.125 (* (sqrt (/ h (pow l 3.0))) (* (* M M) (* D (/ D d)))))
(if (<= h -2e-310)
(* t_0 (+ -1.0 (* 0.5 (* (pow (* D (/ (/ M d) 2.0)) 2.0) (/ h l)))))
(* (- 1.0 (* 0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l))) t_0)))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d * pow((l * h), -0.5);
double tmp;
if (h <= -4.5e+205) {
tmp = 0.125 * (sqrt((h / pow(l, 3.0))) * ((M * M) * (D * (D / d))));
} else if (h <= -2e-310) {
tmp = t_0 * (-1.0 + (0.5 * (pow((D * ((M / d) / 2.0)), 2.0) * (h / l))));
} else {
tmp = (1.0 - (0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l))) * 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 = d * ((l * h) ** (-0.5d0))
if (h <= (-4.5d+205)) then
tmp = 0.125d0 * (sqrt((h / (l ** 3.0d0))) * ((m * m) * (d_1 * (d_1 / d))))
else if (h <= (-2d-310)) then
tmp = t_0 * ((-1.0d0) + (0.5d0 * (((d_1 * ((m / d) / 2.0d0)) ** 2.0d0) * (h / l))))
else
tmp = (1.0d0 - (0.5d0 * ((h * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l))) * 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 = d * Math.pow((l * h), -0.5);
double tmp;
if (h <= -4.5e+205) {
tmp = 0.125 * (Math.sqrt((h / Math.pow(l, 3.0))) * ((M * M) * (D * (D / d))));
} else if (h <= -2e-310) {
tmp = t_0 * (-1.0 + (0.5 * (Math.pow((D * ((M / d) / 2.0)), 2.0) * (h / l))));
} else {
tmp = (1.0 - (0.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l))) * t_0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = d * math.pow((l * h), -0.5) tmp = 0 if h <= -4.5e+205: tmp = 0.125 * (math.sqrt((h / math.pow(l, 3.0))) * ((M * M) * (D * (D / d)))) elif h <= -2e-310: tmp = t_0 * (-1.0 + (0.5 * (math.pow((D * ((M / d) / 2.0)), 2.0) * (h / l)))) else: tmp = (1.0 - (0.5 * ((h * math.pow((D * (0.5 * (M / d))), 2.0)) / l))) * t_0 return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(d * (Float64(l * h) ^ -0.5)) tmp = 0.0 if (h <= -4.5e+205) tmp = Float64(0.125 * Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(Float64(M * M) * Float64(D * Float64(D / d))))); elseif (h <= -2e-310) tmp = Float64(t_0 * Float64(-1.0 + Float64(0.5 * Float64((Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0) * Float64(h / l))))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l))) * t_0); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = d * ((l * h) ^ -0.5);
tmp = 0.0;
if (h <= -4.5e+205)
tmp = 0.125 * (sqrt((h / (l ^ 3.0))) * ((M * M) * (D * (D / d))));
elseif (h <= -2e-310)
tmp = t_0 * (-1.0 + (0.5 * (((D * ((M / d) / 2.0)) ^ 2.0) * (h / l))));
else
tmp = (1.0 - (0.5 * ((h * ((D * (0.5 * (M / d))) ^ 2.0)) / l))) * 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[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -4.5e+205], N[(0.125 * N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(M * M), $MachinePrecision] * N[(D * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[(t$95$0 * N[(-1.0 + N[(0.5 * N[(N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;h \leq -4.5 \cdot 10^{+205}:\\
\;\;\;\;0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(M \cdot M\right) \cdot \left(D \cdot \frac{D}{d}\right)\right)\right)\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(-1 + 0.5 \cdot \left({\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right) \cdot t_0\\
\end{array}
\end{array}
if h < -4.50000000000000035e205Initial program 33.2%
metadata-eval33.2%
unpow1/233.2%
metadata-eval33.2%
unpow1/233.2%
*-commutative33.2%
associate-*l*33.2%
times-frac32.9%
metadata-eval32.9%
Simplified32.9%
expm1-log1p-u5.6%
expm1-udef1.2%
Applied egg-rr1.2%
expm1-def5.6%
expm1-log1p32.9%
sub-neg32.9%
+-commutative32.9%
associate-*l/37.4%
associate-/l*33.0%
+-commutative33.0%
sub-neg33.0%
associate-/l*33.0%
associate-*r/33.0%
associate-*l/33.0%
associate-/l*42.1%
associate-*r/33.0%
Simplified33.0%
Taylor expanded in d around -inf 32.7%
associate-*r*32.7%
mul-1-neg32.7%
*-commutative32.7%
Simplified32.7%
Taylor expanded in d around 0 51.1%
unpow251.1%
associate-*l*51.5%
associate-*r/51.5%
associate-*l/51.0%
unpow251.0%
*-commutative51.0%
*-commutative51.0%
unpow251.0%
*-commutative51.0%
associate-*l*46.5%
unpow246.5%
*-commutative46.5%
Simplified46.5%
if -4.50000000000000035e205 < h < -1.999999999999994e-310Initial program 66.0%
metadata-eval66.0%
unpow1/266.0%
metadata-eval66.0%
unpow1/266.0%
*-commutative66.0%
associate-*l*66.0%
times-frac66.1%
metadata-eval66.1%
Simplified66.1%
expm1-log1p-u44.0%
expm1-udef31.2%
Applied egg-rr23.8%
expm1-def34.8%
expm1-log1p54.8%
sub-neg54.8%
+-commutative54.8%
associate-*l/52.0%
associate-/l*53.9%
+-commutative53.9%
sub-neg53.9%
associate-/l*53.9%
associate-*r/53.9%
associate-*l/53.9%
associate-/l*57.0%
associate-*r/53.9%
Simplified52.9%
Taylor expanded in d around -inf 74.5%
mul-1-neg74.5%
associate-/r*74.5%
distribute-rgt-neg-in74.5%
associate-/l/74.5%
unpow-174.5%
sqr-pow74.5%
rem-sqrt-square74.5%
metadata-eval74.5%
sqr-pow74.3%
fabs-sqr74.3%
sqr-pow74.5%
Simplified74.5%
if -1.999999999999994e-310 < h Initial program 65.1%
metadata-eval65.1%
unpow1/265.1%
metadata-eval65.1%
unpow1/265.1%
*-commutative65.1%
associate-*l*65.1%
times-frac65.1%
metadata-eval65.1%
Simplified65.1%
expm1-log1p-u32.8%
expm1-udef28.3%
Applied egg-rr21.9%
expm1-def25.1%
expm1-log1p51.4%
sub-neg51.4%
+-commutative51.4%
associate-*l/52.9%
associate-/l*52.6%
+-commutative52.6%
sub-neg52.6%
associate-/l*52.6%
associate-*r/52.6%
associate-*l/52.6%
associate-/l*55.7%
associate-*r/52.6%
Simplified52.6%
associate-*r/4.2%
div-inv4.2%
metadata-eval4.2%
Applied egg-rr55.7%
Taylor expanded in d around 0 76.9%
*-commutative71.7%
*-commutative71.7%
unpow-171.7%
sqr-pow71.7%
rem-sqrt-square71.7%
metadata-eval71.7%
sqr-pow71.5%
fabs-sqr71.5%
sqr-pow71.7%
Simplified76.9%
Final simplification73.3%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -5e-310)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (* 0.25 (* (/ D (/ l D)) (* (/ M d) (/ (* h M) d)))))))
(*
(- 1.0 (* 0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l)))
(* d (pow (* l h) -0.5)))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5e-310) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))))));
} else {
tmp = (1.0 - (0.5 * ((h * pow((D * (0.5 * (M / d))), 2.0)) / l))) * (d * pow((l * h), -0.5));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + (0.5d0 * (0.25d0 * ((d_1 / (l / d_1)) * ((m / d) * ((h * m) / d))))))
else
tmp = (1.0d0 - (0.5d0 * ((h * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l))) * (d * ((l * h) ** (-0.5d0)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))))));
} else {
tmp = (1.0 - (0.5 * ((h * Math.pow((D * (0.5 * (M / d))), 2.0)) / l))) * (d * Math.pow((l * h), -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -5e-310: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d)))))) else: tmp = (1.0 - (0.5 * ((h * math.pow((D * (0.5 * (M / d))), 2.0)) / l))) * (d * math.pow((l * h), -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(0.25 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M / d) * Float64(Float64(h * M) / d))))))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l))) * Float64(d * (Float64(l * h) ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -5e-310)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))))));
else
tmp = (1.0 - (0.5 * ((h * ((D * (0.5 * (M / d))) ^ 2.0)) / l))) * (d * ((l * h) ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(0.25 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{M}{d} \cdot \frac{h \cdot M}{d}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 60.1%
metadata-eval60.1%
unpow1/260.1%
metadata-eval60.1%
unpow1/260.1%
*-commutative60.1%
associate-*l*60.1%
times-frac60.1%
metadata-eval60.1%
Simplified60.1%
expm1-log1p-u37.2%
expm1-udef25.8%
Applied egg-rr19.8%
expm1-def29.6%
expm1-log1p50.9%
sub-neg50.9%
+-commutative50.9%
associate-*l/49.4%
associate-/l*50.2%
+-commutative50.2%
sub-neg50.2%
associate-/l*50.2%
associate-*r/50.2%
associate-*l/50.2%
associate-/l*54.4%
associate-*r/50.2%
Simplified49.3%
Taylor expanded in d around -inf 67.0%
associate-*r*67.0%
mul-1-neg67.0%
*-commutative67.0%
Simplified67.0%
Taylor expanded in D around 0 47.3%
times-frac28.8%
*-commutative28.8%
unpow228.8%
associate-/l*31.2%
*-commutative31.2%
unpow231.2%
associate-*r*32.9%
unpow232.9%
times-frac44.5%
Simplified63.7%
if -4.999999999999985e-310 < l Initial program 65.1%
metadata-eval65.1%
unpow1/265.1%
metadata-eval65.1%
unpow1/265.1%
*-commutative65.1%
associate-*l*65.1%
times-frac65.1%
metadata-eval65.1%
Simplified65.1%
expm1-log1p-u32.8%
expm1-udef28.3%
Applied egg-rr21.9%
expm1-def25.1%
expm1-log1p51.4%
sub-neg51.4%
+-commutative51.4%
associate-*l/52.9%
associate-/l*52.6%
+-commutative52.6%
sub-neg52.6%
associate-/l*52.6%
associate-*r/52.6%
associate-*l/52.6%
associate-/l*55.7%
associate-*r/52.6%
Simplified52.6%
associate-*r/4.2%
div-inv4.2%
metadata-eval4.2%
Applied egg-rr55.7%
Taylor expanded in d around 0 76.9%
*-commutative71.7%
*-commutative71.7%
unpow-171.7%
sqr-pow71.7%
rem-sqrt-square71.7%
metadata-eval71.7%
sqr-pow71.5%
fabs-sqr71.5%
sqr-pow71.7%
Simplified76.9%
Final simplification70.5%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* 0.5 (/ (* h (pow (* D (* 0.5 (/ M d))) 2.0)) l)))
(t_1 (* d (pow (* l h) -0.5))))
(if (<= l -5e-310) (* t_1 (+ -1.0 t_0)) (* (- 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 * pow((D * (0.5 * (M / d))), 2.0)) / l);
double t_1 = d * pow((l * h), -0.5);
double tmp;
if (l <= -5e-310) {
tmp = t_1 * (-1.0 + t_0);
} 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 * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0)) / l)
t_1 = d * ((l * h) ** (-0.5d0))
if (l <= (-5d-310)) then
tmp = t_1 * ((-1.0d0) + t_0)
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 * Math.pow((D * (0.5 * (M / d))), 2.0)) / l);
double t_1 = d * Math.pow((l * h), -0.5);
double tmp;
if (l <= -5e-310) {
tmp = t_1 * (-1.0 + t_0);
} 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 * math.pow((D * (0.5 * (M / d))), 2.0)) / l) t_1 = d * math.pow((l * h), -0.5) tmp = 0 if l <= -5e-310: tmp = t_1 * (-1.0 + t_0) 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 * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0)) / l)) t_1 = Float64(d * (Float64(l * h) ^ -0.5)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(t_1 * Float64(-1.0 + t_0)); 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 * ((D * (0.5 * (M / d))) ^ 2.0)) / l);
t_1 = d * ((l * h) ^ -0.5);
tmp = 0.0;
if (l <= -5e-310)
tmp = t_1 * (-1.0 + t_0);
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 * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(t$95$1 * N[(-1.0 + t$95$0), $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 \frac{h \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}\\
t_1 := d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_1 \cdot \left(-1 + t_0\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t_0\right) \cdot t_1\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 60.1%
metadata-eval60.1%
unpow1/260.1%
metadata-eval60.1%
unpow1/260.1%
*-commutative60.1%
associate-*l*60.1%
times-frac60.1%
metadata-eval60.1%
Simplified60.1%
expm1-log1p-u37.2%
expm1-udef25.8%
Applied egg-rr19.8%
expm1-def29.6%
expm1-log1p50.9%
sub-neg50.9%
+-commutative50.9%
associate-*l/49.4%
associate-/l*50.2%
+-commutative50.2%
sub-neg50.2%
associate-/l*50.2%
associate-*r/50.2%
associate-*l/50.2%
associate-/l*54.4%
associate-*r/50.2%
Simplified49.3%
associate-*r/75.8%
div-inv75.8%
metadata-eval75.8%
Applied egg-rr53.6%
Taylor expanded in d around -inf 75.8%
mul-1-neg67.0%
associate-/r*67.8%
distribute-rgt-neg-in67.8%
associate-/l/67.0%
unpow-167.0%
sqr-pow67.0%
rem-sqrt-square67.0%
metadata-eval67.0%
sqr-pow66.9%
fabs-sqr66.9%
sqr-pow67.0%
Simplified75.8%
if -4.999999999999985e-310 < l Initial program 65.1%
metadata-eval65.1%
unpow1/265.1%
metadata-eval65.1%
unpow1/265.1%
*-commutative65.1%
associate-*l*65.1%
times-frac65.1%
metadata-eval65.1%
Simplified65.1%
expm1-log1p-u32.8%
expm1-udef28.3%
Applied egg-rr21.9%
expm1-def25.1%
expm1-log1p51.4%
sub-neg51.4%
+-commutative51.4%
associate-*l/52.9%
associate-/l*52.6%
+-commutative52.6%
sub-neg52.6%
associate-/l*52.6%
associate-*r/52.6%
associate-*l/52.6%
associate-/l*55.7%
associate-*r/52.6%
Simplified52.6%
associate-*r/4.2%
div-inv4.2%
metadata-eval4.2%
Applied egg-rr55.7%
Taylor expanded in d around 0 76.9%
*-commutative71.7%
*-commutative71.7%
unpow-171.7%
sqr-pow71.7%
rem-sqrt-square71.7%
metadata-eval71.7%
sqr-pow71.5%
fabs-sqr71.5%
sqr-pow71.7%
Simplified76.9%
Final simplification76.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 (* 0.5 (* 0.25 (* (/ D (/ l D)) (* (/ M d) (/ (* h M) d)))))))
(if (<= d -2.9e-273)
(* (* d (sqrt (/ 1.0 (* l h)))) (+ -1.0 t_0))
(if (<= d 1.82e-134)
(* -0.125 (* D (* (sqrt (/ h (pow l 3.0))) (* M (* M (/ D d))))))
(if (<= d 5.6e+34)
(* (- 1.0 t_0) (sqrt (/ d (/ h (/ d l)))))
(* d (* (pow h -0.5) (pow l -0.5))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
double tmp;
if (d <= -2.9e-273) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else if (d <= 1.82e-134) {
tmp = -0.125 * (D * (sqrt((h / pow(l, 3.0))) * (M * (M * (D / d)))));
} else if (d <= 5.6e+34) {
tmp = (1.0 - t_0) * sqrt((d / (h / (d / l))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (0.25d0 * ((d_1 / (l / d_1)) * ((m / d) * ((h * m) / d))))
if (d <= (-2.9d-273)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + t_0)
else if (d <= 1.82d-134) then
tmp = (-0.125d0) * (d_1 * (sqrt((h / (l ** 3.0d0))) * (m * (m * (d_1 / d)))))
else if (d <= 5.6d+34) then
tmp = (1.0d0 - t_0) * sqrt((d / (h / (d / l))))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
double tmp;
if (d <= -2.9e-273) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else if (d <= 1.82e-134) {
tmp = -0.125 * (D * (Math.sqrt((h / Math.pow(l, 3.0))) * (M * (M * (D / d)))));
} else if (d <= 5.6e+34) {
tmp = (1.0 - t_0) * Math.sqrt((d / (h / (d / l))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d)))) tmp = 0 if d <= -2.9e-273: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0) elif d <= 1.82e-134: tmp = -0.125 * (D * (math.sqrt((h / math.pow(l, 3.0))) * (M * (M * (D / d))))) elif d <= 5.6e+34: tmp = (1.0 - t_0) * math.sqrt((d / (h / (d / l)))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.5 * Float64(0.25 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M / d) * Float64(Float64(h * M) / d))))) tmp = 0.0 if (d <= -2.9e-273) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + t_0)); elseif (d <= 1.82e-134) tmp = Float64(-0.125 * Float64(D * Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(M * Float64(M * Float64(D / d)))))); elseif (d <= 5.6e+34) tmp = Float64(Float64(1.0 - t_0) * sqrt(Float64(d / Float64(h / Float64(d / l))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
tmp = 0.0;
if (d <= -2.9e-273)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
elseif (d <= 1.82e-134)
tmp = -0.125 * (D * (sqrt((h / (l ^ 3.0))) * (M * (M * (D / d)))));
elseif (d <= 5.6e+34)
tmp = (1.0 - t_0) * sqrt((d / (h / (d / l))));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(0.5 * N[(0.25 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.9e-273], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.82e-134], N[(-0.125 * N[(D * N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(M * N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.6e+34], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[Sqrt[N[(d / N[(h / N[(d / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{M}{d} \cdot \frac{h \cdot M}{d}\right)\right)\right)\\
\mathbf{if}\;d \leq -2.9 \cdot 10^{-273}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + t_0\right)\\
\mathbf{elif}\;d \leq 1.82 \cdot 10^{-134}:\\
\;\;\;\;-0.125 \cdot \left(D \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(M \cdot \left(M \cdot \frac{D}{d}\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq 5.6 \cdot 10^{+34}:\\
\;\;\;\;\left(1 - t_0\right) \cdot \sqrt{\frac{d}{\frac{h}{\frac{d}{\ell}}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -2.89999999999999986e-273Initial program 61.1%
metadata-eval61.1%
unpow1/261.1%
metadata-eval61.1%
unpow1/261.1%
*-commutative61.1%
associate-*l*61.1%
times-frac61.1%
metadata-eval61.1%
Simplified61.1%
expm1-log1p-u37.8%
expm1-udef26.2%
Applied egg-rr20.1%
expm1-def30.0%
expm1-log1p51.7%
sub-neg51.7%
+-commutative51.7%
associate-*l/50.2%
associate-/l*51.0%
+-commutative51.0%
sub-neg51.0%
associate-/l*51.0%
associate-*r/51.0%
associate-*l/51.0%
associate-/l*55.3%
associate-*r/51.0%
Simplified50.2%
Taylor expanded in d around -inf 68.1%
associate-*r*68.1%
mul-1-neg68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in D around 0 48.1%
times-frac29.3%
*-commutative29.3%
unpow229.3%
associate-/l*31.8%
*-commutative31.8%
unpow231.8%
associate-*r*33.5%
unpow233.5%
times-frac45.2%
Simplified64.7%
if -2.89999999999999986e-273 < d < 1.82000000000000006e-134Initial program 40.8%
metadata-eval40.8%
unpow1/240.8%
metadata-eval40.8%
unpow1/240.8%
*-commutative40.8%
associate-*l*40.8%
times-frac40.7%
metadata-eval40.7%
Simplified40.7%
expm1-log1p-u18.9%
expm1-udef14.4%
Applied egg-rr14.4%
expm1-def14.4%
expm1-log1p29.0%
sub-neg29.0%
+-commutative29.0%
associate-*l/26.6%
associate-/l*29.0%
+-commutative29.0%
sub-neg29.0%
associate-/l*29.0%
associate-*r/29.0%
associate-*l/29.0%
associate-/l*28.9%
associate-*r/29.0%
Simplified29.2%
Taylor expanded in d around 0 46.0%
associate-/l*45.8%
associate-/r/45.2%
unpow245.2%
associate-*r/49.9%
unpow249.9%
Simplified49.9%
Taylor expanded in D around 0 46.0%
unpow246.0%
associate-*l*50.8%
associate-*r/50.8%
associate-*l/50.4%
unpow250.4%
associate-*l*50.4%
unpow250.4%
*-commutative50.4%
unpow250.4%
associate-*l*52.8%
Simplified52.8%
if 1.82000000000000006e-134 < d < 5.60000000000000016e34Initial program 82.4%
metadata-eval82.4%
unpow1/282.4%
metadata-eval82.4%
unpow1/282.4%
*-commutative82.4%
associate-*l*82.4%
times-frac82.4%
metadata-eval82.4%
Simplified82.4%
expm1-log1p-u23.3%
expm1-udef17.7%
Applied egg-rr17.7%
expm1-def23.3%
expm1-log1p74.8%
sub-neg74.8%
+-commutative74.8%
associate-*l/75.1%
associate-/l*69.0%
+-commutative69.0%
sub-neg69.0%
associate-/l*69.0%
associate-*r/69.0%
associate-*l/69.0%
associate-/l*74.1%
associate-*r/69.0%
Simplified68.9%
Taylor expanded in D around 0 52.1%
times-frac52.3%
*-commutative52.3%
unpow252.3%
associate-/l*61.8%
*-commutative61.8%
unpow261.8%
associate-*r*66.6%
unpow266.6%
times-frac66.6%
Simplified66.6%
if 5.60000000000000016e34 < d Initial program 69.0%
metadata-eval69.0%
unpow1/269.0%
metadata-eval69.0%
unpow1/269.0%
*-commutative69.0%
associate-*l*69.0%
times-frac69.0%
metadata-eval69.0%
Simplified69.0%
Taylor expanded in d around inf 63.0%
*-un-lft-identity63.0%
associate-/r*63.7%
Applied egg-rr63.7%
*-lft-identity63.7%
associate-/l/63.0%
unpow-163.0%
sqr-pow63.0%
rem-sqrt-square63.0%
metadata-eval63.0%
sqr-pow62.7%
fabs-sqr62.7%
sqr-pow63.0%
Simplified63.0%
unpow-prod-down77.0%
Applied egg-rr77.0%
Final simplification65.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 (* 0.25 (* (/ D (/ l D)) (* (/ M d) (/ (* h M) d)))))))
(if (<= d -2.9e-273)
(* (* d (sqrt (/ 1.0 (* l h)))) (+ -1.0 t_0))
(if (<= d 4.2e-138)
(* -0.125 (* (sqrt (/ h (pow l 3.0))) (* D (* M (* M (/ D d))))))
(if (<= d 6.2e+33)
(* (- 1.0 t_0) (sqrt (/ d (/ h (/ d l)))))
(* d (* (pow h -0.5) (pow l -0.5))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
double tmp;
if (d <= -2.9e-273) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else if (d <= 4.2e-138) {
tmp = -0.125 * (sqrt((h / pow(l, 3.0))) * (D * (M * (M * (D / d)))));
} else if (d <= 6.2e+33) {
tmp = (1.0 - t_0) * sqrt((d / (h / (d / l))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (0.25d0 * ((d_1 / (l / d_1)) * ((m / d) * ((h * m) / d))))
if (d <= (-2.9d-273)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + t_0)
else if (d <= 4.2d-138) then
tmp = (-0.125d0) * (sqrt((h / (l ** 3.0d0))) * (d_1 * (m * (m * (d_1 / d)))))
else if (d <= 6.2d+33) then
tmp = (1.0d0 - t_0) * sqrt((d / (h / (d / l))))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
double tmp;
if (d <= -2.9e-273) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else if (d <= 4.2e-138) {
tmp = -0.125 * (Math.sqrt((h / Math.pow(l, 3.0))) * (D * (M * (M * (D / d)))));
} else if (d <= 6.2e+33) {
tmp = (1.0 - t_0) * Math.sqrt((d / (h / (d / l))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d)))) tmp = 0 if d <= -2.9e-273: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0) elif d <= 4.2e-138: tmp = -0.125 * (math.sqrt((h / math.pow(l, 3.0))) * (D * (M * (M * (D / d))))) elif d <= 6.2e+33: tmp = (1.0 - t_0) * math.sqrt((d / (h / (d / l)))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.5 * Float64(0.25 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M / d) * Float64(Float64(h * M) / d))))) tmp = 0.0 if (d <= -2.9e-273) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + t_0)); elseif (d <= 4.2e-138) tmp = Float64(-0.125 * Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(D * Float64(M * Float64(M * Float64(D / d)))))); elseif (d <= 6.2e+33) tmp = Float64(Float64(1.0 - t_0) * sqrt(Float64(d / Float64(h / Float64(d / l))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
tmp = 0.0;
if (d <= -2.9e-273)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
elseif (d <= 4.2e-138)
tmp = -0.125 * (sqrt((h / (l ^ 3.0))) * (D * (M * (M * (D / d)))));
elseif (d <= 6.2e+33)
tmp = (1.0 - t_0) * sqrt((d / (h / (d / l))));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(0.5 * N[(0.25 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.9e-273], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.2e-138], N[(-0.125 * N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(D * N[(M * N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.2e+33], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[Sqrt[N[(d / N[(h / N[(d / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{M}{d} \cdot \frac{h \cdot M}{d}\right)\right)\right)\\
\mathbf{if}\;d \leq -2.9 \cdot 10^{-273}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + t_0\right)\\
\mathbf{elif}\;d \leq 4.2 \cdot 10^{-138}:\\
\;\;\;\;-0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(D \cdot \left(M \cdot \left(M \cdot \frac{D}{d}\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq 6.2 \cdot 10^{+33}:\\
\;\;\;\;\left(1 - t_0\right) \cdot \sqrt{\frac{d}{\frac{h}{\frac{d}{\ell}}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -2.89999999999999986e-273Initial program 61.1%
metadata-eval61.1%
unpow1/261.1%
metadata-eval61.1%
unpow1/261.1%
*-commutative61.1%
associate-*l*61.1%
times-frac61.1%
metadata-eval61.1%
Simplified61.1%
expm1-log1p-u37.8%
expm1-udef26.2%
Applied egg-rr20.1%
expm1-def30.0%
expm1-log1p51.7%
sub-neg51.7%
+-commutative51.7%
associate-*l/50.2%
associate-/l*51.0%
+-commutative51.0%
sub-neg51.0%
associate-/l*51.0%
associate-*r/51.0%
associate-*l/51.0%
associate-/l*55.3%
associate-*r/51.0%
Simplified50.2%
Taylor expanded in d around -inf 68.1%
associate-*r*68.1%
mul-1-neg68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in D around 0 48.1%
times-frac29.3%
*-commutative29.3%
unpow229.3%
associate-/l*31.8%
*-commutative31.8%
unpow231.8%
associate-*r*33.5%
unpow233.5%
times-frac45.2%
Simplified64.7%
if -2.89999999999999986e-273 < d < 4.19999999999999972e-138Initial program 40.8%
metadata-eval40.8%
unpow1/240.8%
metadata-eval40.8%
unpow1/240.8%
*-commutative40.8%
associate-*l*40.8%
times-frac40.7%
metadata-eval40.7%
Simplified40.7%
expm1-log1p-u18.9%
expm1-udef14.4%
Applied egg-rr14.4%
expm1-def14.4%
expm1-log1p29.0%
sub-neg29.0%
+-commutative29.0%
associate-*l/26.6%
associate-/l*29.0%
+-commutative29.0%
sub-neg29.0%
associate-/l*29.0%
associate-*r/29.0%
associate-*l/29.0%
associate-/l*28.9%
associate-*r/29.0%
Simplified29.2%
Taylor expanded in d around 0 46.0%
associate-/l*45.8%
associate-/r/45.2%
unpow245.2%
associate-*r/49.9%
unpow249.9%
Simplified49.9%
Taylor expanded in D around 0 46.0%
unpow246.0%
associate-*l*50.8%
associate-*r/50.8%
associate-*l/50.4%
*-commutative50.4%
unpow250.4%
associate-*l*52.9%
Simplified52.9%
if 4.19999999999999972e-138 < d < 6.2e33Initial program 82.4%
metadata-eval82.4%
unpow1/282.4%
metadata-eval82.4%
unpow1/282.4%
*-commutative82.4%
associate-*l*82.4%
times-frac82.4%
metadata-eval82.4%
Simplified82.4%
expm1-log1p-u23.3%
expm1-udef17.7%
Applied egg-rr17.7%
expm1-def23.3%
expm1-log1p74.8%
sub-neg74.8%
+-commutative74.8%
associate-*l/75.1%
associate-/l*69.0%
+-commutative69.0%
sub-neg69.0%
associate-/l*69.0%
associate-*r/69.0%
associate-*l/69.0%
associate-/l*74.1%
associate-*r/69.0%
Simplified68.9%
Taylor expanded in D around 0 52.1%
times-frac52.3%
*-commutative52.3%
unpow252.3%
associate-/l*61.8%
*-commutative61.8%
unpow261.8%
associate-*r*66.6%
unpow266.6%
times-frac66.6%
Simplified66.6%
if 6.2e33 < d Initial program 69.0%
metadata-eval69.0%
unpow1/269.0%
metadata-eval69.0%
unpow1/269.0%
*-commutative69.0%
associate-*l*69.0%
times-frac69.0%
metadata-eval69.0%
Simplified69.0%
Taylor expanded in d around inf 63.0%
*-un-lft-identity63.0%
associate-/r*63.7%
Applied egg-rr63.7%
*-lft-identity63.7%
associate-/l/63.0%
unpow-163.0%
sqr-pow63.0%
rem-sqrt-square63.0%
metadata-eval63.0%
sqr-pow62.7%
fabs-sqr62.7%
sqr-pow63.0%
Simplified63.0%
unpow-prod-down77.0%
Applied egg-rr77.0%
Final simplification65.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 (* 0.25 (* (/ D (/ l D)) (* (/ M d) (/ (* h M) d)))))))
(if (<= d -2.9e-273)
(* (* d (sqrt (/ 1.0 (* l h)))) (+ -1.0 t_0))
(if (<= d 2.05e-81)
(* -0.125 (* (* (* M M) (* D (/ D d))) (/ (sqrt h) (pow l 1.5))))
(if (<= d 5.2e+34)
(* (- 1.0 t_0) (sqrt (/ d (/ h (/ d l)))))
(* d (* (pow h -0.5) (pow l -0.5))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
double tmp;
if (d <= -2.9e-273) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else if (d <= 2.05e-81) {
tmp = -0.125 * (((M * M) * (D * (D / d))) * (sqrt(h) / pow(l, 1.5)));
} else if (d <= 5.2e+34) {
tmp = (1.0 - t_0) * sqrt((d / (h / (d / l))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (0.25d0 * ((d_1 / (l / d_1)) * ((m / d) * ((h * m) / d))))
if (d <= (-2.9d-273)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + t_0)
else if (d <= 2.05d-81) then
tmp = (-0.125d0) * (((m * m) * (d_1 * (d_1 / d))) * (sqrt(h) / (l ** 1.5d0)))
else if (d <= 5.2d+34) then
tmp = (1.0d0 - t_0) * sqrt((d / (h / (d / l))))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
double tmp;
if (d <= -2.9e-273) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else if (d <= 2.05e-81) {
tmp = -0.125 * (((M * M) * (D * (D / d))) * (Math.sqrt(h) / Math.pow(l, 1.5)));
} else if (d <= 5.2e+34) {
tmp = (1.0 - t_0) * Math.sqrt((d / (h / (d / l))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d)))) tmp = 0 if d <= -2.9e-273: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0) elif d <= 2.05e-81: tmp = -0.125 * (((M * M) * (D * (D / d))) * (math.sqrt(h) / math.pow(l, 1.5))) elif d <= 5.2e+34: tmp = (1.0 - t_0) * math.sqrt((d / (h / (d / l)))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.5 * Float64(0.25 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M / d) * Float64(Float64(h * M) / d))))) tmp = 0.0 if (d <= -2.9e-273) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + t_0)); elseif (d <= 2.05e-81) tmp = Float64(-0.125 * Float64(Float64(Float64(M * M) * Float64(D * Float64(D / d))) * Float64(sqrt(h) / (l ^ 1.5)))); elseif (d <= 5.2e+34) tmp = Float64(Float64(1.0 - t_0) * sqrt(Float64(d / Float64(h / Float64(d / l))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
tmp = 0.0;
if (d <= -2.9e-273)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
elseif (d <= 2.05e-81)
tmp = -0.125 * (((M * M) * (D * (D / d))) * (sqrt(h) / (l ^ 1.5)));
elseif (d <= 5.2e+34)
tmp = (1.0 - t_0) * sqrt((d / (h / (d / l))));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(0.5 * N[(0.25 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.9e-273], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.05e-81], N[(-0.125 * N[(N[(N[(M * M), $MachinePrecision] * N[(D * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.2e+34], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[Sqrt[N[(d / N[(h / N[(d / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{M}{d} \cdot \frac{h \cdot M}{d}\right)\right)\right)\\
\mathbf{if}\;d \leq -2.9 \cdot 10^{-273}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + t_0\right)\\
\mathbf{elif}\;d \leq 2.05 \cdot 10^{-81}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(M \cdot M\right) \cdot \left(D \cdot \frac{D}{d}\right)\right) \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\
\mathbf{elif}\;d \leq 5.2 \cdot 10^{+34}:\\
\;\;\;\;\left(1 - t_0\right) \cdot \sqrt{\frac{d}{\frac{h}{\frac{d}{\ell}}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -2.89999999999999986e-273Initial program 61.1%
metadata-eval61.1%
unpow1/261.1%
metadata-eval61.1%
unpow1/261.1%
*-commutative61.1%
associate-*l*61.1%
times-frac61.1%
metadata-eval61.1%
Simplified61.1%
expm1-log1p-u37.8%
expm1-udef26.2%
Applied egg-rr20.1%
expm1-def30.0%
expm1-log1p51.7%
sub-neg51.7%
+-commutative51.7%
associate-*l/50.2%
associate-/l*51.0%
+-commutative51.0%
sub-neg51.0%
associate-/l*51.0%
associate-*r/51.0%
associate-*l/51.0%
associate-/l*55.3%
associate-*r/51.0%
Simplified50.2%
Taylor expanded in d around -inf 68.1%
associate-*r*68.1%
mul-1-neg68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in D around 0 48.1%
times-frac29.3%
*-commutative29.3%
unpow229.3%
associate-/l*31.8%
*-commutative31.8%
unpow231.8%
associate-*r*33.5%
unpow233.5%
times-frac45.2%
Simplified64.7%
if -2.89999999999999986e-273 < d < 2.04999999999999992e-81Initial program 45.2%
metadata-eval45.2%
unpow1/245.2%
metadata-eval45.2%
unpow1/245.2%
*-commutative45.2%
associate-*l*45.2%
times-frac45.0%
metadata-eval45.0%
Simplified45.0%
expm1-log1p-u18.1%
expm1-udef14.3%
Applied egg-rr14.3%
expm1-def14.3%
expm1-log1p33.0%
sub-neg33.0%
+-commutative33.0%
associate-*l/31.0%
associate-/l*33.0%
+-commutative33.0%
sub-neg33.0%
associate-/l*33.0%
associate-*r/33.0%
associate-*l/33.0%
associate-/l*32.9%
associate-*r/33.0%
Simplified33.1%
Taylor expanded in d around 0 43.7%
associate-/l*43.4%
associate-/r/43.0%
unpow243.0%
associate-*r/47.1%
unpow247.1%
Simplified47.1%
sqrt-div53.1%
Applied egg-rr53.1%
sqr-pow53.1%
rem-sqrt-square57.3%
sqr-pow57.3%
fabs-sqr57.3%
sqr-pow57.3%
metadata-eval57.3%
Simplified57.3%
if 2.04999999999999992e-81 < d < 5.19999999999999995e34Initial program 84.7%
metadata-eval84.7%
unpow1/284.7%
metadata-eval84.7%
unpow1/284.7%
*-commutative84.7%
associate-*l*84.7%
times-frac84.7%
metadata-eval84.7%
Simplified84.7%
expm1-log1p-u25.4%
expm1-udef18.7%
Applied egg-rr18.7%
expm1-def25.4%
expm1-log1p78.6%
sub-neg78.6%
+-commutative78.6%
associate-*l/78.9%
associate-/l*71.5%
+-commutative71.5%
sub-neg71.5%
associate-/l*71.6%
associate-*r/71.6%
associate-*l/71.6%
associate-/l*77.7%
associate-*r/71.5%
Simplified71.5%
Taylor expanded in D around 0 56.8%
times-frac57.1%
*-commutative57.1%
unpow257.1%
associate-/l*68.6%
*-commutative68.6%
unpow268.6%
associate-*r*71.5%
unpow271.5%
times-frac71.5%
Simplified71.5%
if 5.19999999999999995e34 < d Initial program 69.0%
metadata-eval69.0%
unpow1/269.0%
metadata-eval69.0%
unpow1/269.0%
*-commutative69.0%
associate-*l*69.0%
times-frac69.0%
metadata-eval69.0%
Simplified69.0%
Taylor expanded in d around inf 63.0%
*-un-lft-identity63.0%
associate-/r*63.7%
Applied egg-rr63.7%
*-lft-identity63.7%
associate-/l/63.0%
unpow-163.0%
sqr-pow63.0%
rem-sqrt-square63.0%
metadata-eval63.0%
sqr-pow62.7%
fabs-sqr62.7%
sqr-pow63.0%
Simplified63.0%
unpow-prod-down77.0%
Applied egg-rr77.0%
Final simplification66.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 (* 0.25 (* (/ D (/ l D)) (* (/ M d) (/ (* h M) d)))))))
(if (<= d -2.9e-273)
(* (* d (sqrt (/ 1.0 (* l h)))) (+ -1.0 t_0))
(if (or (<= d 1.05e-119) (not (<= d 1.9e+34)))
(* d (* (pow h -0.5) (pow l -0.5)))
(* (- 1.0 t_0) (sqrt (/ d (/ h (/ d l)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
double tmp;
if (d <= -2.9e-273) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else if ((d <= 1.05e-119) || !(d <= 1.9e+34)) {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
} else {
tmp = (1.0 - t_0) * sqrt((d / (h / (d / l))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (0.25d0 * ((d_1 / (l / d_1)) * ((m / d) * ((h * m) / d))))
if (d <= (-2.9d-273)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + t_0)
else if ((d <= 1.05d-119) .or. (.not. (d <= 1.9d+34))) then
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
else
tmp = (1.0d0 - t_0) * sqrt((d / (h / (d / l))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
double tmp;
if (d <= -2.9e-273) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else if ((d <= 1.05e-119) || !(d <= 1.9e+34)) {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
} else {
tmp = (1.0 - t_0) * Math.sqrt((d / (h / (d / l))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d)))) tmp = 0 if d <= -2.9e-273: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0) elif (d <= 1.05e-119) or not (d <= 1.9e+34): tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) else: tmp = (1.0 - t_0) * math.sqrt((d / (h / (d / l)))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.5 * Float64(0.25 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M / d) * Float64(Float64(h * M) / d))))) tmp = 0.0 if (d <= -2.9e-273) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + t_0)); elseif ((d <= 1.05e-119) || !(d <= 1.9e+34)) tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); else tmp = Float64(Float64(1.0 - t_0) * sqrt(Float64(d / Float64(h / Float64(d / l))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
tmp = 0.0;
if (d <= -2.9e-273)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
elseif ((d <= 1.05e-119) || ~((d <= 1.9e+34)))
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
else
tmp = (1.0 - t_0) * sqrt((d / (h / (d / l))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(0.5 * N[(0.25 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.9e-273], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 1.05e-119], N[Not[LessEqual[d, 1.9e+34]], $MachinePrecision]], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[Sqrt[N[(d / N[(h / N[(d / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{M}{d} \cdot \frac{h \cdot M}{d}\right)\right)\right)\\
\mathbf{if}\;d \leq -2.9 \cdot 10^{-273}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + t_0\right)\\
\mathbf{elif}\;d \leq 1.05 \cdot 10^{-119} \lor \neg \left(d \leq 1.9 \cdot 10^{+34}\right):\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t_0\right) \cdot \sqrt{\frac{d}{\frac{h}{\frac{d}{\ell}}}}\\
\end{array}
\end{array}
if d < -2.89999999999999986e-273Initial program 61.1%
metadata-eval61.1%
unpow1/261.1%
metadata-eval61.1%
unpow1/261.1%
*-commutative61.1%
associate-*l*61.1%
times-frac61.1%
metadata-eval61.1%
Simplified61.1%
expm1-log1p-u37.8%
expm1-udef26.2%
Applied egg-rr20.1%
expm1-def30.0%
expm1-log1p51.7%
sub-neg51.7%
+-commutative51.7%
associate-*l/50.2%
associate-/l*51.0%
+-commutative51.0%
sub-neg51.0%
associate-/l*51.0%
associate-*r/51.0%
associate-*l/51.0%
associate-/l*55.3%
associate-*r/51.0%
Simplified50.2%
Taylor expanded in d around -inf 68.1%
associate-*r*68.1%
mul-1-neg68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in D around 0 48.1%
times-frac29.3%
*-commutative29.3%
unpow229.3%
associate-/l*31.8%
*-commutative31.8%
unpow231.8%
associate-*r*33.5%
unpow233.5%
times-frac45.2%
Simplified64.7%
if -2.89999999999999986e-273 < d < 1.05e-119 or 1.9000000000000001e34 < d Initial program 55.4%
metadata-eval55.4%
unpow1/255.4%
metadata-eval55.4%
unpow1/255.4%
*-commutative55.4%
associate-*l*55.4%
times-frac55.3%
metadata-eval55.3%
Simplified55.3%
Taylor expanded in d around inf 48.0%
*-un-lft-identity48.0%
associate-/r*48.4%
Applied egg-rr48.4%
*-lft-identity48.4%
associate-/l/48.0%
unpow-148.0%
sqr-pow48.0%
rem-sqrt-square48.0%
metadata-eval48.0%
sqr-pow47.8%
fabs-sqr47.8%
sqr-pow48.0%
Simplified48.0%
unpow-prod-down57.1%
Applied egg-rr57.1%
if 1.05e-119 < d < 1.9000000000000001e34Initial program 86.7%
metadata-eval86.7%
unpow1/286.7%
metadata-eval86.7%
unpow1/286.7%
*-commutative86.7%
associate-*l*86.7%
times-frac86.7%
metadata-eval86.7%
Simplified86.7%
expm1-log1p-u24.5%
expm1-udef18.7%
Applied egg-rr18.7%
expm1-def24.5%
expm1-log1p78.7%
sub-neg78.7%
+-commutative78.7%
associate-*l/79.0%
associate-/l*72.6%
+-commutative72.6%
sub-neg72.6%
associate-/l*72.7%
associate-*r/72.7%
associate-*l/72.7%
associate-/l*78.0%
associate-*r/72.6%
Simplified72.6%
Taylor expanded in D around 0 54.7%
times-frac55.0%
*-commutative55.0%
unpow255.0%
associate-/l*64.9%
*-commutative64.9%
unpow264.9%
associate-*r*70.0%
unpow270.0%
times-frac69.9%
Simplified69.9%
Final simplification62.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
(*
(- 1.0 (* 0.5 (* 0.25 (* (/ D (/ l D)) (* (/ M d) (/ (* h M) d))))))
(sqrt (/ d (/ h (/ d l))))))
(t_1 (* d (- (sqrt (/ (/ 1.0 h) l))))))
(if (<= d -1.4e+115)
t_1
(if (<= d -3e-138)
t_0
(if (<= d 1.35e-278)
t_1
(if (or (<= d 1.05e-119) (not (<= d 3.2e+151)))
(* d (pow (* l h) -0.5))
t_0))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (1.0 - (0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d)))))) * sqrt((d / (h / (d / l))));
double t_1 = d * -sqrt(((1.0 / h) / l));
double tmp;
if (d <= -1.4e+115) {
tmp = t_1;
} else if (d <= -3e-138) {
tmp = t_0;
} else if (d <= 1.35e-278) {
tmp = t_1;
} else if ((d <= 1.05e-119) || !(d <= 3.2e+151)) {
tmp = d * pow((l * h), -0.5);
} 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) :: t_1
real(8) :: tmp
t_0 = (1.0d0 - (0.5d0 * (0.25d0 * ((d_1 / (l / d_1)) * ((m / d) * ((h * m) / d)))))) * sqrt((d / (h / (d / l))))
t_1 = d * -sqrt(((1.0d0 / h) / l))
if (d <= (-1.4d+115)) then
tmp = t_1
else if (d <= (-3d-138)) then
tmp = t_0
else if (d <= 1.35d-278) then
tmp = t_1
else if ((d <= 1.05d-119) .or. (.not. (d <= 3.2d+151))) then
tmp = d * ((l * h) ** (-0.5d0))
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 = (1.0 - (0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d)))))) * Math.sqrt((d / (h / (d / l))));
double t_1 = d * -Math.sqrt(((1.0 / h) / l));
double tmp;
if (d <= -1.4e+115) {
tmp = t_1;
} else if (d <= -3e-138) {
tmp = t_0;
} else if (d <= 1.35e-278) {
tmp = t_1;
} else if ((d <= 1.05e-119) || !(d <= 3.2e+151)) {
tmp = d * Math.pow((l * h), -0.5);
} else {
tmp = t_0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = (1.0 - (0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d)))))) * math.sqrt((d / (h / (d / l)))) t_1 = d * -math.sqrt(((1.0 / h) / l)) tmp = 0 if d <= -1.4e+115: tmp = t_1 elif d <= -3e-138: tmp = t_0 elif d <= 1.35e-278: tmp = t_1 elif (d <= 1.05e-119) or not (d <= 3.2e+151): tmp = d * math.pow((l * h), -0.5) else: tmp = t_0 return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M / d) * Float64(Float64(h * M) / d)))))) * sqrt(Float64(d / Float64(h / Float64(d / l))))) t_1 = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))) tmp = 0.0 if (d <= -1.4e+115) tmp = t_1; elseif (d <= -3e-138) tmp = t_0; elseif (d <= 1.35e-278) tmp = t_1; elseif ((d <= 1.05e-119) || !(d <= 3.2e+151)) tmp = Float64(d * (Float64(l * h) ^ -0.5)); 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 = (1.0 - (0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d)))))) * sqrt((d / (h / (d / l))));
t_1 = d * -sqrt(((1.0 / h) / l));
tmp = 0.0;
if (d <= -1.4e+115)
tmp = t_1;
elseif (d <= -3e-138)
tmp = t_0;
elseif (d <= 1.35e-278)
tmp = t_1;
elseif ((d <= 1.05e-119) || ~((d <= 3.2e+151)))
tmp = d * ((l * h) ^ -0.5);
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[(1.0 - N[(0.5 * N[(0.25 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / N[(h / N[(d / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -1.4e+115], t$95$1, If[LessEqual[d, -3e-138], t$95$0, If[LessEqual[d, 1.35e-278], t$95$1, If[Or[LessEqual[d, 1.05e-119], N[Not[LessEqual[d, 3.2e+151]], $MachinePrecision]], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{M}{d} \cdot \frac{h \cdot M}{d}\right)\right)\right)\right) \cdot \sqrt{\frac{d}{\frac{h}{\frac{d}{\ell}}}}\\
t_1 := d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{if}\;d \leq -1.4 \cdot 10^{+115}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -3 \cdot 10^{-138}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.35 \cdot 10^{-278}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq 1.05 \cdot 10^{-119} \lor \neg \left(d \leq 3.2 \cdot 10^{+151}\right):\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d < -1.4e115 or -3.0000000000000001e-138 < d < 1.3500000000000001e-278Initial program 48.2%
metadata-eval48.2%
unpow1/248.2%
metadata-eval48.2%
unpow1/248.2%
*-commutative48.2%
associate-*l*48.2%
times-frac48.4%
metadata-eval48.4%
Simplified48.4%
expm1-log1p-u29.5%
expm1-udef25.4%
Applied egg-rr17.2%
expm1-def21.3%
expm1-log1p37.6%
sub-neg37.6%
+-commutative37.6%
associate-*l/34.8%
associate-/l*36.2%
+-commutative36.2%
sub-neg36.2%
associate-/l*36.2%
associate-*r/36.2%
associate-*l/36.2%
associate-/l*35.0%
associate-*r/36.2%
Simplified36.1%
associate-*r/66.0%
div-inv66.0%
metadata-eval66.0%
Applied egg-rr34.9%
Taylor expanded in d around -inf 46.7%
mul-1-neg46.7%
*-commutative46.7%
distribute-rgt-neg-in46.7%
*-commutative46.7%
associate-/r*46.7%
Simplified46.7%
if -1.4e115 < d < -3.0000000000000001e-138 or 1.05e-119 < d < 3.19999999999999994e151Initial program 75.5%
metadata-eval75.5%
unpow1/275.5%
metadata-eval75.5%
unpow1/275.5%
*-commutative75.5%
associate-*l*75.5%
times-frac75.4%
metadata-eval75.4%
Simplified75.4%
expm1-log1p-u36.8%
expm1-udef23.8%
Applied egg-rr18.8%
expm1-def30.1%
expm1-log1p64.7%
sub-neg64.7%
+-commutative64.7%
associate-*l/66.6%
associate-/l*65.3%
+-commutative65.3%
sub-neg65.3%
associate-/l*65.3%
associate-*r/65.4%
associate-*l/65.4%
associate-/l*72.2%
associate-*r/65.3%
Simplified64.5%
Taylor expanded in D around 0 50.2%
times-frac52.0%
*-commutative52.0%
unpow252.0%
associate-/l*56.1%
*-commutative56.1%
unpow256.1%
associate-*r*57.8%
unpow257.8%
times-frac64.5%
Simplified64.5%
if 1.3500000000000001e-278 < d < 1.05e-119 or 3.19999999999999994e151 < d Initial program 55.8%
metadata-eval55.8%
unpow1/255.8%
metadata-eval55.8%
unpow1/255.8%
*-commutative55.8%
associate-*l*55.8%
times-frac55.7%
metadata-eval55.7%
Simplified55.7%
Taylor expanded in d around inf 55.2%
*-un-lft-identity55.2%
associate-/r*55.1%
Applied egg-rr55.1%
*-lft-identity55.1%
associate-/l/55.2%
unpow-155.2%
sqr-pow55.2%
rem-sqrt-square55.2%
metadata-eval55.2%
sqr-pow54.9%
fabs-sqr54.9%
sqr-pow55.2%
Simplified55.2%
Final simplification57.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 (* 0.5 (* 0.25 (* (/ D (/ l D)) (* (/ M d) (/ (* h M) d))))))
(t_1 (* d (pow (* l h) -0.5))))
(if (<= d -2.9e-273)
(* t_1 (+ -1.0 t_0))
(if (or (<= d 1.05e-119) (not (<= d 4.9e+148)))
t_1
(* (- 1.0 t_0) (sqrt (/ d (/ h (/ d l)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
double t_1 = d * pow((l * h), -0.5);
double tmp;
if (d <= -2.9e-273) {
tmp = t_1 * (-1.0 + t_0);
} else if ((d <= 1.05e-119) || !(d <= 4.9e+148)) {
tmp = t_1;
} else {
tmp = (1.0 - t_0) * sqrt((d / (h / (d / l))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (0.25d0 * ((d_1 / (l / d_1)) * ((m / d) * ((h * m) / d))))
t_1 = d * ((l * h) ** (-0.5d0))
if (d <= (-2.9d-273)) then
tmp = t_1 * ((-1.0d0) + t_0)
else if ((d <= 1.05d-119) .or. (.not. (d <= 4.9d+148))) then
tmp = t_1
else
tmp = (1.0d0 - t_0) * sqrt((d / (h / (d / l))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
double t_1 = d * Math.pow((l * h), -0.5);
double tmp;
if (d <= -2.9e-273) {
tmp = t_1 * (-1.0 + t_0);
} else if ((d <= 1.05e-119) || !(d <= 4.9e+148)) {
tmp = t_1;
} else {
tmp = (1.0 - t_0) * Math.sqrt((d / (h / (d / l))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d)))) t_1 = d * math.pow((l * h), -0.5) tmp = 0 if d <= -2.9e-273: tmp = t_1 * (-1.0 + t_0) elif (d <= 1.05e-119) or not (d <= 4.9e+148): tmp = t_1 else: tmp = (1.0 - t_0) * math.sqrt((d / (h / (d / l)))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.5 * Float64(0.25 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M / d) * Float64(Float64(h * M) / d))))) t_1 = Float64(d * (Float64(l * h) ^ -0.5)) tmp = 0.0 if (d <= -2.9e-273) tmp = Float64(t_1 * Float64(-1.0 + t_0)); elseif ((d <= 1.05e-119) || !(d <= 4.9e+148)) tmp = t_1; else tmp = Float64(Float64(1.0 - t_0) * sqrt(Float64(d / Float64(h / Float64(d / l))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
t_1 = d * ((l * h) ^ -0.5);
tmp = 0.0;
if (d <= -2.9e-273)
tmp = t_1 * (-1.0 + t_0);
elseif ((d <= 1.05e-119) || ~((d <= 4.9e+148)))
tmp = t_1;
else
tmp = (1.0 - t_0) * sqrt((d / (h / (d / l))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(0.5 * N[(0.25 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.9e-273], N[(t$95$1 * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 1.05e-119], N[Not[LessEqual[d, 4.9e+148]], $MachinePrecision]], t$95$1, N[(N[(1.0 - t$95$0), $MachinePrecision] * N[Sqrt[N[(d / N[(h / N[(d / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{M}{d} \cdot \frac{h \cdot M}{d}\right)\right)\right)\\
t_1 := d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;d \leq -2.9 \cdot 10^{-273}:\\
\;\;\;\;t_1 \cdot \left(-1 + t_0\right)\\
\mathbf{elif}\;d \leq 1.05 \cdot 10^{-119} \lor \neg \left(d \leq 4.9 \cdot 10^{+148}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t_0\right) \cdot \sqrt{\frac{d}{\frac{h}{\frac{d}{\ell}}}}\\
\end{array}
\end{array}
if d < -2.89999999999999986e-273Initial program 61.1%
metadata-eval61.1%
unpow1/261.1%
metadata-eval61.1%
unpow1/261.1%
*-commutative61.1%
associate-*l*61.1%
times-frac61.1%
metadata-eval61.1%
Simplified61.1%
expm1-log1p-u37.8%
expm1-udef26.2%
Applied egg-rr20.1%
expm1-def30.0%
expm1-log1p51.7%
sub-neg51.7%
+-commutative51.7%
associate-*l/50.2%
associate-/l*51.0%
+-commutative51.0%
sub-neg51.0%
associate-/l*51.0%
associate-*r/51.0%
associate-*l/51.0%
associate-/l*55.3%
associate-*r/51.0%
Simplified50.2%
Taylor expanded in d around -inf 68.1%
mul-1-neg68.1%
associate-/r*69.0%
distribute-rgt-neg-in69.0%
associate-/l/68.1%
unpow-168.1%
sqr-pow68.1%
rem-sqrt-square68.1%
metadata-eval68.1%
sqr-pow68.0%
fabs-sqr68.0%
sqr-pow68.1%
Simplified68.1%
Taylor expanded in D around 0 48.1%
times-frac29.3%
*-commutative29.3%
unpow229.3%
associate-/l*31.8%
*-commutative31.8%
unpow231.8%
associate-*r*33.5%
unpow233.5%
times-frac45.2%
Simplified64.7%
if -2.89999999999999986e-273 < d < 1.05e-119 or 4.9e148 < d Initial program 52.0%
metadata-eval52.0%
unpow1/252.0%
metadata-eval52.0%
unpow1/252.0%
*-commutative52.0%
associate-*l*52.0%
times-frac51.9%
metadata-eval51.9%
Simplified51.9%
Taylor expanded in d around inf 49.0%
*-un-lft-identity49.0%
associate-/r*49.0%
Applied egg-rr49.0%
*-lft-identity49.0%
associate-/l/49.0%
unpow-149.0%
sqr-pow49.0%
rem-sqrt-square49.0%
metadata-eval49.0%
sqr-pow48.8%
fabs-sqr48.8%
sqr-pow49.0%
Simplified49.0%
if 1.05e-119 < d < 4.9e148Initial program 80.9%
metadata-eval80.9%
unpow1/280.9%
metadata-eval80.9%
unpow1/280.9%
*-commutative80.9%
associate-*l*80.9%
times-frac80.9%
metadata-eval80.9%
Simplified80.9%
expm1-log1p-u31.7%
expm1-udef24.4%
Applied egg-rr16.9%
expm1-def24.2%
expm1-log1p65.8%
sub-neg65.8%
+-commutative65.8%
associate-*l/71.1%
associate-/l*66.8%
+-commutative66.8%
sub-neg66.8%
associate-/l*66.8%
associate-*r/66.8%
associate-*l/66.8%
associate-/l*70.4%
associate-*r/66.8%
Simplified66.7%
Taylor expanded in D around 0 49.6%
times-frac51.5%
*-commutative51.5%
unpow251.5%
associate-/l*58.2%
*-commutative58.2%
unpow258.2%
associate-*r*61.6%
unpow261.6%
times-frac66.7%
Simplified66.7%
Final simplification60.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 (* 0.5 (* 0.25 (* (/ D (/ l D)) (* (/ M d) (/ (* h M) d)))))))
(if (<= d -2.9e-273)
(* (* d (sqrt (/ 1.0 (* l h)))) (+ -1.0 t_0))
(if (or (<= d 1.05e-119) (not (<= d 9.2e+147)))
(* d (pow (* l h) -0.5))
(* (- 1.0 t_0) (sqrt (/ d (/ h (/ d l)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
double tmp;
if (d <= -2.9e-273) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else if ((d <= 1.05e-119) || !(d <= 9.2e+147)) {
tmp = d * pow((l * h), -0.5);
} else {
tmp = (1.0 - t_0) * sqrt((d / (h / (d / l))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (0.25d0 * ((d_1 / (l / d_1)) * ((m / d) * ((h * m) / d))))
if (d <= (-2.9d-273)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + t_0)
else if ((d <= 1.05d-119) .or. (.not. (d <= 9.2d+147))) then
tmp = d * ((l * h) ** (-0.5d0))
else
tmp = (1.0d0 - t_0) * sqrt((d / (h / (d / l))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
double tmp;
if (d <= -2.9e-273) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else if ((d <= 1.05e-119) || !(d <= 9.2e+147)) {
tmp = d * Math.pow((l * h), -0.5);
} else {
tmp = (1.0 - t_0) * Math.sqrt((d / (h / (d / l))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d)))) tmp = 0 if d <= -2.9e-273: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0) elif (d <= 1.05e-119) or not (d <= 9.2e+147): tmp = d * math.pow((l * h), -0.5) else: tmp = (1.0 - t_0) * math.sqrt((d / (h / (d / l)))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.5 * Float64(0.25 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M / d) * Float64(Float64(h * M) / d))))) tmp = 0.0 if (d <= -2.9e-273) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + t_0)); elseif ((d <= 1.05e-119) || !(d <= 9.2e+147)) tmp = Float64(d * (Float64(l * h) ^ -0.5)); else tmp = Float64(Float64(1.0 - t_0) * sqrt(Float64(d / Float64(h / Float64(d / l))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.5 * (0.25 * ((D / (l / D)) * ((M / d) * ((h * M) / d))));
tmp = 0.0;
if (d <= -2.9e-273)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
elseif ((d <= 1.05e-119) || ~((d <= 9.2e+147)))
tmp = d * ((l * h) ^ -0.5);
else
tmp = (1.0 - t_0) * sqrt((d / (h / (d / l))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(0.5 * N[(0.25 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.9e-273], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 1.05e-119], N[Not[LessEqual[d, 9.2e+147]], $MachinePrecision]], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[Sqrt[N[(d / N[(h / N[(d / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{M}{d} \cdot \frac{h \cdot M}{d}\right)\right)\right)\\
\mathbf{if}\;d \leq -2.9 \cdot 10^{-273}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + t_0\right)\\
\mathbf{elif}\;d \leq 1.05 \cdot 10^{-119} \lor \neg \left(d \leq 9.2 \cdot 10^{+147}\right):\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t_0\right) \cdot \sqrt{\frac{d}{\frac{h}{\frac{d}{\ell}}}}\\
\end{array}
\end{array}
if d < -2.89999999999999986e-273Initial program 61.1%
metadata-eval61.1%
unpow1/261.1%
metadata-eval61.1%
unpow1/261.1%
*-commutative61.1%
associate-*l*61.1%
times-frac61.1%
metadata-eval61.1%
Simplified61.1%
expm1-log1p-u37.8%
expm1-udef26.2%
Applied egg-rr20.1%
expm1-def30.0%
expm1-log1p51.7%
sub-neg51.7%
+-commutative51.7%
associate-*l/50.2%
associate-/l*51.0%
+-commutative51.0%
sub-neg51.0%
associate-/l*51.0%
associate-*r/51.0%
associate-*l/51.0%
associate-/l*55.3%
associate-*r/51.0%
Simplified50.2%
Taylor expanded in d around -inf 68.1%
associate-*r*68.1%
mul-1-neg68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in D around 0 48.1%
times-frac29.3%
*-commutative29.3%
unpow229.3%
associate-/l*31.8%
*-commutative31.8%
unpow231.8%
associate-*r*33.5%
unpow233.5%
times-frac45.2%
Simplified64.7%
if -2.89999999999999986e-273 < d < 1.05e-119 or 9.1999999999999997e147 < d Initial program 52.0%
metadata-eval52.0%
unpow1/252.0%
metadata-eval52.0%
unpow1/252.0%
*-commutative52.0%
associate-*l*52.0%
times-frac51.9%
metadata-eval51.9%
Simplified51.9%
Taylor expanded in d around inf 49.0%
*-un-lft-identity49.0%
associate-/r*49.0%
Applied egg-rr49.0%
*-lft-identity49.0%
associate-/l/49.0%
unpow-149.0%
sqr-pow49.0%
rem-sqrt-square49.0%
metadata-eval49.0%
sqr-pow48.8%
fabs-sqr48.8%
sqr-pow49.0%
Simplified49.0%
if 1.05e-119 < d < 9.1999999999999997e147Initial program 80.9%
metadata-eval80.9%
unpow1/280.9%
metadata-eval80.9%
unpow1/280.9%
*-commutative80.9%
associate-*l*80.9%
times-frac80.9%
metadata-eval80.9%
Simplified80.9%
expm1-log1p-u31.7%
expm1-udef24.4%
Applied egg-rr16.9%
expm1-def24.2%
expm1-log1p65.8%
sub-neg65.8%
+-commutative65.8%
associate-*l/71.1%
associate-/l*66.8%
+-commutative66.8%
sub-neg66.8%
associate-/l*66.8%
associate-*r/66.8%
associate-*l/66.8%
associate-/l*70.4%
associate-*r/66.8%
Simplified66.7%
Taylor expanded in D around 0 49.6%
times-frac51.5%
*-commutative51.5%
unpow251.5%
associate-/l*58.2%
*-commutative58.2%
unpow258.2%
associate-*r*61.6%
unpow261.6%
times-frac66.7%
Simplified66.7%
Final simplification60.4%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l 1.1e-194) (* (- d) (sqrt (/ 1.0 (* l h)))) (* d (sqrt (/ (/ 1.0 l) h)))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.1e-194) {
tmp = -d * sqrt((1.0 / (l * h)));
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 1.1d-194) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else
tmp = d * sqrt(((1.0d0 / l) / h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.1e-194) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 1.1e-194: tmp = -d * math.sqrt((1.0 / (l * h))) else: tmp = d * math.sqrt(((1.0 / l) / h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 1.1e-194) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 1.1e-194)
tmp = -d * sqrt((1.0 / (l * h)));
else
tmp = d * sqrt(((1.0 / l) / h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 1.1e-194], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.1 \cdot 10^{-194}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if l < 1.1000000000000001e-194Initial program 63.1%
metadata-eval63.1%
unpow1/263.1%
metadata-eval63.1%
unpow1/263.1%
*-commutative63.1%
associate-*l*63.1%
times-frac63.1%
metadata-eval63.1%
Simplified63.1%
expm1-log1p-u34.6%
expm1-udef25.2%
Applied egg-rr19.7%
expm1-def27.8%
expm1-log1p54.9%
sub-neg54.9%
+-commutative54.9%
associate-*l/53.0%
associate-/l*53.7%
+-commutative53.7%
sub-neg53.7%
associate-/l*53.6%
associate-*r/53.7%
associate-*l/53.7%
associate-/l*58.5%
associate-*r/53.7%
Simplified53.0%
Taylor expanded in d around -inf 55.3%
associate-*r*55.3%
mul-1-neg55.3%
*-commutative55.3%
Simplified55.3%
Taylor expanded in d around inf 42.2%
associate-*r*42.2%
neg-mul-142.2%
*-commutative42.2%
Simplified42.2%
if 1.1000000000000001e-194 < l Initial program 62.2%
metadata-eval62.2%
unpow1/262.2%
metadata-eval62.2%
unpow1/262.2%
*-commutative62.2%
associate-*l*62.2%
times-frac62.2%
metadata-eval62.2%
Simplified62.2%
expm1-log1p-u35.3%
expm1-udef29.7%
Applied egg-rr22.6%
expm1-def26.5%
expm1-log1p46.0%
sub-neg46.0%
+-commutative46.0%
associate-*l/48.8%
associate-/l*48.3%
+-commutative48.3%
sub-neg48.3%
associate-/l*48.3%
associate-*r/48.3%
associate-*l/48.3%
associate-/l*50.3%
associate-*r/48.3%
Simplified48.3%
associate-*r/5.2%
div-inv5.2%
metadata-eval5.2%
Applied egg-rr50.4%
Taylor expanded in d around inf 45.4%
*-commutative45.4%
associate-/r*45.7%
Simplified45.7%
Final simplification43.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 (/ (/ 1.0 l) h)))) (if (<= l 1.06e-194) (* (- d) t_0) (* d t_0))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((1.0 / l) / h));
double tmp;
if (l <= 1.06e-194) {
tmp = -d * t_0;
} else {
tmp = d * 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(((1.0d0 / l) / h))
if (l <= 1.06d-194) then
tmp = -d * t_0
else
tmp = d * 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(((1.0 / l) / h));
double tmp;
if (l <= 1.06e-194) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((1.0 / l) / h)) tmp = 0 if l <= 1.06e-194: tmp = -d * t_0 else: tmp = d * t_0 return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(Float64(1.0 / l) / h)) tmp = 0.0 if (l <= 1.06e-194) tmp = Float64(Float64(-d) * t_0); else tmp = Float64(d * t_0); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((1.0 / l) / h));
tmp = 0.0;
if (l <= 1.06e-194)
tmp = -d * t_0;
else
tmp = d * 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[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 1.06e-194], N[((-d) * t$95$0), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{if}\;\ell \leq 1.06 \cdot 10^{-194}:\\
\;\;\;\;\left(-d\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot t_0\\
\end{array}
\end{array}
if l < 1.06000000000000002e-194Initial program 63.1%
metadata-eval63.1%
unpow1/263.1%
metadata-eval63.1%
unpow1/263.1%
*-commutative63.1%
associate-*l*63.1%
times-frac63.1%
metadata-eval63.1%
Simplified63.1%
expm1-log1p-u34.6%
expm1-udef25.2%
Applied egg-rr19.7%
expm1-def27.8%
expm1-log1p54.9%
sub-neg54.9%
+-commutative54.9%
associate-*l/53.0%
associate-/l*53.7%
+-commutative53.7%
sub-neg53.7%
associate-/l*53.6%
associate-*r/53.7%
associate-*l/53.7%
associate-/l*58.5%
associate-*r/53.7%
Simplified53.0%
associate-*r/62.6%
div-inv62.6%
metadata-eval62.6%
Applied egg-rr57.8%
Taylor expanded in d around -inf 42.2%
associate-*r*42.2%
neg-mul-142.2%
associate-/r*42.2%
Simplified42.2%
if 1.06000000000000002e-194 < l Initial program 62.2%
metadata-eval62.2%
unpow1/262.2%
metadata-eval62.2%
unpow1/262.2%
*-commutative62.2%
associate-*l*62.2%
times-frac62.2%
metadata-eval62.2%
Simplified62.2%
expm1-log1p-u35.3%
expm1-udef29.7%
Applied egg-rr22.6%
expm1-def26.5%
expm1-log1p46.0%
sub-neg46.0%
+-commutative46.0%
associate-*l/48.8%
associate-/l*48.3%
+-commutative48.3%
sub-neg48.3%
associate-/l*48.3%
associate-*r/48.3%
associate-*l/48.3%
associate-/l*50.3%
associate-*r/48.3%
Simplified48.3%
associate-*r/5.2%
div-inv5.2%
metadata-eval5.2%
Applied egg-rr50.4%
Taylor expanded in d around inf 45.4%
*-commutative45.4%
associate-/r*45.7%
Simplified45.7%
Final simplification43.7%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (sqrt (/ (/ 1.0 h) l))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt(((1.0 / h) / l));
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d * sqrt(((1.0d0 / h) / l))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt(((1.0 / h) / l));
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(((1.0 / h) / l))
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(Float64(1.0 / h) / l))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt(((1.0 / h) / l));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}
\end{array}
Initial program 62.7%
metadata-eval62.7%
unpow1/262.7%
metadata-eval62.7%
unpow1/262.7%
*-commutative62.7%
associate-*l*62.7%
times-frac62.7%
metadata-eval62.7%
Simplified62.7%
expm1-log1p-u34.9%
expm1-udef27.1%
Applied egg-rr20.9%
expm1-def27.2%
expm1-log1p51.2%
sub-neg51.2%
+-commutative51.2%
associate-*l/51.2%
associate-/l*51.4%
+-commutative51.4%
sub-neg51.4%
associate-/l*51.4%
associate-*r/51.4%
associate-*l/51.4%
associate-/l*55.1%
associate-*r/51.4%
Simplified51.0%
associate-*r/38.6%
div-inv38.6%
metadata-eval38.6%
Applied egg-rr54.7%
Taylor expanded in d around inf 25.7%
*-commutative25.7%
*-commutative25.7%
associate-/r*25.8%
Simplified25.8%
Final simplification25.8%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (sqrt (/ (/ 1.0 l) h))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt(((1.0 / l) / h));
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d * sqrt(((1.0d0 / l) / h))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt(((1.0 / l) / h));
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(((1.0 / l) / h))
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt(((1.0 / l) / h));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}
\end{array}
Initial program 62.7%
metadata-eval62.7%
unpow1/262.7%
metadata-eval62.7%
unpow1/262.7%
*-commutative62.7%
associate-*l*62.7%
times-frac62.7%
metadata-eval62.7%
Simplified62.7%
expm1-log1p-u34.9%
expm1-udef27.1%
Applied egg-rr20.9%
expm1-def27.2%
expm1-log1p51.2%
sub-neg51.2%
+-commutative51.2%
associate-*l/51.2%
associate-/l*51.4%
+-commutative51.4%
sub-neg51.4%
associate-/l*51.4%
associate-*r/51.4%
associate-*l/51.4%
associate-/l*55.1%
associate-*r/51.4%
Simplified51.0%
associate-*r/38.6%
div-inv38.6%
metadata-eval38.6%
Applied egg-rr54.7%
Taylor expanded in d around inf 25.7%
*-commutative25.7%
associate-/r*25.8%
Simplified25.8%
Final simplification25.8%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ d (sqrt (* l h))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((l * h));
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d / sqrt((l * h))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((l * h));
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d / math.sqrt((l * h))
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(l * h))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((l * h));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 62.7%
metadata-eval62.7%
unpow1/262.7%
metadata-eval62.7%
unpow1/262.7%
*-commutative62.7%
associate-*l*62.7%
times-frac62.7%
metadata-eval62.7%
Simplified62.7%
Taylor expanded in d around inf 25.7%
sqrt-div25.7%
metadata-eval25.7%
*-commutative25.7%
Applied egg-rr25.7%
associate-*l/25.7%
*-un-lft-identity25.7%
Applied egg-rr25.7%
Final simplification25.7%
herbie shell --seed 2023178
(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)))))