
(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 25 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}
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (- 1.0 (* h (* (/ 0.125 l) (pow (* D (/ M_m d)) 2.0)))))
(t_1 (* (sqrt (/ d l)) t_0))
(t_2 (sqrt (/ d h)))
(t_3 (sqrt (- d)))
(t_4 (* (/ t_3 (sqrt (- h))) t_1)))
(if (<= h -9e+102)
t_4
(if (<= h -5.8e-124)
(*
(/ t_3 (sqrt (- l)))
(* t_2 (+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5)))))
(if (<= h -2e-310)
t_4
(if (<= h 1.5e-198)
(* t_1 (/ (sqrt d) (sqrt h)))
(* t_2 (* t_0 (/ (sqrt d) (sqrt l))))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 - (h * ((0.125 / l) * pow((D * (M_m / d)), 2.0)));
double t_1 = sqrt((d / l)) * t_0;
double t_2 = sqrt((d / h));
double t_3 = sqrt(-d);
double t_4 = (t_3 / sqrt(-h)) * t_1;
double tmp;
if (h <= -9e+102) {
tmp = t_4;
} else if (h <= -5.8e-124) {
tmp = (t_3 / sqrt(-l)) * (t_2 * (1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))));
} else if (h <= -2e-310) {
tmp = t_4;
} else if (h <= 1.5e-198) {
tmp = t_1 * (sqrt(d) / sqrt(h));
} else {
tmp = t_2 * (t_0 * (sqrt(d) / sqrt(l)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = 1.0d0 - (h * ((0.125d0 / l) * ((d_1 * (m_m / d)) ** 2.0d0)))
t_1 = sqrt((d / l)) * t_0
t_2 = sqrt((d / h))
t_3 = sqrt(-d)
t_4 = (t_3 / sqrt(-h)) * t_1
if (h <= (-9d+102)) then
tmp = t_4
else if (h <= (-5.8d-124)) then
tmp = (t_3 / sqrt(-l)) * (t_2 * (1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))))
else if (h <= (-2d-310)) then
tmp = t_4
else if (h <= 1.5d-198) then
tmp = t_1 * (sqrt(d) / sqrt(h))
else
tmp = t_2 * (t_0 * (sqrt(d) / sqrt(l)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 - (h * ((0.125 / l) * Math.pow((D * (M_m / d)), 2.0)));
double t_1 = Math.sqrt((d / l)) * t_0;
double t_2 = Math.sqrt((d / h));
double t_3 = Math.sqrt(-d);
double t_4 = (t_3 / Math.sqrt(-h)) * t_1;
double tmp;
if (h <= -9e+102) {
tmp = t_4;
} else if (h <= -5.8e-124) {
tmp = (t_3 / Math.sqrt(-l)) * (t_2 * (1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))));
} else if (h <= -2e-310) {
tmp = t_4;
} else if (h <= 1.5e-198) {
tmp = t_1 * (Math.sqrt(d) / Math.sqrt(h));
} else {
tmp = t_2 * (t_0 * (Math.sqrt(d) / Math.sqrt(l)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = 1.0 - (h * ((0.125 / l) * math.pow((D * (M_m / d)), 2.0))) t_1 = math.sqrt((d / l)) * t_0 t_2 = math.sqrt((d / h)) t_3 = math.sqrt(-d) t_4 = (t_3 / math.sqrt(-h)) * t_1 tmp = 0 if h <= -9e+102: tmp = t_4 elif h <= -5.8e-124: tmp = (t_3 / math.sqrt(-l)) * (t_2 * (1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5)))) elif h <= -2e-310: tmp = t_4 elif h <= 1.5e-198: tmp = t_1 * (math.sqrt(d) / math.sqrt(h)) else: tmp = t_2 * (t_0 * (math.sqrt(d) / math.sqrt(l))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(D * Float64(M_m / d)) ^ 2.0)))) t_1 = Float64(sqrt(Float64(d / l)) * t_0) t_2 = sqrt(Float64(d / h)) t_3 = sqrt(Float64(-d)) t_4 = Float64(Float64(t_3 / sqrt(Float64(-h))) * t_1) tmp = 0.0 if (h <= -9e+102) tmp = t_4; elseif (h <= -5.8e-124) tmp = Float64(Float64(t_3 / sqrt(Float64(-l))) * Float64(t_2 * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))))); elseif (h <= -2e-310) tmp = t_4; elseif (h <= 1.5e-198) tmp = Float64(t_1 * Float64(sqrt(d) / sqrt(h))); else tmp = Float64(t_2 * Float64(t_0 * Float64(sqrt(d) / sqrt(l)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = 1.0 - (h * ((0.125 / l) * ((D * (M_m / d)) ^ 2.0)));
t_1 = sqrt((d / l)) * t_0;
t_2 = sqrt((d / h));
t_3 = sqrt(-d);
t_4 = (t_3 / sqrt(-h)) * t_1;
tmp = 0.0;
if (h <= -9e+102)
tmp = t_4;
elseif (h <= -5.8e-124)
tmp = (t_3 / sqrt(-l)) * (t_2 * (1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5))));
elseif (h <= -2e-310)
tmp = t_4;
elseif (h <= 1.5e-198)
tmp = t_1 * (sqrt(d) / sqrt(h));
else
tmp = t_2 * (t_0 * (sqrt(d) / sqrt(l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(1.0 - N[(h * N[(N[(0.125 / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$3 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[h, -9e+102], t$95$4, If[LessEqual[h, -5.8e-124], N[(N[(t$95$3 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], t$95$4, If[LessEqual[h, 1.5e-198], N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := 1 - h \cdot \left(\frac{0.125}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\\
t_1 := \sqrt{\frac{d}{\ell}} \cdot t\_0\\
t_2 := \sqrt{\frac{d}{h}}\\
t_3 := \sqrt{-d}\\
t_4 := \frac{t\_3}{\sqrt{-h}} \cdot t\_1\\
\mathbf{if}\;h \leq -9 \cdot 10^{+102}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;h \leq -5.8 \cdot 10^{-124}:\\
\;\;\;\;\frac{t\_3}{\sqrt{-\ell}} \cdot \left(t\_2 \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;h \leq 1.5 \cdot 10^{-198}:\\
\;\;\;\;t\_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if h < -9.00000000000000042e102 or -5.8000000000000004e-124 < h < -1.999999999999994e-310Initial program 49.7%
Simplified50.0%
Taylor expanded in h around -inf 33.1%
associate-*r*33.1%
neg-mul-133.1%
sub-neg33.1%
distribute-lft-in33.1%
Simplified51.6%
frac-2neg51.6%
sqrt-div73.9%
Applied egg-rr73.9%
if -9.00000000000000042e102 < h < -5.8000000000000004e-124Initial program 78.5%
Simplified77.0%
frac-2neg77.0%
sqrt-div84.8%
Applied egg-rr84.8%
if -1.999999999999994e-310 < h < 1.5000000000000001e-198Initial program 72.4%
Simplified72.4%
Taylor expanded in h around -inf 39.9%
associate-*r*39.9%
neg-mul-139.9%
sub-neg39.9%
distribute-lft-in39.9%
Simplified72.4%
sqrt-div98.7%
Applied egg-rr98.7%
if 1.5000000000000001e-198 < h Initial program 61.7%
Simplified61.7%
Taylor expanded in h around -inf 39.0%
associate-*r*39.0%
neg-mul-139.0%
sub-neg39.0%
distribute-lft-in39.0%
Simplified63.8%
sqrt-div80.4%
Applied egg-rr80.4%
Final simplification81.3%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (sqrt (/ d l)))
(t_2
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D M_m) (* d 2.0)) 2.0)))))))
(if (<= t_2 (- INFINITY))
(* t_0 (* t_1 (* -0.125 (pow (* (* D (/ M_m d)) (sqrt (/ h l))) 2.0))))
(if (<= t_2 4e+286)
(*
t_1
(* t_0 (+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* D (* M_m 0.5)) d) 2.0))))))
(/ 1.0 (/ (sqrt (* h l)) d))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double t_2 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D * M_m) / (d * 2.0)), 2.0))));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_0 * (t_1 * (-0.125 * pow(((D * (M_m / d)) * sqrt((h / l))), 2.0)));
} else if (t_2 <= 4e+286) {
tmp = t_1 * (t_0 * (1.0 + ((h / l) * (-0.5 * pow(((D * (M_m * 0.5)) / d), 2.0)))));
} else {
tmp = 1.0 / (sqrt((h * l)) / d);
}
return tmp;
}
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double t_2 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((D * M_m) / (d * 2.0)), 2.0))));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_0 * (t_1 * (-0.125 * Math.pow(((D * (M_m / d)) * Math.sqrt((h / l))), 2.0)));
} else if (t_2 <= 4e+286) {
tmp = t_1 * (t_0 * (1.0 + ((h / l) * (-0.5 * Math.pow(((D * (M_m * 0.5)) / d), 2.0)))));
} else {
tmp = 1.0 / (Math.sqrt((h * l)) / d);
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / h)) t_1 = math.sqrt((d / l)) t_2 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((D * M_m) / (d * 2.0)), 2.0)))) tmp = 0 if t_2 <= -math.inf: tmp = t_0 * (t_1 * (-0.125 * math.pow(((D * (M_m / d)) * math.sqrt((h / l))), 2.0))) elif t_2 <= 4e+286: tmp = t_1 * (t_0 * (1.0 + ((h / l) * (-0.5 * math.pow(((D * (M_m * 0.5)) / d), 2.0))))) else: tmp = 1.0 / (math.sqrt((h * l)) / d) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0))))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(t_0 * Float64(t_1 * Float64(-0.125 * (Float64(Float64(D * Float64(M_m / d)) * sqrt(Float64(h / l))) ^ 2.0)))); elseif (t_2 <= 4e+286) tmp = Float64(t_1 * Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D * Float64(M_m * 0.5)) / d) ^ 2.0)))))); else tmp = Float64(1.0 / Float64(sqrt(Float64(h * l)) / d)); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / h));
t_1 = sqrt((d / l));
t_2 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D * M_m) / (d * 2.0)) ^ 2.0))));
tmp = 0.0;
if (t_2 <= -Inf)
tmp = t_0 * (t_1 * (-0.125 * (((D * (M_m / d)) * sqrt((h / l))) ^ 2.0)));
elseif (t_2 <= 4e+286)
tmp = t_1 * (t_0 * (1.0 + ((h / l) * (-0.5 * (((D * (M_m * 0.5)) / d) ^ 2.0)))));
else
tmp = 1.0 / (sqrt((h * l)) / d);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(t$95$0 * N[(t$95$1 * N[(-0.125 * N[Power[N[(N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+286], N[(t$95$1 * N[(t$95$0 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \left(-0.125 \cdot {\left(\left(D \cdot \frac{M\_m}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+286}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D \cdot \left(M\_m \cdot 0.5\right)}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{h \cdot \ell}}{d}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -inf.0Initial program 86.8%
Simplified86.8%
Taylor expanded in M around inf 60.8%
associate-*r*60.9%
times-frac62.5%
*-commutative62.5%
associate-/l*58.3%
unpow258.3%
unpow258.3%
unpow258.3%
times-frac79.7%
swap-sqr86.8%
unpow286.8%
associate-*r/86.8%
*-commutative86.8%
associate-/l*86.7%
Simplified86.7%
add-sqr-sqrt86.7%
pow286.7%
sqrt-prod86.7%
sqrt-pow193.2%
metadata-eval93.2%
pow193.2%
Applied egg-rr93.2%
if -inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.00000000000000013e286Initial program 86.8%
Simplified84.9%
associate-*r/86.8%
div-inv86.8%
metadata-eval86.8%
Applied egg-rr86.8%
if 4.00000000000000013e286 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 21.0%
Simplified21.2%
Taylor expanded in d around inf 36.8%
add-cube-cbrt36.7%
pow336.6%
Applied egg-rr36.6%
rem-cube-cbrt36.8%
sqrt-div36.7%
metadata-eval36.7%
div-inv36.8%
clear-num36.8%
Applied egg-rr36.8%
Final simplification70.0%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (- 1.0 (* h (* (/ 0.125 l) (pow (* D (/ M_m d)) 2.0)))))
(t_1 (* (sqrt (/ d l)) t_0)))
(if (<= h -2e-310)
(* (/ (sqrt (- d)) (sqrt (- h))) t_1)
(if (<= h 3.6e-198)
(* t_1 (/ (sqrt d) (sqrt h)))
(* (sqrt (/ d h)) (* t_0 (/ (sqrt d) (sqrt l))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 - (h * ((0.125 / l) * pow((D * (M_m / d)), 2.0)));
double t_1 = sqrt((d / l)) * t_0;
double tmp;
if (h <= -2e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * t_1;
} else if (h <= 3.6e-198) {
tmp = t_1 * (sqrt(d) / sqrt(h));
} else {
tmp = sqrt((d / h)) * (t_0 * (sqrt(d) / sqrt(l)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (h * ((0.125d0 / l) * ((d_1 * (m_m / d)) ** 2.0d0)))
t_1 = sqrt((d / l)) * t_0
if (h <= (-2d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_1
else if (h <= 3.6d-198) then
tmp = t_1 * (sqrt(d) / sqrt(h))
else
tmp = sqrt((d / h)) * (t_0 * (sqrt(d) / sqrt(l)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 - (h * ((0.125 / l) * Math.pow((D * (M_m / d)), 2.0)));
double t_1 = Math.sqrt((d / l)) * t_0;
double tmp;
if (h <= -2e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_1;
} else if (h <= 3.6e-198) {
tmp = t_1 * (Math.sqrt(d) / Math.sqrt(h));
} else {
tmp = Math.sqrt((d / h)) * (t_0 * (Math.sqrt(d) / Math.sqrt(l)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = 1.0 - (h * ((0.125 / l) * math.pow((D * (M_m / d)), 2.0))) t_1 = math.sqrt((d / l)) * t_0 tmp = 0 if h <= -2e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_1 elif h <= 3.6e-198: tmp = t_1 * (math.sqrt(d) / math.sqrt(h)) else: tmp = math.sqrt((d / h)) * (t_0 * (math.sqrt(d) / math.sqrt(l))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(D * Float64(M_m / d)) ^ 2.0)))) t_1 = Float64(sqrt(Float64(d / l)) * t_0) tmp = 0.0 if (h <= -2e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_1); elseif (h <= 3.6e-198) tmp = Float64(t_1 * Float64(sqrt(d) / sqrt(h))); else tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(sqrt(d) / sqrt(l)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = 1.0 - (h * ((0.125 / l) * ((D * (M_m / d)) ^ 2.0)));
t_1 = sqrt((d / l)) * t_0;
tmp = 0.0;
if (h <= -2e-310)
tmp = (sqrt(-d) / sqrt(-h)) * t_1;
elseif (h <= 3.6e-198)
tmp = t_1 * (sqrt(d) / sqrt(h));
else
tmp = sqrt((d / h)) * (t_0 * (sqrt(d) / sqrt(l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(1.0 - N[(h * N[(N[(0.125 / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[h, -2e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[h, 3.6e-198], N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := 1 - h \cdot \left(\frac{0.125}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\\
t_1 := \sqrt{\frac{d}{\ell}} \cdot t\_0\\
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_1\\
\mathbf{elif}\;h \leq 3.6 \cdot 10^{-198}:\\
\;\;\;\;t\_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 60.7%
Simplified59.4%
Taylor expanded in h around -inf 38.0%
associate-*r*38.0%
neg-mul-138.0%
sub-neg38.0%
distribute-lft-in38.0%
Simplified60.6%
frac-2neg60.6%
sqrt-div74.4%
Applied egg-rr74.4%
if -1.999999999999994e-310 < h < 3.59999999999999998e-198Initial program 72.4%
Simplified72.4%
Taylor expanded in h around -inf 39.9%
associate-*r*39.9%
neg-mul-139.9%
sub-neg39.9%
distribute-lft-in39.9%
Simplified72.4%
sqrt-div98.7%
Applied egg-rr98.7%
if 3.59999999999999998e-198 < h Initial program 61.7%
Simplified61.7%
Taylor expanded in h around -inf 39.0%
associate-*r*39.0%
neg-mul-139.0%
sub-neg39.0%
distribute-lft-in39.0%
Simplified63.8%
sqrt-div80.4%
Applied egg-rr80.4%
Final simplification79.6%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (- 1.0 (* h (* (/ 0.125 l) (pow (* D (/ M_m d)) 2.0))))))
(if (<= h -2e-310)
(* t_0 (* t_1 (/ (sqrt (- d)) (sqrt (- l)))))
(if (<= h 3.4e-198)
(* (* (sqrt (/ d l)) t_1) (/ (sqrt d) (sqrt h)))
(* t_0 (* t_1 (/ (sqrt d) (sqrt l))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / h));
double t_1 = 1.0 - (h * ((0.125 / l) * pow((D * (M_m / d)), 2.0)));
double tmp;
if (h <= -2e-310) {
tmp = t_0 * (t_1 * (sqrt(-d) / sqrt(-l)));
} else if (h <= 3.4e-198) {
tmp = (sqrt((d / l)) * t_1) * (sqrt(d) / sqrt(h));
} else {
tmp = t_0 * (t_1 * (sqrt(d) / sqrt(l)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = 1.0d0 - (h * ((0.125d0 / l) * ((d_1 * (m_m / d)) ** 2.0d0)))
if (h <= (-2d-310)) then
tmp = t_0 * (t_1 * (sqrt(-d) / sqrt(-l)))
else if (h <= 3.4d-198) then
tmp = (sqrt((d / l)) * t_1) * (sqrt(d) / sqrt(h))
else
tmp = t_0 * (t_1 * (sqrt(d) / sqrt(l)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = 1.0 - (h * ((0.125 / l) * Math.pow((D * (M_m / d)), 2.0)));
double tmp;
if (h <= -2e-310) {
tmp = t_0 * (t_1 * (Math.sqrt(-d) / Math.sqrt(-l)));
} else if (h <= 3.4e-198) {
tmp = (Math.sqrt((d / l)) * t_1) * (Math.sqrt(d) / Math.sqrt(h));
} else {
tmp = t_0 * (t_1 * (Math.sqrt(d) / Math.sqrt(l)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / h)) t_1 = 1.0 - (h * ((0.125 / l) * math.pow((D * (M_m / d)), 2.0))) tmp = 0 if h <= -2e-310: tmp = t_0 * (t_1 * (math.sqrt(-d) / math.sqrt(-l))) elif h <= 3.4e-198: tmp = (math.sqrt((d / l)) * t_1) * (math.sqrt(d) / math.sqrt(h)) else: tmp = t_0 * (t_1 * (math.sqrt(d) / math.sqrt(l))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / h)) t_1 = Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(D * Float64(M_m / d)) ^ 2.0)))) tmp = 0.0 if (h <= -2e-310) tmp = Float64(t_0 * Float64(t_1 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))))); elseif (h <= 3.4e-198) tmp = Float64(Float64(sqrt(Float64(d / l)) * t_1) * Float64(sqrt(d) / sqrt(h))); else tmp = Float64(t_0 * Float64(t_1 * Float64(sqrt(d) / sqrt(l)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / h));
t_1 = 1.0 - (h * ((0.125 / l) * ((D * (M_m / d)) ^ 2.0)));
tmp = 0.0;
if (h <= -2e-310)
tmp = t_0 * (t_1 * (sqrt(-d) / sqrt(-l)));
elseif (h <= 3.4e-198)
tmp = (sqrt((d / l)) * t_1) * (sqrt(d) / sqrt(h));
else
tmp = t_0 * (t_1 * (sqrt(d) / sqrt(l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(h * N[(N[(0.125 / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2e-310], N[(t$95$0 * N[(t$95$1 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 3.4e-198], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := 1 - h \cdot \left(\frac{0.125}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\\
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\
\mathbf{elif}\;h \leq 3.4 \cdot 10^{-198}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_1\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 60.7%
Simplified59.4%
Taylor expanded in h around -inf 38.0%
associate-*r*38.0%
neg-mul-138.0%
sub-neg38.0%
distribute-lft-in38.0%
Simplified60.6%
frac-2neg59.4%
sqrt-div65.6%
Applied egg-rr68.5%
if -1.999999999999994e-310 < h < 3.3999999999999998e-198Initial program 72.4%
Simplified72.4%
Taylor expanded in h around -inf 39.9%
associate-*r*39.9%
neg-mul-139.9%
sub-neg39.9%
distribute-lft-in39.9%
Simplified72.4%
sqrt-div98.7%
Applied egg-rr98.7%
if 3.3999999999999998e-198 < h Initial program 61.7%
Simplified61.7%
Taylor expanded in h around -inf 39.0%
associate-*r*39.0%
neg-mul-139.0%
sub-neg39.0%
distribute-lft-in39.0%
Simplified63.8%
sqrt-div80.4%
Applied egg-rr80.4%
Final simplification76.8%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (- 1.0 (* h (* (/ 0.125 l) (pow (* D (/ M_m d)) 2.0)))))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (/ d h))))
(if (<= h -2e-310)
(*
(* t_1 t_2)
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (/ D (* d 2.0))) 2.0)) l))))
(if (<= h 4.2e-211)
(* (* t_1 t_0) (/ (sqrt d) (sqrt h)))
(* t_2 (* t_0 (/ (sqrt d) (sqrt l))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 - (h * ((0.125 / l) * pow((D * (M_m / d)), 2.0)));
double t_1 = sqrt((d / l));
double t_2 = sqrt((d / h));
double tmp;
if (h <= -2e-310) {
tmp = (t_1 * t_2) * (1.0 - (0.5 * ((h * pow((M_m * (D / (d * 2.0))), 2.0)) / l)));
} else if (h <= 4.2e-211) {
tmp = (t_1 * t_0) * (sqrt(d) / sqrt(h));
} else {
tmp = t_2 * (t_0 * (sqrt(d) / sqrt(l)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 1.0d0 - (h * ((0.125d0 / l) * ((d_1 * (m_m / d)) ** 2.0d0)))
t_1 = sqrt((d / l))
t_2 = sqrt((d / h))
if (h <= (-2d-310)) then
tmp = (t_1 * t_2) * (1.0d0 - (0.5d0 * ((h * ((m_m * (d_1 / (d * 2.0d0))) ** 2.0d0)) / l)))
else if (h <= 4.2d-211) then
tmp = (t_1 * t_0) * (sqrt(d) / sqrt(h))
else
tmp = t_2 * (t_0 * (sqrt(d) / sqrt(l)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 - (h * ((0.125 / l) * Math.pow((D * (M_m / d)), 2.0)));
double t_1 = Math.sqrt((d / l));
double t_2 = Math.sqrt((d / h));
double tmp;
if (h <= -2e-310) {
tmp = (t_1 * t_2) * (1.0 - (0.5 * ((h * Math.pow((M_m * (D / (d * 2.0))), 2.0)) / l)));
} else if (h <= 4.2e-211) {
tmp = (t_1 * t_0) * (Math.sqrt(d) / Math.sqrt(h));
} else {
tmp = t_2 * (t_0 * (Math.sqrt(d) / Math.sqrt(l)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = 1.0 - (h * ((0.125 / l) * math.pow((D * (M_m / d)), 2.0))) t_1 = math.sqrt((d / l)) t_2 = math.sqrt((d / h)) tmp = 0 if h <= -2e-310: tmp = (t_1 * t_2) * (1.0 - (0.5 * ((h * math.pow((M_m * (D / (d * 2.0))), 2.0)) / l))) elif h <= 4.2e-211: tmp = (t_1 * t_0) * (math.sqrt(d) / math.sqrt(h)) else: tmp = t_2 * (t_0 * (math.sqrt(d) / math.sqrt(l))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(D * Float64(M_m / d)) ^ 2.0)))) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(d / h)) tmp = 0.0 if (h <= -2e-310) tmp = Float64(Float64(t_1 * t_2) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0)) / l)))); elseif (h <= 4.2e-211) tmp = Float64(Float64(t_1 * t_0) * Float64(sqrt(d) / sqrt(h))); else tmp = Float64(t_2 * Float64(t_0 * Float64(sqrt(d) / sqrt(l)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = 1.0 - (h * ((0.125 / l) * ((D * (M_m / d)) ^ 2.0)));
t_1 = sqrt((d / l));
t_2 = sqrt((d / h));
tmp = 0.0;
if (h <= -2e-310)
tmp = (t_1 * t_2) * (1.0 - (0.5 * ((h * ((M_m * (D / (d * 2.0))) ^ 2.0)) / l)));
elseif (h <= 4.2e-211)
tmp = (t_1 * t_0) * (sqrt(d) / sqrt(h));
else
tmp = t_2 * (t_0 * (sqrt(d) / sqrt(l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(1.0 - N[(h * N[(N[(0.125 / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -2e-310], N[(N[(t$95$1 * t$95$2), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 4.2e-211], N[(N[(t$95$1 * t$95$0), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := 1 - h \cdot \left(\frac{0.125}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(t\_1 \cdot t\_2\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;h \leq 4.2 \cdot 10^{-211}:\\
\;\;\;\;\left(t\_1 \cdot t\_0\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 60.7%
Simplified60.8%
associate-*r/63.5%
frac-times63.4%
associate-/l*63.5%
*-commutative63.5%
Applied egg-rr63.5%
if -1.999999999999994e-310 < h < 4.20000000000000015e-211Initial program 72.4%
Simplified72.4%
Taylor expanded in h around -inf 39.9%
associate-*r*39.9%
neg-mul-139.9%
sub-neg39.9%
distribute-lft-in39.9%
Simplified72.4%
sqrt-div98.7%
Applied egg-rr98.7%
if 4.20000000000000015e-211 < h Initial program 61.7%
Simplified61.7%
Taylor expanded in h around -inf 39.0%
associate-*r*39.0%
neg-mul-139.0%
sub-neg39.0%
distribute-lft-in39.0%
Simplified63.8%
sqrt-div80.4%
Applied egg-rr80.4%
Final simplification74.4%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))))
(if (<= h 1e-290)
(*
(* (sqrt (/ d l)) t_0)
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (/ D (* d 2.0))) 2.0)) l))))
(*
t_0
(*
(- 1.0 (* h (* (/ 0.125 l) (pow (* D (/ M_m d)) 2.0))))
(/ (sqrt d) (sqrt l)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / h));
double tmp;
if (h <= 1e-290) {
tmp = (sqrt((d / l)) * t_0) * (1.0 - (0.5 * ((h * pow((M_m * (D / (d * 2.0))), 2.0)) / l)));
} else {
tmp = t_0 * ((1.0 - (h * ((0.125 / l) * pow((D * (M_m / d)), 2.0)))) * (sqrt(d) / sqrt(l)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / h))
if (h <= 1d-290) then
tmp = (sqrt((d / l)) * t_0) * (1.0d0 - (0.5d0 * ((h * ((m_m * (d_1 / (d * 2.0d0))) ** 2.0d0)) / l)))
else
tmp = t_0 * ((1.0d0 - (h * ((0.125d0 / l) * ((d_1 * (m_m / d)) ** 2.0d0)))) * (sqrt(d) / sqrt(l)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / h));
double tmp;
if (h <= 1e-290) {
tmp = (Math.sqrt((d / l)) * t_0) * (1.0 - (0.5 * ((h * Math.pow((M_m * (D / (d * 2.0))), 2.0)) / l)));
} else {
tmp = t_0 * ((1.0 - (h * ((0.125 / l) * Math.pow((D * (M_m / d)), 2.0)))) * (Math.sqrt(d) / Math.sqrt(l)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / h)) tmp = 0 if h <= 1e-290: tmp = (math.sqrt((d / l)) * t_0) * (1.0 - (0.5 * ((h * math.pow((M_m * (D / (d * 2.0))), 2.0)) / l))) else: tmp = t_0 * ((1.0 - (h * ((0.125 / l) * math.pow((D * (M_m / d)), 2.0)))) * (math.sqrt(d) / math.sqrt(l))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / h)) tmp = 0.0 if (h <= 1e-290) tmp = Float64(Float64(sqrt(Float64(d / l)) * t_0) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0)) / l)))); else tmp = Float64(t_0 * Float64(Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(D * Float64(M_m / d)) ^ 2.0)))) * Float64(sqrt(d) / sqrt(l)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / h));
tmp = 0.0;
if (h <= 1e-290)
tmp = (sqrt((d / l)) * t_0) * (1.0 - (0.5 * ((h * ((M_m * (D / (d * 2.0))) ^ 2.0)) / l)));
else
tmp = t_0 * ((1.0 - (h * ((0.125 / l) * ((D * (M_m / d)) ^ 2.0)))) * (sqrt(d) / sqrt(l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, 1e-290], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(1.0 - N[(h * N[(N[(0.125 / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;h \leq 10^{-290}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_0\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(\left(1 - h \cdot \left(\frac{0.125}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\right) \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if h < 1.0000000000000001e-290Initial program 60.1%
Simplified60.2%
associate-*r/62.9%
frac-times62.7%
associate-/l*62.9%
*-commutative62.9%
Applied egg-rr62.9%
if 1.0000000000000001e-290 < h Initial program 64.5%
Simplified64.5%
Taylor expanded in h around -inf 40.0%
associate-*r*40.0%
neg-mul-140.0%
sub-neg40.0%
distribute-lft-in40.0%
Simplified66.2%
sqrt-div79.9%
Applied egg-rr79.9%
Final simplification71.6%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))))
(if (<= d -2.2e-245)
(*
(* (sqrt (/ d l)) t_0)
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (/ D (* d 2.0))) 2.0)) l))))
(if (<= d -2e-311)
(* (/ (pow (* D M_m) 2.0) (- d)) (* -0.125 (sqrt (/ h (pow l 3.0)))))
(if (<= d 2.1e-111)
(/
(* d (* -0.125 (* h (/ (pow (* M_m (/ D d)) 2.0) l))))
(sqrt (* h l)))
(if (<= d 1.55e+144)
(*
t_0
(*
(- 1.0 (* h (* (/ 0.125 l) (pow (* D (/ M_m d)) 2.0))))
(/ 1.0 (sqrt (/ l d)))))
(* d (* (pow l -0.5) (pow h -0.5)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / h));
double tmp;
if (d <= -2.2e-245) {
tmp = (sqrt((d / l)) * t_0) * (1.0 - (0.5 * ((h * pow((M_m * (D / (d * 2.0))), 2.0)) / l)));
} else if (d <= -2e-311) {
tmp = (pow((D * M_m), 2.0) / -d) * (-0.125 * sqrt((h / pow(l, 3.0))));
} else if (d <= 2.1e-111) {
tmp = (d * (-0.125 * (h * (pow((M_m * (D / d)), 2.0) / l)))) / sqrt((h * l));
} else if (d <= 1.55e+144) {
tmp = t_0 * ((1.0 - (h * ((0.125 / l) * pow((D * (M_m / d)), 2.0)))) * (1.0 / sqrt((l / d))));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / h))
if (d <= (-2.2d-245)) then
tmp = (sqrt((d / l)) * t_0) * (1.0d0 - (0.5d0 * ((h * ((m_m * (d_1 / (d * 2.0d0))) ** 2.0d0)) / l)))
else if (d <= (-2d-311)) then
tmp = (((d_1 * m_m) ** 2.0d0) / -d) * ((-0.125d0) * sqrt((h / (l ** 3.0d0))))
else if (d <= 2.1d-111) then
tmp = (d * ((-0.125d0) * (h * (((m_m * (d_1 / d)) ** 2.0d0) / l)))) / sqrt((h * l))
else if (d <= 1.55d+144) then
tmp = t_0 * ((1.0d0 - (h * ((0.125d0 / l) * ((d_1 * (m_m / d)) ** 2.0d0)))) * (1.0d0 / sqrt((l / d))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / h));
double tmp;
if (d <= -2.2e-245) {
tmp = (Math.sqrt((d / l)) * t_0) * (1.0 - (0.5 * ((h * Math.pow((M_m * (D / (d * 2.0))), 2.0)) / l)));
} else if (d <= -2e-311) {
tmp = (Math.pow((D * M_m), 2.0) / -d) * (-0.125 * Math.sqrt((h / Math.pow(l, 3.0))));
} else if (d <= 2.1e-111) {
tmp = (d * (-0.125 * (h * (Math.pow((M_m * (D / d)), 2.0) / l)))) / Math.sqrt((h * l));
} else if (d <= 1.55e+144) {
tmp = t_0 * ((1.0 - (h * ((0.125 / l) * Math.pow((D * (M_m / d)), 2.0)))) * (1.0 / Math.sqrt((l / d))));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / h)) tmp = 0 if d <= -2.2e-245: tmp = (math.sqrt((d / l)) * t_0) * (1.0 - (0.5 * ((h * math.pow((M_m * (D / (d * 2.0))), 2.0)) / l))) elif d <= -2e-311: tmp = (math.pow((D * M_m), 2.0) / -d) * (-0.125 * math.sqrt((h / math.pow(l, 3.0)))) elif d <= 2.1e-111: tmp = (d * (-0.125 * (h * (math.pow((M_m * (D / d)), 2.0) / l)))) / math.sqrt((h * l)) elif d <= 1.55e+144: tmp = t_0 * ((1.0 - (h * ((0.125 / l) * math.pow((D * (M_m / d)), 2.0)))) * (1.0 / math.sqrt((l / d)))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / h)) tmp = 0.0 if (d <= -2.2e-245) tmp = Float64(Float64(sqrt(Float64(d / l)) * t_0) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0)) / l)))); elseif (d <= -2e-311) tmp = Float64(Float64((Float64(D * M_m) ^ 2.0) / Float64(-d)) * Float64(-0.125 * sqrt(Float64(h / (l ^ 3.0))))); elseif (d <= 2.1e-111) tmp = Float64(Float64(d * Float64(-0.125 * Float64(h * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) / l)))) / sqrt(Float64(h * l))); elseif (d <= 1.55e+144) tmp = Float64(t_0 * Float64(Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(D * Float64(M_m / d)) ^ 2.0)))) * Float64(1.0 / sqrt(Float64(l / d))))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / h));
tmp = 0.0;
if (d <= -2.2e-245)
tmp = (sqrt((d / l)) * t_0) * (1.0 - (0.5 * ((h * ((M_m * (D / (d * 2.0))) ^ 2.0)) / l)));
elseif (d <= -2e-311)
tmp = (((D * M_m) ^ 2.0) / -d) * (-0.125 * sqrt((h / (l ^ 3.0))));
elseif (d <= 2.1e-111)
tmp = (d * (-0.125 * (h * (((M_m * (D / d)) ^ 2.0) / l)))) / sqrt((h * l));
elseif (d <= 1.55e+144)
tmp = t_0 * ((1.0 - (h * ((0.125 / l) * ((D * (M_m / d)) ^ 2.0)))) * (1.0 / sqrt((l / d))));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2.2e-245], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-311], N[(N[(N[Power[N[(D * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] / (-d)), $MachinePrecision] * N[(-0.125 * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.1e-111], N[(N[(d * N[(-0.125 * N[(h * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.55e+144], N[(t$95$0 * N[(N[(1.0 - N[(h * N[(N[(0.125 / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;d \leq -2.2 \cdot 10^{-245}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_0\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-311}:\\
\;\;\;\;\frac{{\left(D \cdot M\_m\right)}^{2}}{-d} \cdot \left(-0.125 \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\\
\mathbf{elif}\;d \leq 2.1 \cdot 10^{-111}:\\
\;\;\;\;\frac{d \cdot \left(-0.125 \cdot \left(h \cdot \frac{{\left(M\_m \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 1.55 \cdot 10^{+144}:\\
\;\;\;\;t\_0 \cdot \left(\left(1 - h \cdot \left(\frac{0.125}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\right) \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -2.19999999999999993e-245Initial program 67.2%
Simplified67.3%
associate-*r/70.4%
frac-times70.3%
associate-/l*70.4%
*-commutative70.4%
Applied egg-rr70.4%
if -2.19999999999999993e-245 < d < -1.9999999999999e-311Initial program 14.5%
Simplified14.5%
associate-*r/14.5%
frac-times14.5%
associate-/l*14.5%
*-commutative14.5%
Applied egg-rr14.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-*l*0.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt47.5%
unpow247.5%
unpow247.5%
swap-sqr54.2%
unpow254.2%
*-commutative54.2%
mul-1-neg54.2%
Simplified54.2%
if -1.9999999999999e-311 < d < 2.0999999999999999e-111Initial program 42.4%
Simplified42.3%
Taylor expanded in M around inf 22.3%
associate-*r*22.5%
times-frac22.5%
*-commutative22.5%
associate-/l*22.5%
unpow222.5%
unpow222.5%
unpow222.5%
times-frac31.0%
swap-sqr33.6%
unpow233.6%
associate-*r/33.7%
*-commutative33.7%
associate-/l*33.7%
Simplified33.7%
pow133.7%
associate-*r*33.7%
sqrt-div42.4%
sqrt-div47.3%
frac-times47.3%
add-sqr-sqrt47.3%
sqrt-prod47.3%
*-commutative47.3%
associate-*l*47.3%
Applied egg-rr47.3%
unpow147.3%
associate-*l/48.3%
Simplified58.1%
if 2.0999999999999999e-111 < d < 1.5500000000000001e144Initial program 81.1%
Simplified81.1%
Taylor expanded in h around -inf 68.3%
associate-*r*68.3%
neg-mul-168.3%
sub-neg68.3%
distribute-lft-in68.3%
Simplified85.3%
clear-num85.3%
sqrt-div85.4%
metadata-eval85.4%
Applied egg-rr85.4%
if 1.5500000000000001e144 < d Initial program 65.6%
Simplified65.6%
associate-*r/64.2%
frac-times64.2%
associate-/l*64.2%
*-commutative64.2%
Applied egg-rr64.2%
Taylor expanded in d around inf 72.3%
unpow-172.3%
metadata-eval72.3%
pow-sqr72.4%
rem-sqrt-square72.4%
rem-square-sqrt72.3%
fabs-sqr72.3%
rem-square-sqrt72.4%
Simplified72.4%
*-commutative72.4%
unpow-prod-down80.7%
Applied egg-rr80.7%
Final simplification72.1%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))) (t_1 (sqrt (/ d h))))
(if (<= d -7.5e-243)
(*
(* t_0 t_1)
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (/ D (* d 2.0))) 2.0)) l))))
(if (<= d -2e-311)
(* (/ (pow (* D M_m) 2.0) (- d)) (* -0.125 (sqrt (/ h (pow l 3.0)))))
(if (<= d 2.6e-110)
(/
(* d (* -0.125 (* h (/ (pow (* M_m (/ D d)) 2.0) l))))
(sqrt (* h l)))
(if (<= d 1.75e+144)
(*
(* t_0 (- 1.0 (* h (* (/ 0.125 l) (pow (* D (/ M_m d)) 2.0)))))
t_1)
(* d (* (pow l -0.5) (pow h -0.5)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double tmp;
if (d <= -7.5e-243) {
tmp = (t_0 * t_1) * (1.0 - (0.5 * ((h * pow((M_m * (D / (d * 2.0))), 2.0)) / l)));
} else if (d <= -2e-311) {
tmp = (pow((D * M_m), 2.0) / -d) * (-0.125 * sqrt((h / pow(l, 3.0))));
} else if (d <= 2.6e-110) {
tmp = (d * (-0.125 * (h * (pow((M_m * (D / d)), 2.0) / l)))) / sqrt((h * l));
} else if (d <= 1.75e+144) {
tmp = (t_0 * (1.0 - (h * ((0.125 / l) * pow((D * (M_m / d)), 2.0))))) * t_1;
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt((d / h))
if (d <= (-7.5d-243)) then
tmp = (t_0 * t_1) * (1.0d0 - (0.5d0 * ((h * ((m_m * (d_1 / (d * 2.0d0))) ** 2.0d0)) / l)))
else if (d <= (-2d-311)) then
tmp = (((d_1 * m_m) ** 2.0d0) / -d) * ((-0.125d0) * sqrt((h / (l ** 3.0d0))))
else if (d <= 2.6d-110) then
tmp = (d * ((-0.125d0) * (h * (((m_m * (d_1 / d)) ** 2.0d0) / l)))) / sqrt((h * l))
else if (d <= 1.75d+144) then
tmp = (t_0 * (1.0d0 - (h * ((0.125d0 / l) * ((d_1 * (m_m / d)) ** 2.0d0))))) * t_1
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((d / h));
double tmp;
if (d <= -7.5e-243) {
tmp = (t_0 * t_1) * (1.0 - (0.5 * ((h * Math.pow((M_m * (D / (d * 2.0))), 2.0)) / l)));
} else if (d <= -2e-311) {
tmp = (Math.pow((D * M_m), 2.0) / -d) * (-0.125 * Math.sqrt((h / Math.pow(l, 3.0))));
} else if (d <= 2.6e-110) {
tmp = (d * (-0.125 * (h * (Math.pow((M_m * (D / d)), 2.0) / l)))) / Math.sqrt((h * l));
} else if (d <= 1.75e+144) {
tmp = (t_0 * (1.0 - (h * ((0.125 / l) * Math.pow((D * (M_m / d)), 2.0))))) * t_1;
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / l)) t_1 = math.sqrt((d / h)) tmp = 0 if d <= -7.5e-243: tmp = (t_0 * t_1) * (1.0 - (0.5 * ((h * math.pow((M_m * (D / (d * 2.0))), 2.0)) / l))) elif d <= -2e-311: tmp = (math.pow((D * M_m), 2.0) / -d) * (-0.125 * math.sqrt((h / math.pow(l, 3.0)))) elif d <= 2.6e-110: tmp = (d * (-0.125 * (h * (math.pow((M_m * (D / d)), 2.0) / l)))) / math.sqrt((h * l)) elif d <= 1.75e+144: tmp = (t_0 * (1.0 - (h * ((0.125 / l) * math.pow((D * (M_m / d)), 2.0))))) * t_1 else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) tmp = 0.0 if (d <= -7.5e-243) tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0)) / l)))); elseif (d <= -2e-311) tmp = Float64(Float64((Float64(D * M_m) ^ 2.0) / Float64(-d)) * Float64(-0.125 * sqrt(Float64(h / (l ^ 3.0))))); elseif (d <= 2.6e-110) tmp = Float64(Float64(d * Float64(-0.125 * Float64(h * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) / l)))) / sqrt(Float64(h * l))); elseif (d <= 1.75e+144) tmp = Float64(Float64(t_0 * Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(D * Float64(M_m / d)) ^ 2.0))))) * t_1); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / l));
t_1 = sqrt((d / h));
tmp = 0.0;
if (d <= -7.5e-243)
tmp = (t_0 * t_1) * (1.0 - (0.5 * ((h * ((M_m * (D / (d * 2.0))) ^ 2.0)) / l)));
elseif (d <= -2e-311)
tmp = (((D * M_m) ^ 2.0) / -d) * (-0.125 * sqrt((h / (l ^ 3.0))));
elseif (d <= 2.6e-110)
tmp = (d * (-0.125 * (h * (((M_m * (D / d)) ^ 2.0) / l)))) / sqrt((h * l));
elseif (d <= 1.75e+144)
tmp = (t_0 * (1.0 - (h * ((0.125 / l) * ((D * (M_m / d)) ^ 2.0))))) * t_1;
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -7.5e-243], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-311], N[(N[(N[Power[N[(D * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] / (-d)), $MachinePrecision] * N[(-0.125 * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.6e-110], N[(N[(d * N[(-0.125 * N[(h * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.75e+144], N[(N[(t$95$0 * N[(1.0 - N[(h * N[(N[(0.125 / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;d \leq -7.5 \cdot 10^{-243}:\\
\;\;\;\;\left(t\_0 \cdot t\_1\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-311}:\\
\;\;\;\;\frac{{\left(D \cdot M\_m\right)}^{2}}{-d} \cdot \left(-0.125 \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\\
\mathbf{elif}\;d \leq 2.6 \cdot 10^{-110}:\\
\;\;\;\;\frac{d \cdot \left(-0.125 \cdot \left(h \cdot \frac{{\left(M\_m \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 1.75 \cdot 10^{+144}:\\
\;\;\;\;\left(t\_0 \cdot \left(1 - h \cdot \left(\frac{0.125}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\right)\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -7.5e-243Initial program 67.2%
Simplified67.3%
associate-*r/70.4%
frac-times70.3%
associate-/l*70.4%
*-commutative70.4%
Applied egg-rr70.4%
if -7.5e-243 < d < -1.9999999999999e-311Initial program 14.5%
Simplified14.5%
associate-*r/14.5%
frac-times14.5%
associate-/l*14.5%
*-commutative14.5%
Applied egg-rr14.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-*l*0.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt47.5%
unpow247.5%
unpow247.5%
swap-sqr54.2%
unpow254.2%
*-commutative54.2%
mul-1-neg54.2%
Simplified54.2%
if -1.9999999999999e-311 < d < 2.5999999999999999e-110Initial program 42.4%
Simplified42.3%
Taylor expanded in M around inf 22.3%
associate-*r*22.5%
times-frac22.5%
*-commutative22.5%
associate-/l*22.5%
unpow222.5%
unpow222.5%
unpow222.5%
times-frac31.0%
swap-sqr33.6%
unpow233.6%
associate-*r/33.7%
*-commutative33.7%
associate-/l*33.7%
Simplified33.7%
pow133.7%
associate-*r*33.7%
sqrt-div42.4%
sqrt-div47.3%
frac-times47.3%
add-sqr-sqrt47.3%
sqrt-prod47.3%
*-commutative47.3%
associate-*l*47.3%
Applied egg-rr47.3%
unpow147.3%
associate-*l/48.3%
Simplified58.1%
if 2.5999999999999999e-110 < d < 1.7499999999999999e144Initial program 81.1%
Simplified81.1%
Taylor expanded in h around -inf 68.3%
associate-*r*68.3%
neg-mul-168.3%
sub-neg68.3%
distribute-lft-in68.3%
Simplified85.3%
if 1.7499999999999999e144 < d Initial program 65.6%
Simplified65.6%
associate-*r/64.2%
frac-times64.2%
associate-/l*64.2%
*-commutative64.2%
Applied egg-rr64.2%
Taylor expanded in d around inf 72.3%
unpow-172.3%
metadata-eval72.3%
pow-sqr72.4%
rem-sqrt-square72.4%
rem-square-sqrt72.3%
fabs-sqr72.3%
rem-square-sqrt72.4%
Simplified72.4%
*-commutative72.4%
unpow-prod-down80.7%
Applied egg-rr80.7%
Final simplification72.1%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))) (t_1 (sqrt (/ d l))))
(if (<= d -8.5e-247)
(* t_0 (* t_1 (- 1.0 (* h (* (/ 0.125 l) (pow (/ (* D M_m) d) 2.0))))))
(if (<= d -2e-311)
(* (/ (pow (* D M_m) 2.0) (- d)) (* -0.125 (sqrt (/ h (pow l 3.0)))))
(if (<= d 2.1e-111)
(/
(* d (* -0.125 (* h (/ (pow (* M_m (/ D d)) 2.0) l))))
(sqrt (* h l)))
(if (<= d 2.6e+144)
(*
(* t_1 (- 1.0 (* h (* (/ 0.125 l) (pow (* D (/ M_m d)) 2.0)))))
t_0)
(* d (* (pow l -0.5) (pow h -0.5)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double tmp;
if (d <= -8.5e-247) {
tmp = t_0 * (t_1 * (1.0 - (h * ((0.125 / l) * pow(((D * M_m) / d), 2.0)))));
} else if (d <= -2e-311) {
tmp = (pow((D * M_m), 2.0) / -d) * (-0.125 * sqrt((h / pow(l, 3.0))));
} else if (d <= 2.1e-111) {
tmp = (d * (-0.125 * (h * (pow((M_m * (D / d)), 2.0) / l)))) / sqrt((h * l));
} else if (d <= 2.6e+144) {
tmp = (t_1 * (1.0 - (h * ((0.125 / l) * pow((D * (M_m / d)), 2.0))))) * t_0;
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = sqrt((d / l))
if (d <= (-8.5d-247)) then
tmp = t_0 * (t_1 * (1.0d0 - (h * ((0.125d0 / l) * (((d_1 * m_m) / d) ** 2.0d0)))))
else if (d <= (-2d-311)) then
tmp = (((d_1 * m_m) ** 2.0d0) / -d) * ((-0.125d0) * sqrt((h / (l ** 3.0d0))))
else if (d <= 2.1d-111) then
tmp = (d * ((-0.125d0) * (h * (((m_m * (d_1 / d)) ** 2.0d0) / l)))) / sqrt((h * l))
else if (d <= 2.6d+144) then
tmp = (t_1 * (1.0d0 - (h * ((0.125d0 / l) * ((d_1 * (m_m / d)) ** 2.0d0))))) * t_0
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double tmp;
if (d <= -8.5e-247) {
tmp = t_0 * (t_1 * (1.0 - (h * ((0.125 / l) * Math.pow(((D * M_m) / d), 2.0)))));
} else if (d <= -2e-311) {
tmp = (Math.pow((D * M_m), 2.0) / -d) * (-0.125 * Math.sqrt((h / Math.pow(l, 3.0))));
} else if (d <= 2.1e-111) {
tmp = (d * (-0.125 * (h * (Math.pow((M_m * (D / d)), 2.0) / l)))) / Math.sqrt((h * l));
} else if (d <= 2.6e+144) {
tmp = (t_1 * (1.0 - (h * ((0.125 / l) * Math.pow((D * (M_m / d)), 2.0))))) * t_0;
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / h)) t_1 = math.sqrt((d / l)) tmp = 0 if d <= -8.5e-247: tmp = t_0 * (t_1 * (1.0 - (h * ((0.125 / l) * math.pow(((D * M_m) / d), 2.0))))) elif d <= -2e-311: tmp = (math.pow((D * M_m), 2.0) / -d) * (-0.125 * math.sqrt((h / math.pow(l, 3.0)))) elif d <= 2.1e-111: tmp = (d * (-0.125 * (h * (math.pow((M_m * (D / d)), 2.0) / l)))) / math.sqrt((h * l)) elif d <= 2.6e+144: tmp = (t_1 * (1.0 - (h * ((0.125 / l) * math.pow((D * (M_m / d)), 2.0))))) * t_0 else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -8.5e-247) tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(Float64(D * M_m) / d) ^ 2.0)))))); elseif (d <= -2e-311) tmp = Float64(Float64((Float64(D * M_m) ^ 2.0) / Float64(-d)) * Float64(-0.125 * sqrt(Float64(h / (l ^ 3.0))))); elseif (d <= 2.1e-111) tmp = Float64(Float64(d * Float64(-0.125 * Float64(h * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) / l)))) / sqrt(Float64(h * l))); elseif (d <= 2.6e+144) tmp = Float64(Float64(t_1 * Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(D * Float64(M_m / d)) ^ 2.0))))) * t_0); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / h));
t_1 = sqrt((d / l));
tmp = 0.0;
if (d <= -8.5e-247)
tmp = t_0 * (t_1 * (1.0 - (h * ((0.125 / l) * (((D * M_m) / d) ^ 2.0)))));
elseif (d <= -2e-311)
tmp = (((D * M_m) ^ 2.0) / -d) * (-0.125 * sqrt((h / (l ^ 3.0))));
elseif (d <= 2.1e-111)
tmp = (d * (-0.125 * (h * (((M_m * (D / d)) ^ 2.0) / l)))) / sqrt((h * l));
elseif (d <= 2.6e+144)
tmp = (t_1 * (1.0 - (h * ((0.125 / l) * ((D * (M_m / d)) ^ 2.0))))) * t_0;
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -8.5e-247], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(h * N[(N[(0.125 / l), $MachinePrecision] * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-311], N[(N[(N[Power[N[(D * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] / (-d)), $MachinePrecision] * N[(-0.125 * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.1e-111], N[(N[(d * N[(-0.125 * N[(h * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.6e+144], N[(N[(t$95$1 * N[(1.0 - N[(h * N[(N[(0.125 / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -8.5 \cdot 10^{-247}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \left(1 - h \cdot \left(\frac{0.125}{\ell} \cdot {\left(\frac{D \cdot M\_m}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-311}:\\
\;\;\;\;\frac{{\left(D \cdot M\_m\right)}^{2}}{-d} \cdot \left(-0.125 \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\\
\mathbf{elif}\;d \leq 2.1 \cdot 10^{-111}:\\
\;\;\;\;\frac{d \cdot \left(-0.125 \cdot \left(h \cdot \frac{{\left(M\_m \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 2.6 \cdot 10^{+144}:\\
\;\;\;\;\left(t\_1 \cdot \left(1 - h \cdot \left(\frac{0.125}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\right)\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -8.5000000000000003e-247Initial program 67.2%
Simplified65.7%
Taylor expanded in h around -inf 42.4%
associate-*r*42.4%
neg-mul-142.4%
sub-neg42.4%
distribute-lft-in42.4%
Simplified67.2%
Taylor expanded in D around 0 68.6%
if -8.5000000000000003e-247 < d < -1.9999999999999e-311Initial program 14.5%
Simplified14.5%
associate-*r/14.5%
frac-times14.5%
associate-/l*14.5%
*-commutative14.5%
Applied egg-rr14.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-*l*0.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt47.5%
unpow247.5%
unpow247.5%
swap-sqr54.2%
unpow254.2%
*-commutative54.2%
mul-1-neg54.2%
Simplified54.2%
if -1.9999999999999e-311 < d < 2.0999999999999999e-111Initial program 42.4%
Simplified42.3%
Taylor expanded in M around inf 22.3%
associate-*r*22.5%
times-frac22.5%
*-commutative22.5%
associate-/l*22.5%
unpow222.5%
unpow222.5%
unpow222.5%
times-frac31.0%
swap-sqr33.6%
unpow233.6%
associate-*r/33.7%
*-commutative33.7%
associate-/l*33.7%
Simplified33.7%
pow133.7%
associate-*r*33.7%
sqrt-div42.4%
sqrt-div47.3%
frac-times47.3%
add-sqr-sqrt47.3%
sqrt-prod47.3%
*-commutative47.3%
associate-*l*47.3%
Applied egg-rr47.3%
unpow147.3%
associate-*l/48.3%
Simplified58.1%
if 2.0999999999999999e-111 < d < 2.5999999999999999e144Initial program 81.1%
Simplified81.1%
Taylor expanded in h around -inf 68.3%
associate-*r*68.3%
neg-mul-168.3%
sub-neg68.3%
distribute-lft-in68.3%
Simplified85.3%
if 2.5999999999999999e144 < d Initial program 65.6%
Simplified65.6%
associate-*r/64.2%
frac-times64.2%
associate-/l*64.2%
*-commutative64.2%
Applied egg-rr64.2%
Taylor expanded in d around inf 72.3%
unpow-172.3%
metadata-eval72.3%
pow-sqr72.4%
rem-sqrt-square72.4%
rem-square-sqrt72.3%
fabs-sqr72.3%
rem-square-sqrt72.4%
Simplified72.4%
*-commutative72.4%
unpow-prod-down80.7%
Applied egg-rr80.7%
Final simplification71.4%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0
(*
(*
(sqrt (/ d l))
(- 1.0 (* h (* (/ 0.125 l) (pow (* D (/ M_m d)) 2.0)))))
(sqrt (/ d h)))))
(if (<= d -2.1e-245)
t_0
(if (<= d -2e-311)
(* (/ (pow (* D M_m) 2.0) (- d)) (* -0.125 (sqrt (/ h (pow l 3.0)))))
(if (<= d 2.4e-111)
(/
(* d (* -0.125 (* h (/ (pow (* M_m (/ D d)) 2.0) l))))
(sqrt (* h l)))
(if (<= d 4.5e+143) t_0 (* d (* (pow l -0.5) (pow h -0.5)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = (sqrt((d / l)) * (1.0 - (h * ((0.125 / l) * pow((D * (M_m / d)), 2.0))))) * sqrt((d / h));
double tmp;
if (d <= -2.1e-245) {
tmp = t_0;
} else if (d <= -2e-311) {
tmp = (pow((D * M_m), 2.0) / -d) * (-0.125 * sqrt((h / pow(l, 3.0))));
} else if (d <= 2.4e-111) {
tmp = (d * (-0.125 * (h * (pow((M_m * (D / d)), 2.0) / l)))) / sqrt((h * l));
} else if (d <= 4.5e+143) {
tmp = t_0;
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (sqrt((d / l)) * (1.0d0 - (h * ((0.125d0 / l) * ((d_1 * (m_m / d)) ** 2.0d0))))) * sqrt((d / h))
if (d <= (-2.1d-245)) then
tmp = t_0
else if (d <= (-2d-311)) then
tmp = (((d_1 * m_m) ** 2.0d0) / -d) * ((-0.125d0) * sqrt((h / (l ** 3.0d0))))
else if (d <= 2.4d-111) then
tmp = (d * ((-0.125d0) * (h * (((m_m * (d_1 / d)) ** 2.0d0) / l)))) / sqrt((h * l))
else if (d <= 4.5d+143) then
tmp = t_0
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = (Math.sqrt((d / l)) * (1.0 - (h * ((0.125 / l) * Math.pow((D * (M_m / d)), 2.0))))) * Math.sqrt((d / h));
double tmp;
if (d <= -2.1e-245) {
tmp = t_0;
} else if (d <= -2e-311) {
tmp = (Math.pow((D * M_m), 2.0) / -d) * (-0.125 * Math.sqrt((h / Math.pow(l, 3.0))));
} else if (d <= 2.4e-111) {
tmp = (d * (-0.125 * (h * (Math.pow((M_m * (D / d)), 2.0) / l)))) / Math.sqrt((h * l));
} else if (d <= 4.5e+143) {
tmp = t_0;
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = (math.sqrt((d / l)) * (1.0 - (h * ((0.125 / l) * math.pow((D * (M_m / d)), 2.0))))) * math.sqrt((d / h)) tmp = 0 if d <= -2.1e-245: tmp = t_0 elif d <= -2e-311: tmp = (math.pow((D * M_m), 2.0) / -d) * (-0.125 * math.sqrt((h / math.pow(l, 3.0)))) elif d <= 2.4e-111: tmp = (d * (-0.125 * (h * (math.pow((M_m * (D / d)), 2.0) / l)))) / math.sqrt((h * l)) elif d <= 4.5e+143: tmp = t_0 else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(D * Float64(M_m / d)) ^ 2.0))))) * sqrt(Float64(d / h))) tmp = 0.0 if (d <= -2.1e-245) tmp = t_0; elseif (d <= -2e-311) tmp = Float64(Float64((Float64(D * M_m) ^ 2.0) / Float64(-d)) * Float64(-0.125 * sqrt(Float64(h / (l ^ 3.0))))); elseif (d <= 2.4e-111) tmp = Float64(Float64(d * Float64(-0.125 * Float64(h * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) / l)))) / sqrt(Float64(h * l))); elseif (d <= 4.5e+143) tmp = t_0; else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = (sqrt((d / l)) * (1.0 - (h * ((0.125 / l) * ((D * (M_m / d)) ^ 2.0))))) * sqrt((d / h));
tmp = 0.0;
if (d <= -2.1e-245)
tmp = t_0;
elseif (d <= -2e-311)
tmp = (((D * M_m) ^ 2.0) / -d) * (-0.125 * sqrt((h / (l ^ 3.0))));
elseif (d <= 2.4e-111)
tmp = (d * (-0.125 * (h * (((M_m * (D / d)) ^ 2.0) / l)))) / sqrt((h * l));
elseif (d <= 4.5e+143)
tmp = t_0;
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(h * N[(N[(0.125 / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.1e-245], t$95$0, If[LessEqual[d, -2e-311], N[(N[(N[Power[N[(D * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] / (-d)), $MachinePrecision] * N[(-0.125 * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.4e-111], N[(N[(d * N[(-0.125 * N[(h * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.5e+143], t$95$0, N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - h \cdot \left(\frac{0.125}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{if}\;d \leq -2.1 \cdot 10^{-245}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-311}:\\
\;\;\;\;\frac{{\left(D \cdot M\_m\right)}^{2}}{-d} \cdot \left(-0.125 \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\\
\mathbf{elif}\;d \leq 2.4 \cdot 10^{-111}:\\
\;\;\;\;\frac{d \cdot \left(-0.125 \cdot \left(h \cdot \frac{{\left(M\_m \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 4.5 \cdot 10^{+143}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -2.1000000000000001e-245 or 2.4000000000000001e-111 < d < 4.4999999999999997e143Initial program 71.5%
Simplified70.5%
Taylor expanded in h around -inf 50.3%
associate-*r*50.3%
neg-mul-150.3%
sub-neg50.3%
distribute-lft-in50.3%
Simplified72.7%
if -2.1000000000000001e-245 < d < -1.9999999999999e-311Initial program 14.5%
Simplified14.5%
associate-*r/14.5%
frac-times14.5%
associate-/l*14.5%
*-commutative14.5%
Applied egg-rr14.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-*l*0.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt47.5%
unpow247.5%
unpow247.5%
swap-sqr54.2%
unpow254.2%
*-commutative54.2%
mul-1-neg54.2%
Simplified54.2%
if -1.9999999999999e-311 < d < 2.4000000000000001e-111Initial program 42.4%
Simplified42.3%
Taylor expanded in M around inf 22.3%
associate-*r*22.5%
times-frac22.5%
*-commutative22.5%
associate-/l*22.5%
unpow222.5%
unpow222.5%
unpow222.5%
times-frac31.0%
swap-sqr33.6%
unpow233.6%
associate-*r/33.7%
*-commutative33.7%
associate-/l*33.7%
Simplified33.7%
pow133.7%
associate-*r*33.7%
sqrt-div42.4%
sqrt-div47.3%
frac-times47.3%
add-sqr-sqrt47.3%
sqrt-prod47.3%
*-commutative47.3%
associate-*l*47.3%
Applied egg-rr47.3%
unpow147.3%
associate-*l/48.3%
Simplified58.1%
if 4.4999999999999997e143 < d Initial program 65.6%
Simplified65.6%
associate-*r/64.2%
frac-times64.2%
associate-/l*64.2%
*-commutative64.2%
Applied egg-rr64.2%
Taylor expanded in d around inf 72.3%
unpow-172.3%
metadata-eval72.3%
pow-sqr72.4%
rem-sqrt-square72.4%
rem-square-sqrt72.3%
fabs-sqr72.3%
rem-square-sqrt72.4%
Simplified72.4%
*-commutative72.4%
unpow-prod-down80.7%
Applied egg-rr80.7%
Final simplification70.8%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -0.0024)
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(if (<= l -1.15e-124)
(* (/ (pow (* D M_m) 2.0) (- d)) (* -0.125 (sqrt (/ h (pow l 3.0)))))
(if (<= l 4.8e+62)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (/ D (* d 2.0))) 2.0)) l)))
(sqrt (* (/ d l) (/ d h))))
(* d (* (pow l -0.5) (pow h -0.5)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -0.0024) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else if (l <= -1.15e-124) {
tmp = (pow((D * M_m), 2.0) / -d) * (-0.125 * sqrt((h / pow(l, 3.0))));
} else if (l <= 4.8e+62) {
tmp = (1.0 - (0.5 * ((h * pow((M_m * (D / (d * 2.0))), 2.0)) / l))) * sqrt(((d / l) * (d / h)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-0.0024d0)) then
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l))
else if (l <= (-1.15d-124)) then
tmp = (((d_1 * m_m) ** 2.0d0) / -d) * ((-0.125d0) * sqrt((h / (l ** 3.0d0))))
else if (l <= 4.8d+62) then
tmp = (1.0d0 - (0.5d0 * ((h * ((m_m * (d_1 / (d * 2.0d0))) ** 2.0d0)) / l))) * sqrt(((d / l) * (d / h)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -0.0024) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l));
} else if (l <= -1.15e-124) {
tmp = (Math.pow((D * M_m), 2.0) / -d) * (-0.125 * Math.sqrt((h / Math.pow(l, 3.0))));
} else if (l <= 4.8e+62) {
tmp = (1.0 - (0.5 * ((h * Math.pow((M_m * (D / (d * 2.0))), 2.0)) / l))) * Math.sqrt(((d / l) * (d / h)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -0.0024: tmp = (math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l)) elif l <= -1.15e-124: tmp = (math.pow((D * M_m), 2.0) / -d) * (-0.125 * math.sqrt((h / math.pow(l, 3.0)))) elif l <= 4.8e+62: tmp = (1.0 - (0.5 * ((h * math.pow((M_m * (D / (d * 2.0))), 2.0)) / l))) * math.sqrt(((d / l) * (d / h))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -0.0024) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); elseif (l <= -1.15e-124) tmp = Float64(Float64((Float64(D * M_m) ^ 2.0) / Float64(-d)) * Float64(-0.125 * sqrt(Float64(h / (l ^ 3.0))))); elseif (l <= 4.8e+62) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0)) / l))) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -0.0024)
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
elseif (l <= -1.15e-124)
tmp = (((D * M_m) ^ 2.0) / -d) * (-0.125 * sqrt((h / (l ^ 3.0))));
elseif (l <= 4.8e+62)
tmp = (1.0 - (0.5 * ((h * ((M_m * (D / (d * 2.0))) ^ 2.0)) / l))) * sqrt(((d / l) * (d / h)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -0.0024], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.15e-124], N[(N[(N[Power[N[(D * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] / (-d)), $MachinePrecision] * N[(-0.125 * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.8e+62], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.0024:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -1.15 \cdot 10^{-124}:\\
\;\;\;\;\frac{{\left(D \cdot M\_m\right)}^{2}}{-d} \cdot \left(-0.125 \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\\
\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{+62}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -0.00239999999999999979Initial program 53.4%
Simplified53.7%
Taylor expanded in M around 0 47.0%
frac-2neg52.9%
sqrt-div64.9%
Applied egg-rr59.1%
if -0.00239999999999999979 < l < -1.15000000000000006e-124Initial program 55.8%
Simplified55.8%
associate-*r/55.8%
frac-times55.9%
associate-/l*55.8%
*-commutative55.8%
Applied egg-rr55.8%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-*l*0.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt51.9%
unpow251.9%
unpow251.9%
swap-sqr62.0%
unpow262.0%
*-commutative62.0%
mul-1-neg62.0%
Simplified62.0%
if -1.15000000000000006e-124 < l < 4.8e62Initial program 75.0%
Simplified75.0%
associate-*r/78.7%
frac-times78.7%
associate-/l*78.7%
*-commutative78.7%
Applied egg-rr78.7%
pow178.7%
sqrt-unprod70.7%
Applied egg-rr70.7%
unpow170.7%
*-commutative70.7%
Simplified70.7%
if 4.8e62 < l Initial program 46.1%
Simplified46.1%
associate-*r/44.1%
frac-times44.1%
associate-/l*44.1%
*-commutative44.1%
Applied egg-rr44.1%
Taylor expanded in d around inf 48.9%
unpow-148.9%
metadata-eval48.9%
pow-sqr49.0%
rem-sqrt-square49.0%
rem-square-sqrt48.7%
fabs-sqr48.7%
rem-square-sqrt49.0%
Simplified49.0%
*-commutative49.0%
unpow-prod-down58.9%
Applied egg-rr58.9%
Final simplification64.8%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -6.6e+31)
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(if (<= l 8.5e+64)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (/ D (* d 2.0))) 2.0)) l)))
(sqrt (* (/ d l) (/ d h))))
(* d (* (pow l -0.5) (pow h -0.5))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -6.6e+31) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else if (l <= 8.5e+64) {
tmp = (1.0 - (0.5 * ((h * pow((M_m * (D / (d * 2.0))), 2.0)) / l))) * sqrt(((d / l) * (d / h)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-6.6d+31)) then
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l))
else if (l <= 8.5d+64) then
tmp = (1.0d0 - (0.5d0 * ((h * ((m_m * (d_1 / (d * 2.0d0))) ** 2.0d0)) / l))) * sqrt(((d / l) * (d / h)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -6.6e+31) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l));
} else if (l <= 8.5e+64) {
tmp = (1.0 - (0.5 * ((h * Math.pow((M_m * (D / (d * 2.0))), 2.0)) / l))) * Math.sqrt(((d / l) * (d / h)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -6.6e+31: tmp = (math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l)) elif l <= 8.5e+64: tmp = (1.0 - (0.5 * ((h * math.pow((M_m * (D / (d * 2.0))), 2.0)) / l))) * math.sqrt(((d / l) * (d / h))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -6.6e+31) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); elseif (l <= 8.5e+64) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0)) / l))) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -6.6e+31)
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
elseif (l <= 8.5e+64)
tmp = (1.0 - (0.5 * ((h * ((M_m * (D / (d * 2.0))) ^ 2.0)) / l))) * sqrt(((d / l) * (d / h)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -6.6e+31], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.5e+64], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.6 \cdot 10^{+31}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 8.5 \cdot 10^{+64}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -6.59999999999999985e31Initial program 49.7%
Simplified50.1%
Taylor expanded in M around 0 44.6%
frac-2neg49.1%
sqrt-div60.9%
Applied egg-rr56.4%
if -6.59999999999999985e31 < l < 8.4999999999999998e64Initial program 71.6%
Simplified71.6%
associate-*r/74.4%
frac-times74.4%
associate-/l*74.4%
*-commutative74.4%
Applied egg-rr74.4%
pow174.4%
sqrt-unprod65.8%
Applied egg-rr65.8%
unpow165.8%
*-commutative65.8%
Simplified65.8%
if 8.4999999999999998e64 < l Initial program 46.1%
Simplified46.1%
associate-*r/44.1%
frac-times44.1%
associate-/l*44.1%
*-commutative44.1%
Applied egg-rr44.1%
Taylor expanded in d around inf 48.9%
unpow-148.9%
metadata-eval48.9%
pow-sqr49.0%
rem-sqrt-square49.0%
rem-square-sqrt48.7%
fabs-sqr48.7%
rem-square-sqrt49.0%
Simplified49.0%
*-commutative49.0%
unpow-prod-down58.9%
Applied egg-rr58.9%
Final simplification62.6%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0
(/
(* d (* -0.125 (* h (/ (pow (* M_m (/ D d)) 2.0) l))))
(sqrt (* h l)))))
(if (<= d -7.5e-29)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= d -4.3e-116)
(*
(sqrt (* (/ d l) (/ d h)))
(* (pow (* D (/ M_m d)) 2.0) (* (/ h l) -0.125)))
(if (<= d -2.25e-167)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d -2e-311)
(* d (pow 0.0 -0.5))
(if (<= d 3150.0)
t_0
(if (<= d 1.9e+49)
(/ d (* (sqrt h) (sqrt l)))
(if (<= d 1.75e+112)
t_0
(* d (* (pow l -0.5) (pow h -0.5))))))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = (d * (-0.125 * (h * (pow((M_m * (D / d)), 2.0) / l)))) / sqrt((h * l));
double tmp;
if (d <= -7.5e-29) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (d <= -4.3e-116) {
tmp = sqrt(((d / l) * (d / h))) * (pow((D * (M_m / d)), 2.0) * ((h / l) * -0.125));
} else if (d <= -2.25e-167) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= -2e-311) {
tmp = d * pow(0.0, -0.5);
} else if (d <= 3150.0) {
tmp = t_0;
} else if (d <= 1.9e+49) {
tmp = d / (sqrt(h) * sqrt(l));
} else if (d <= 1.75e+112) {
tmp = t_0;
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (d * ((-0.125d0) * (h * (((m_m * (d_1 / d)) ** 2.0d0) / l)))) / sqrt((h * l))
if (d <= (-7.5d-29)) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else if (d <= (-4.3d-116)) then
tmp = sqrt(((d / l) * (d / h))) * (((d_1 * (m_m / d)) ** 2.0d0) * ((h / l) * (-0.125d0)))
else if (d <= (-2.25d-167)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (d <= (-2d-311)) then
tmp = d * (0.0d0 ** (-0.5d0))
else if (d <= 3150.0d0) then
tmp = t_0
else if (d <= 1.9d+49) then
tmp = d / (sqrt(h) * sqrt(l))
else if (d <= 1.75d+112) then
tmp = t_0
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = (d * (-0.125 * (h * (Math.pow((M_m * (D / d)), 2.0) / l)))) / Math.sqrt((h * l));
double tmp;
if (d <= -7.5e-29) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else if (d <= -4.3e-116) {
tmp = Math.sqrt(((d / l) * (d / h))) * (Math.pow((D * (M_m / d)), 2.0) * ((h / l) * -0.125));
} else if (d <= -2.25e-167) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (d <= -2e-311) {
tmp = d * Math.pow(0.0, -0.5);
} else if (d <= 3150.0) {
tmp = t_0;
} else if (d <= 1.9e+49) {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
} else if (d <= 1.75e+112) {
tmp = t_0;
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = (d * (-0.125 * (h * (math.pow((M_m * (D / d)), 2.0) / l)))) / math.sqrt((h * l)) tmp = 0 if d <= -7.5e-29: tmp = -d * math.sqrt((1.0 / (h * l))) elif d <= -4.3e-116: tmp = math.sqrt(((d / l) * (d / h))) * (math.pow((D * (M_m / d)), 2.0) * ((h / l) * -0.125)) elif d <= -2.25e-167: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif d <= -2e-311: tmp = d * math.pow(0.0, -0.5) elif d <= 3150.0: tmp = t_0 elif d <= 1.9e+49: tmp = d / (math.sqrt(h) * math.sqrt(l)) elif d <= 1.75e+112: tmp = t_0 else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(Float64(d * Float64(-0.125 * Float64(h * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) / l)))) / sqrt(Float64(h * l))) tmp = 0.0 if (d <= -7.5e-29) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= -4.3e-116) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64((Float64(D * Float64(M_m / d)) ^ 2.0) * Float64(Float64(h / l) * -0.125))); elseif (d <= -2.25e-167) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= -2e-311) tmp = Float64(d * (0.0 ^ -0.5)); elseif (d <= 3150.0) tmp = t_0; elseif (d <= 1.9e+49) tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); elseif (d <= 1.75e+112) tmp = t_0; else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = (d * (-0.125 * (h * (((M_m * (D / d)) ^ 2.0) / l)))) / sqrt((h * l));
tmp = 0.0;
if (d <= -7.5e-29)
tmp = -d * sqrt((1.0 / (h * l)));
elseif (d <= -4.3e-116)
tmp = sqrt(((d / l) * (d / h))) * (((D * (M_m / d)) ^ 2.0) * ((h / l) * -0.125));
elseif (d <= -2.25e-167)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (d <= -2e-311)
tmp = d * (0.0 ^ -0.5);
elseif (d <= 3150.0)
tmp = t_0;
elseif (d <= 1.9e+49)
tmp = d / (sqrt(h) * sqrt(l));
elseif (d <= 1.75e+112)
tmp = t_0;
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(N[(d * N[(-0.125 * N[(h * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7.5e-29], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.3e-116], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.25e-167], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-311], N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3150.0], t$95$0, If[LessEqual[d, 1.9e+49], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.75e+112], t$95$0, N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \frac{d \cdot \left(-0.125 \cdot \left(h \cdot \frac{{\left(M\_m \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;d \leq -7.5 \cdot 10^{-29}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -4.3 \cdot 10^{-116}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left({\left(D \cdot \frac{M\_m}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.125\right)\right)\\
\mathbf{elif}\;d \leq -2.25 \cdot 10^{-167}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-311}:\\
\;\;\;\;d \cdot {0}^{-0.5}\\
\mathbf{elif}\;d \leq 3150:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 1.9 \cdot 10^{+49}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{elif}\;d \leq 1.75 \cdot 10^{+112}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -7.50000000000000006e-29Initial program 66.7%
Simplified66.9%
associate-*r/70.3%
frac-times70.0%
associate-/l*70.3%
*-commutative70.3%
Applied egg-rr70.3%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt53.1%
mul-1-neg53.1%
Simplified53.1%
if -7.50000000000000006e-29 < d < -4.2999999999999997e-116Initial program 99.5%
Simplified84.9%
Taylor expanded in M around inf 67.8%
associate-*r*67.8%
times-frac68.1%
*-commutative68.1%
associate-/l*68.1%
unpow268.1%
unpow268.1%
unpow268.1%
times-frac68.1%
swap-sqr68.9%
unpow268.9%
associate-*r/68.8%
*-commutative68.8%
associate-/l*68.8%
Simplified68.8%
add-sqr-sqrt68.8%
pow268.8%
sqrt-prod68.8%
sqrt-pow168.8%
metadata-eval68.8%
pow168.8%
Applied egg-rr68.8%
pow168.8%
associate-*r*83.7%
sqrt-unprod75.4%
*-commutative75.4%
unpow-prod-down75.3%
pow275.3%
add-sqr-sqrt75.3%
Applied egg-rr75.3%
unpow175.3%
associate-*r*75.3%
Simplified75.3%
if -4.2999999999999997e-116 < d < -2.2500000000000001e-167Initial program 42.1%
Simplified42.0%
Taylor expanded in M around 0 42.5%
Taylor expanded in d around 0 42.5%
if -2.2500000000000001e-167 < d < -1.9999999999999e-311Initial program 42.4%
Simplified42.4%
associate-*r/42.5%
frac-times42.5%
associate-/l*42.5%
*-commutative42.5%
Applied egg-rr42.5%
Taylor expanded in d around inf 25.0%
unpow-125.0%
metadata-eval25.0%
pow-sqr25.0%
rem-sqrt-square25.2%
rem-square-sqrt25.2%
fabs-sqr25.2%
rem-square-sqrt25.2%
Simplified25.2%
expm1-log1p-u25.2%
expm1-undefine34.3%
Applied egg-rr34.3%
sub-neg34.3%
metadata-eval34.3%
+-commutative34.3%
log1p-undefine34.3%
rem-exp-log34.3%
+-commutative34.3%
fma-define34.3%
Simplified34.3%
Taylor expanded in h around 0 42.3%
if -1.9999999999999e-311 < d < 3150 or 1.8999999999999999e49 < d < 1.74999999999999998e112Initial program 61.1%
Simplified61.1%
Taylor expanded in M around inf 32.1%
associate-*r*32.3%
times-frac33.6%
*-commutative33.6%
associate-/l*29.7%
unpow229.7%
unpow229.7%
unpow229.7%
times-frac34.3%
swap-sqr46.1%
unpow246.1%
associate-*r/46.1%
*-commutative46.1%
associate-/l*46.1%
Simplified46.1%
pow146.1%
associate-*r*46.1%
sqrt-div50.9%
sqrt-div53.6%
frac-times53.6%
add-sqr-sqrt53.6%
sqrt-prod53.5%
*-commutative53.5%
associate-*l*53.5%
Applied egg-rr53.5%
unpow153.5%
associate-*l/54.0%
Simplified59.3%
if 3150 < d < 1.8999999999999999e49Initial program 77.4%
Simplified77.4%
Taylor expanded in M around 0 77.3%
sqrt-div77.2%
*-rgt-identity77.2%
sqrt-div76.7%
frac-times77.1%
add-sqr-sqrt77.5%
sqrt-prod67.2%
Applied egg-rr67.2%
*-commutative67.2%
sqrt-prod77.5%
Applied egg-rr77.5%
if 1.74999999999999998e112 < d Initial program 65.8%
Simplified65.8%
associate-*r/64.5%
frac-times64.5%
associate-/l*64.5%
*-commutative64.5%
Applied egg-rr64.5%
Taylor expanded in d around inf 72.0%
unpow-172.0%
metadata-eval72.0%
pow-sqr72.0%
rem-sqrt-square72.0%
rem-square-sqrt71.9%
fabs-sqr71.9%
rem-square-sqrt72.0%
Simplified72.0%
*-commutative72.0%
unpow-prod-down79.9%
Applied egg-rr79.9%
Final simplification60.2%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* d (pow 0.0 -0.5)))
(t_1 (sqrt (* h l)))
(t_2 (/ (* d (* -0.125 (* h (/ (pow (* M_m (/ D d)) 2.0) l)))) t_1)))
(if (<= d -2.4e-29)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= d -4.9e-110)
t_0
(if (<= d -1.4e-160)
(/ (- d) t_1)
(if (<= d -2e-311)
t_0
(if (<= d 230.0)
t_2
(if (<= d 1.06e+49)
(/ d (* (sqrt h) (sqrt l)))
(if (<= d 8.2e+113)
t_2
(* d (* (pow l -0.5) (pow h -0.5))))))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = d * pow(0.0, -0.5);
double t_1 = sqrt((h * l));
double t_2 = (d * (-0.125 * (h * (pow((M_m * (D / d)), 2.0) / l)))) / t_1;
double tmp;
if (d <= -2.4e-29) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (d <= -4.9e-110) {
tmp = t_0;
} else if (d <= -1.4e-160) {
tmp = -d / t_1;
} else if (d <= -2e-311) {
tmp = t_0;
} else if (d <= 230.0) {
tmp = t_2;
} else if (d <= 1.06e+49) {
tmp = d / (sqrt(h) * sqrt(l));
} else if (d <= 8.2e+113) {
tmp = t_2;
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d * (0.0d0 ** (-0.5d0))
t_1 = sqrt((h * l))
t_2 = (d * ((-0.125d0) * (h * (((m_m * (d_1 / d)) ** 2.0d0) / l)))) / t_1
if (d <= (-2.4d-29)) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else if (d <= (-4.9d-110)) then
tmp = t_0
else if (d <= (-1.4d-160)) then
tmp = -d / t_1
else if (d <= (-2d-311)) then
tmp = t_0
else if (d <= 230.0d0) then
tmp = t_2
else if (d <= 1.06d+49) then
tmp = d / (sqrt(h) * sqrt(l))
else if (d <= 8.2d+113) then
tmp = t_2
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = d * Math.pow(0.0, -0.5);
double t_1 = Math.sqrt((h * l));
double t_2 = (d * (-0.125 * (h * (Math.pow((M_m * (D / d)), 2.0) / l)))) / t_1;
double tmp;
if (d <= -2.4e-29) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else if (d <= -4.9e-110) {
tmp = t_0;
} else if (d <= -1.4e-160) {
tmp = -d / t_1;
} else if (d <= -2e-311) {
tmp = t_0;
} else if (d <= 230.0) {
tmp = t_2;
} else if (d <= 1.06e+49) {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
} else if (d <= 8.2e+113) {
tmp = t_2;
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = d * math.pow(0.0, -0.5) t_1 = math.sqrt((h * l)) t_2 = (d * (-0.125 * (h * (math.pow((M_m * (D / d)), 2.0) / l)))) / t_1 tmp = 0 if d <= -2.4e-29: tmp = -d * math.sqrt((1.0 / (h * l))) elif d <= -4.9e-110: tmp = t_0 elif d <= -1.4e-160: tmp = -d / t_1 elif d <= -2e-311: tmp = t_0 elif d <= 230.0: tmp = t_2 elif d <= 1.06e+49: tmp = d / (math.sqrt(h) * math.sqrt(l)) elif d <= 8.2e+113: tmp = t_2 else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(d * (0.0 ^ -0.5)) t_1 = sqrt(Float64(h * l)) t_2 = Float64(Float64(d * Float64(-0.125 * Float64(h * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) / l)))) / t_1) tmp = 0.0 if (d <= -2.4e-29) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= -4.9e-110) tmp = t_0; elseif (d <= -1.4e-160) tmp = Float64(Float64(-d) / t_1); elseif (d <= -2e-311) tmp = t_0; elseif (d <= 230.0) tmp = t_2; elseif (d <= 1.06e+49) tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); elseif (d <= 8.2e+113) tmp = t_2; else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = d * (0.0 ^ -0.5);
t_1 = sqrt((h * l));
t_2 = (d * (-0.125 * (h * (((M_m * (D / d)) ^ 2.0) / l)))) / t_1;
tmp = 0.0;
if (d <= -2.4e-29)
tmp = -d * sqrt((1.0 / (h * l)));
elseif (d <= -4.9e-110)
tmp = t_0;
elseif (d <= -1.4e-160)
tmp = -d / t_1;
elseif (d <= -2e-311)
tmp = t_0;
elseif (d <= 230.0)
tmp = t_2;
elseif (d <= 1.06e+49)
tmp = d / (sqrt(h) * sqrt(l));
elseif (d <= 8.2e+113)
tmp = t_2;
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * N[(-0.125 * N[(h * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[d, -2.4e-29], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.9e-110], t$95$0, If[LessEqual[d, -1.4e-160], N[((-d) / t$95$1), $MachinePrecision], If[LessEqual[d, -2e-311], t$95$0, If[LessEqual[d, 230.0], t$95$2, If[LessEqual[d, 1.06e+49], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8.2e+113], t$95$2, N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := d \cdot {0}^{-0.5}\\
t_1 := \sqrt{h \cdot \ell}\\
t_2 := \frac{d \cdot \left(-0.125 \cdot \left(h \cdot \frac{{\left(M\_m \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}{t\_1}\\
\mathbf{if}\;d \leq -2.4 \cdot 10^{-29}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -4.9 \cdot 10^{-110}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -1.4 \cdot 10^{-160}:\\
\;\;\;\;\frac{-d}{t\_1}\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-311}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 230:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d \leq 1.06 \cdot 10^{+49}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{elif}\;d \leq 8.2 \cdot 10^{+113}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -2.39999999999999992e-29Initial program 66.7%
Simplified66.9%
associate-*r/70.3%
frac-times70.0%
associate-/l*70.3%
*-commutative70.3%
Applied egg-rr70.3%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt53.1%
mul-1-neg53.1%
Simplified53.1%
if -2.39999999999999992e-29 < d < -4.8999999999999997e-110 or -1.40000000000000008e-160 < d < -1.9999999999999e-311Initial program 54.7%
Simplified54.7%
associate-*r/54.8%
frac-times54.8%
associate-/l*54.8%
*-commutative54.8%
Applied egg-rr54.8%
Taylor expanded in d around inf 21.6%
unpow-121.6%
metadata-eval21.6%
pow-sqr21.6%
rem-sqrt-square21.7%
rem-square-sqrt21.7%
fabs-sqr21.7%
rem-square-sqrt21.7%
Simplified21.7%
expm1-log1p-u21.7%
expm1-undefine35.4%
Applied egg-rr35.4%
sub-neg35.4%
metadata-eval35.4%
+-commutative35.4%
log1p-undefine35.4%
rem-exp-log35.4%
+-commutative35.4%
fma-define35.4%
Simplified35.4%
Taylor expanded in h around 0 50.4%
if -4.8999999999999997e-110 < d < -1.40000000000000008e-160Initial program 52.5%
Simplified52.4%
add-sqr-sqrt52.4%
pow252.4%
sqrt-prod52.4%
sqrt-pow152.7%
metadata-eval52.7%
frac-times52.7%
associate-/l*52.7%
pow152.7%
*-commutative52.7%
Applied egg-rr52.7%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
*-commutative0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt46.2%
neg-mul-146.2%
unpow1/246.2%
rem-exp-log44.1%
exp-neg44.1%
exp-prod44.0%
distribute-lft-neg-out44.0%
rec-exp44.0%
exp-to-pow46.2%
unpow1/246.2%
distribute-neg-frac46.2%
metadata-eval46.2%
/-rgt-identity46.2%
Simplified46.3%
if -1.9999999999999e-311 < d < 230 or 1.06e49 < d < 8.19999999999999985e113Initial program 61.1%
Simplified61.1%
Taylor expanded in M around inf 32.1%
associate-*r*32.3%
times-frac33.6%
*-commutative33.6%
associate-/l*29.7%
unpow229.7%
unpow229.7%
unpow229.7%
times-frac34.3%
swap-sqr46.1%
unpow246.1%
associate-*r/46.1%
*-commutative46.1%
associate-/l*46.1%
Simplified46.1%
pow146.1%
associate-*r*46.1%
sqrt-div50.9%
sqrt-div53.6%
frac-times53.6%
add-sqr-sqrt53.6%
sqrt-prod53.5%
*-commutative53.5%
associate-*l*53.5%
Applied egg-rr53.5%
unpow153.5%
associate-*l/54.0%
Simplified59.3%
if 230 < d < 1.06e49Initial program 77.4%
Simplified77.4%
Taylor expanded in M around 0 77.3%
sqrt-div77.2%
*-rgt-identity77.2%
sqrt-div76.7%
frac-times77.1%
add-sqr-sqrt77.5%
sqrt-prod67.2%
Applied egg-rr67.2%
*-commutative67.2%
sqrt-prod77.5%
Applied egg-rr77.5%
if 8.19999999999999985e113 < d Initial program 65.8%
Simplified65.8%
associate-*r/64.5%
frac-times64.5%
associate-/l*64.5%
*-commutative64.5%
Applied egg-rr64.5%
Taylor expanded in d around inf 72.0%
unpow-172.0%
metadata-eval72.0%
pow-sqr72.0%
rem-sqrt-square72.0%
rem-square-sqrt71.9%
fabs-sqr71.9%
rem-square-sqrt72.0%
Simplified72.0%
*-commutative72.0%
unpow-prod-down79.9%
Applied egg-rr79.9%
Final simplification60.2%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -7.6)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= l 1.35e-295)
(* d (pow 0.0 -0.5))
(if (or (<= l 2.5e-229) (and (not (<= l 4.2e-39)) (<= l 1400000000000.0)))
(*
(pow (* D (/ M_m d)) 2.0)
(* (* (/ h l) -0.125) (/ d (sqrt (* h l)))))
(* d (* (pow l -0.5) (pow h -0.5)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -7.6) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (l <= 1.35e-295) {
tmp = d * pow(0.0, -0.5);
} else if ((l <= 2.5e-229) || (!(l <= 4.2e-39) && (l <= 1400000000000.0))) {
tmp = pow((D * (M_m / d)), 2.0) * (((h / l) * -0.125) * (d / sqrt((h * l))));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-7.6d0)) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else if (l <= 1.35d-295) then
tmp = d * (0.0d0 ** (-0.5d0))
else if ((l <= 2.5d-229) .or. (.not. (l <= 4.2d-39)) .and. (l <= 1400000000000.0d0)) then
tmp = ((d_1 * (m_m / d)) ** 2.0d0) * (((h / l) * (-0.125d0)) * (d / sqrt((h * l))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -7.6) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else if (l <= 1.35e-295) {
tmp = d * Math.pow(0.0, -0.5);
} else if ((l <= 2.5e-229) || (!(l <= 4.2e-39) && (l <= 1400000000000.0))) {
tmp = Math.pow((D * (M_m / d)), 2.0) * (((h / l) * -0.125) * (d / Math.sqrt((h * l))));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -7.6: tmp = -d * math.sqrt((1.0 / (h * l))) elif l <= 1.35e-295: tmp = d * math.pow(0.0, -0.5) elif (l <= 2.5e-229) or (not (l <= 4.2e-39) and (l <= 1400000000000.0)): tmp = math.pow((D * (M_m / d)), 2.0) * (((h / l) * -0.125) * (d / math.sqrt((h * l)))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -7.6) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (l <= 1.35e-295) tmp = Float64(d * (0.0 ^ -0.5)); elseif ((l <= 2.5e-229) || (!(l <= 4.2e-39) && (l <= 1400000000000.0))) tmp = Float64((Float64(D * Float64(M_m / d)) ^ 2.0) * Float64(Float64(Float64(h / l) * -0.125) * Float64(d / sqrt(Float64(h * l))))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -7.6)
tmp = -d * sqrt((1.0 / (h * l)));
elseif (l <= 1.35e-295)
tmp = d * (0.0 ^ -0.5);
elseif ((l <= 2.5e-229) || (~((l <= 4.2e-39)) && (l <= 1400000000000.0)))
tmp = ((D * (M_m / d)) ^ 2.0) * (((h / l) * -0.125) * (d / sqrt((h * l))));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -7.6], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.35e-295], N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 2.5e-229], And[N[Not[LessEqual[l, 4.2e-39]], $MachinePrecision], LessEqual[l, 1400000000000.0]]], N[(N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * -0.125), $MachinePrecision] * N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7.6:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 1.35 \cdot 10^{-295}:\\
\;\;\;\;d \cdot {0}^{-0.5}\\
\mathbf{elif}\;\ell \leq 2.5 \cdot 10^{-229} \lor \neg \left(\ell \leq 4.2 \cdot 10^{-39}\right) \land \ell \leq 1400000000000:\\
\;\;\;\;{\left(D \cdot \frac{M\_m}{d}\right)}^{2} \cdot \left(\left(\frac{h}{\ell} \cdot -0.125\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -7.5999999999999996Initial program 53.4%
Simplified53.7%
associate-*r/55.8%
frac-times55.5%
associate-/l*55.8%
*-commutative55.8%
Applied egg-rr55.8%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt55.6%
mul-1-neg55.6%
Simplified55.6%
if -7.5999999999999996 < l < 1.35e-295Initial program 68.3%
Simplified68.3%
associate-*r/71.4%
frac-times71.5%
associate-/l*71.4%
*-commutative71.4%
Applied egg-rr71.4%
Taylor expanded in d around inf 16.2%
unpow-116.2%
metadata-eval16.2%
pow-sqr16.2%
rem-sqrt-square16.3%
rem-square-sqrt16.3%
fabs-sqr16.3%
rem-square-sqrt16.3%
Simplified16.3%
expm1-log1p-u16.3%
expm1-undefine31.0%
Applied egg-rr31.0%
sub-neg31.0%
metadata-eval31.0%
+-commutative31.0%
log1p-undefine31.0%
rem-exp-log31.0%
+-commutative31.0%
fma-define31.0%
Simplified31.0%
Taylor expanded in h around 0 47.4%
if 1.35e-295 < l < 2.50000000000000008e-229 or 4.19999999999999987e-39 < l < 1.4e12Initial program 68.4%
Simplified68.2%
Taylor expanded in M around inf 38.1%
associate-*r*38.1%
times-frac38.1%
*-commutative38.1%
associate-/l*32.7%
unpow232.7%
unpow232.7%
unpow232.7%
times-frac43.6%
swap-sqr51.8%
unpow251.8%
associate-*r/51.9%
*-commutative51.9%
associate-/l*51.9%
Simplified51.9%
pow151.9%
associate-*r*51.9%
sqrt-div59.0%
sqrt-div59.0%
frac-times59.0%
add-sqr-sqrt59.0%
sqrt-prod59.0%
*-commutative59.0%
associate-*l*59.0%
Applied egg-rr59.0%
unpow159.0%
*-commutative59.0%
associate-*l*56.3%
*-commutative56.3%
Simplified56.3%
if 2.50000000000000008e-229 < l < 4.19999999999999987e-39 or 1.4e12 < l Initial program 61.5%
Simplified61.5%
associate-*r/61.7%
frac-times61.7%
associate-/l*61.7%
*-commutative61.7%
Applied egg-rr61.7%
Taylor expanded in d around inf 52.7%
unpow-152.7%
metadata-eval52.7%
pow-sqr52.8%
rem-sqrt-square52.8%
rem-square-sqrt52.6%
fabs-sqr52.6%
rem-square-sqrt52.8%
Simplified52.8%
*-commutative52.8%
unpow-prod-down58.8%
Applied egg-rr58.8%
Final simplification54.8%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -1.8e+32)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= l 6e+66)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (/ D (* d 2.0))) 2.0)) l)))
(sqrt (* (/ d l) (/ d h))))
(* d (* (pow l -0.5) (pow h -0.5))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1.8e+32) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (l <= 6e+66) {
tmp = (1.0 - (0.5 * ((h * pow((M_m * (D / (d * 2.0))), 2.0)) / l))) * sqrt(((d / l) * (d / h)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-1.8d+32)) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else if (l <= 6d+66) then
tmp = (1.0d0 - (0.5d0 * ((h * ((m_m * (d_1 / (d * 2.0d0))) ** 2.0d0)) / l))) * sqrt(((d / l) * (d / h)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1.8e+32) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else if (l <= 6e+66) {
tmp = (1.0 - (0.5 * ((h * Math.pow((M_m * (D / (d * 2.0))), 2.0)) / l))) * Math.sqrt(((d / l) * (d / h)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -1.8e+32: tmp = -d * math.sqrt((1.0 / (h * l))) elif l <= 6e+66: tmp = (1.0 - (0.5 * ((h * math.pow((M_m * (D / (d * 2.0))), 2.0)) / l))) * math.sqrt(((d / l) * (d / h))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -1.8e+32) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (l <= 6e+66) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0)) / l))) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -1.8e+32)
tmp = -d * sqrt((1.0 / (h * l)));
elseif (l <= 6e+66)
tmp = (1.0 - (0.5 * ((h * ((M_m * (D / (d * 2.0))) ^ 2.0)) / l))) * sqrt(((d / l) * (d / h)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1.8e+32], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6e+66], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.8 \cdot 10^{+32}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 6 \cdot 10^{+66}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.7999999999999998e32Initial program 49.7%
Simplified50.1%
associate-*r/52.4%
frac-times52.1%
associate-/l*52.4%
*-commutative52.4%
Applied egg-rr52.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt52.4%
mul-1-neg52.4%
Simplified52.4%
if -1.7999999999999998e32 < l < 6.00000000000000005e66Initial program 71.6%
Simplified71.6%
associate-*r/74.4%
frac-times74.4%
associate-/l*74.4%
*-commutative74.4%
Applied egg-rr74.4%
pow174.4%
sqrt-unprod65.8%
Applied egg-rr65.8%
unpow165.8%
*-commutative65.8%
Simplified65.8%
if 6.00000000000000005e66 < l Initial program 46.1%
Simplified46.1%
associate-*r/44.1%
frac-times44.1%
associate-/l*44.1%
*-commutative44.1%
Applied egg-rr44.1%
Taylor expanded in d around inf 48.9%
unpow-148.9%
metadata-eval48.9%
pow-sqr49.0%
rem-sqrt-square49.0%
rem-square-sqrt48.7%
fabs-sqr48.7%
rem-square-sqrt49.0%
Simplified49.0%
*-commutative49.0%
unpow-prod-down58.9%
Applied egg-rr58.9%
Final simplification61.8%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -5.8e+35)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= l 1.7e+64)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0)))))
(* d (* (pow l -0.5) (pow h -0.5))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -5.8e+35) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (l <= 1.7e+64) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0))));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-5.8d+35)) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else if (l <= 1.7d+64) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -5.8e+35) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else if (l <= 1.7e+64) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D / d)), 2.0))));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -5.8e+35: tmp = -d * math.sqrt((1.0 / (h * l))) elif l <= 1.7e+64: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D / d)), 2.0)))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -5.8e+35) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (l <= 1.7e+64) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -5.8e+35)
tmp = -d * sqrt((1.0 / (h * l)));
elseif (l <= 1.7e+64)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * ((h / l) * (((M_m / 2.0) * (D / d)) ^ 2.0))));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -5.8e+35], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.7e+64], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.8 \cdot 10^{+35}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 1.7 \cdot 10^{+64}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -5.79999999999999989e35Initial program 49.7%
Simplified50.1%
associate-*r/52.4%
frac-times52.1%
associate-/l*52.4%
*-commutative52.4%
Applied egg-rr52.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt52.4%
mul-1-neg52.4%
Simplified52.4%
if -5.79999999999999989e35 < l < 1.7000000000000001e64Initial program 71.6%
Simplified71.6%
pow174.4%
sqrt-unprod65.8%
Applied egg-rr63.0%
unpow165.8%
*-commutative65.8%
Simplified63.0%
if 1.7000000000000001e64 < l Initial program 46.1%
Simplified46.1%
associate-*r/44.1%
frac-times44.1%
associate-/l*44.1%
*-commutative44.1%
Applied egg-rr44.1%
Taylor expanded in d around inf 48.9%
unpow-148.9%
metadata-eval48.9%
pow-sqr49.0%
rem-sqrt-square49.0%
rem-square-sqrt48.7%
fabs-sqr48.7%
rem-square-sqrt49.0%
Simplified49.0%
*-commutative49.0%
unpow-prod-down58.9%
Applied egg-rr58.9%
Final simplification60.1%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -2.8e+28)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= l 3e+64)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D (/ M_m (* d 2.0))) 2.0))))
(* d (* (pow l -0.5) (pow h -0.5))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -2.8e+28) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (l <= 3e+64) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (((h / l) * -0.5) * pow((D * (M_m / (d * 2.0))), 2.0)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-2.8d+28)) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else if (l <= 3d+64) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_1 * (m_m / (d * 2.0d0))) ** 2.0d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -2.8e+28) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else if (l <= 3e+64) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (((h / l) * -0.5) * Math.pow((D * (M_m / (d * 2.0))), 2.0)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -2.8e+28: tmp = -d * math.sqrt((1.0 / (h * l))) elif l <= 3e+64: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (((h / l) * -0.5) * math.pow((D * (M_m / (d * 2.0))), 2.0))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -2.8e+28) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (l <= 3e+64) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -2.8e+28)
tmp = -d * sqrt((1.0 / (h * l)));
elseif (l <= 3e+64)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (((h / l) * -0.5) * ((D * (M_m / (d * 2.0))) ^ 2.0)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -2.8e+28], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3e+64], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.8 \cdot 10^{+28}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 3 \cdot 10^{+64}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -2.8000000000000001e28Initial program 49.7%
Simplified50.1%
associate-*r/52.4%
frac-times52.1%
associate-/l*52.4%
*-commutative52.4%
Applied egg-rr52.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt52.4%
mul-1-neg52.4%
Simplified52.4%
if -2.8000000000000001e28 < l < 3.0000000000000002e64Initial program 71.6%
Simplified71.6%
pow171.6%
sqrt-unprod63.0%
cancel-sign-sub-inv63.0%
metadata-eval63.0%
*-commutative63.0%
frac-times63.0%
associate-/l*63.0%
*-commutative63.0%
Applied egg-rr63.0%
Simplified63.0%
if 3.0000000000000002e64 < l Initial program 46.1%
Simplified46.1%
associate-*r/44.1%
frac-times44.1%
associate-/l*44.1%
*-commutative44.1%
Applied egg-rr44.1%
Taylor expanded in d around inf 48.9%
unpow-148.9%
metadata-eval48.9%
pow-sqr49.0%
rem-sqrt-square49.0%
rem-square-sqrt48.7%
fabs-sqr48.7%
rem-square-sqrt49.0%
Simplified49.0%
*-commutative49.0%
unpow-prod-down58.9%
Applied egg-rr58.9%
Final simplification60.1%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -0.00052)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= l -5e-311)
(* d (pow 0.0 -0.5))
(* d (* (pow l -0.5) (pow h -0.5))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -0.00052) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (l <= -5e-311) {
tmp = d * pow(0.0, -0.5);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-0.00052d0)) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else if (l <= (-5d-311)) then
tmp = d * (0.0d0 ** (-0.5d0))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -0.00052) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else if (l <= -5e-311) {
tmp = d * Math.pow(0.0, -0.5);
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -0.00052: tmp = -d * math.sqrt((1.0 / (h * l))) elif l <= -5e-311: tmp = d * math.pow(0.0, -0.5) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -0.00052) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (l <= -5e-311) tmp = Float64(d * (0.0 ^ -0.5)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -0.00052)
tmp = -d * sqrt((1.0 / (h * l)));
elseif (l <= -5e-311)
tmp = d * (0.0 ^ -0.5);
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -0.00052], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-311], N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.00052:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;d \cdot {0}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -5.19999999999999954e-4Initial program 53.4%
Simplified53.7%
associate-*r/55.8%
frac-times55.5%
associate-/l*55.8%
*-commutative55.8%
Applied egg-rr55.8%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt55.6%
mul-1-neg55.6%
Simplified55.6%
if -5.19999999999999954e-4 < l < -5.00000000000023e-311Initial program 67.3%
Simplified67.3%
associate-*r/70.5%
frac-times70.6%
associate-/l*70.5%
*-commutative70.5%
Applied egg-rr70.5%
Taylor expanded in d around inf 15.2%
unpow-115.2%
metadata-eval15.2%
pow-sqr15.2%
rem-sqrt-square15.2%
rem-square-sqrt15.2%
fabs-sqr15.2%
rem-square-sqrt15.2%
Simplified15.2%
expm1-log1p-u15.2%
expm1-undefine30.3%
Applied egg-rr30.3%
sub-neg30.3%
metadata-eval30.3%
+-commutative30.3%
log1p-undefine30.3%
rem-exp-log30.3%
+-commutative30.3%
fma-define30.3%
Simplified30.3%
Taylor expanded in h around 0 47.3%
if -5.00000000000023e-311 < l Initial program 63.9%
Simplified63.9%
associate-*r/64.9%
frac-times65.0%
associate-/l*64.9%
*-commutative64.9%
Applied egg-rr64.9%
Taylor expanded in d around inf 45.8%
unpow-145.8%
metadata-eval45.8%
pow-sqr45.8%
rem-sqrt-square46.1%
rem-square-sqrt46.0%
fabs-sqr46.0%
rem-square-sqrt46.1%
Simplified46.1%
*-commutative46.1%
unpow-prod-down50.8%
Applied egg-rr50.8%
Final simplification51.0%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= l -12.2) (* (- d) (sqrt (/ 1.0 (* h l)))) (if (<= l -5e-311) (* d (pow 0.0 -0.5)) (/ d (* (sqrt h) (sqrt l))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -12.2) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (l <= -5e-311) {
tmp = d * pow(0.0, -0.5);
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-12.2d0)) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else if (l <= (-5d-311)) then
tmp = d * (0.0d0 ** (-0.5d0))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -12.2) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else if (l <= -5e-311) {
tmp = d * Math.pow(0.0, -0.5);
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -12.2: tmp = -d * math.sqrt((1.0 / (h * l))) elif l <= -5e-311: tmp = d * math.pow(0.0, -0.5) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -12.2) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (l <= -5e-311) tmp = Float64(d * (0.0 ^ -0.5)); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -12.2)
tmp = -d * sqrt((1.0 / (h * l)));
elseif (l <= -5e-311)
tmp = d * (0.0 ^ -0.5);
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -12.2], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-311], N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -12.2:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;d \cdot {0}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -12.199999999999999Initial program 53.4%
Simplified53.7%
associate-*r/55.8%
frac-times55.5%
associate-/l*55.8%
*-commutative55.8%
Applied egg-rr55.8%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt55.6%
mul-1-neg55.6%
Simplified55.6%
if -12.199999999999999 < l < -5.00000000000023e-311Initial program 67.3%
Simplified67.3%
associate-*r/70.5%
frac-times70.6%
associate-/l*70.5%
*-commutative70.5%
Applied egg-rr70.5%
Taylor expanded in d around inf 15.2%
unpow-115.2%
metadata-eval15.2%
pow-sqr15.2%
rem-sqrt-square15.2%
rem-square-sqrt15.2%
fabs-sqr15.2%
rem-square-sqrt15.2%
Simplified15.2%
expm1-log1p-u15.2%
expm1-undefine30.3%
Applied egg-rr30.3%
sub-neg30.3%
metadata-eval30.3%
+-commutative30.3%
log1p-undefine30.3%
rem-exp-log30.3%
+-commutative30.3%
fma-define30.3%
Simplified30.3%
Taylor expanded in h around 0 47.3%
if -5.00000000000023e-311 < l Initial program 63.9%
Simplified63.9%
Taylor expanded in M around 0 35.6%
sqrt-div42.6%
*-rgt-identity42.6%
sqrt-div50.6%
frac-times50.6%
add-sqr-sqrt50.8%
sqrt-prod46.2%
Applied egg-rr46.2%
*-commutative46.2%
sqrt-prod50.8%
Applied egg-rr50.8%
Final simplification51.0%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= l -0.058) (* (- d) (sqrt (/ 1.0 (* h l)))) (if (<= l -9.8e-288) (* d (pow 0.0 -0.5)) (/ d (sqrt (* h l))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -0.058) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (l <= -9.8e-288) {
tmp = d * pow(0.0, -0.5);
} else {
tmp = d / sqrt((h * l));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-0.058d0)) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else if (l <= (-9.8d-288)) then
tmp = d * (0.0d0 ** (-0.5d0))
else
tmp = d / sqrt((h * l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -0.058) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else if (l <= -9.8e-288) {
tmp = d * Math.pow(0.0, -0.5);
} else {
tmp = d / Math.sqrt((h * l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -0.058: tmp = -d * math.sqrt((1.0 / (h * l))) elif l <= -9.8e-288: tmp = d * math.pow(0.0, -0.5) else: tmp = d / math.sqrt((h * l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -0.058) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (l <= -9.8e-288) tmp = Float64(d * (0.0 ^ -0.5)); else tmp = Float64(d / sqrt(Float64(h * l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -0.058)
tmp = -d * sqrt((1.0 / (h * l)));
elseif (l <= -9.8e-288)
tmp = d * (0.0 ^ -0.5);
else
tmp = d / sqrt((h * l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -0.058], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -9.8e-288], N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.058:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq -9.8 \cdot 10^{-288}:\\
\;\;\;\;d \cdot {0}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if l < -0.0580000000000000029Initial program 53.4%
Simplified53.7%
associate-*r/55.8%
frac-times55.5%
associate-/l*55.8%
*-commutative55.8%
Applied egg-rr55.8%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt55.6%
mul-1-neg55.6%
Simplified55.6%
if -0.0580000000000000029 < l < -9.80000000000000053e-288Initial program 68.4%
Simplified68.4%
associate-*r/71.6%
frac-times71.7%
associate-/l*71.6%
*-commutative71.6%
Applied egg-rr71.6%
Taylor expanded in d around inf 15.4%
unpow-115.4%
metadata-eval15.4%
pow-sqr15.4%
rem-sqrt-square15.5%
rem-square-sqrt15.5%
fabs-sqr15.5%
rem-square-sqrt15.5%
Simplified15.5%
expm1-log1p-u15.5%
expm1-undefine30.8%
Applied egg-rr30.8%
sub-neg30.8%
metadata-eval30.8%
+-commutative30.8%
log1p-undefine30.8%
rem-exp-log30.8%
+-commutative30.8%
fma-define30.8%
Simplified30.8%
Taylor expanded in h around 0 48.1%
if -9.80000000000000053e-288 < l Initial program 63.5%
Simplified63.5%
Taylor expanded in M around 0 35.4%
sqrt-div42.3%
*-rgt-identity42.3%
sqrt-div50.2%
frac-times50.2%
add-sqr-sqrt50.4%
sqrt-prod45.8%
Applied egg-rr45.8%
Final simplification48.6%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (* h l))))
(if (<= l -0.13)
(* d (/ -1.0 t_0))
(if (<= l -9.8e-288) (* d (pow 0.0 -0.5)) (/ d t_0)))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((h * l));
double tmp;
if (l <= -0.13) {
tmp = d * (-1.0 / t_0);
} else if (l <= -9.8e-288) {
tmp = d * pow(0.0, -0.5);
} else {
tmp = d / t_0;
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((h * l))
if (l <= (-0.13d0)) then
tmp = d * ((-1.0d0) / t_0)
else if (l <= (-9.8d-288)) then
tmp = d * (0.0d0 ** (-0.5d0))
else
tmp = d / t_0
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((h * l));
double tmp;
if (l <= -0.13) {
tmp = d * (-1.0 / t_0);
} else if (l <= -9.8e-288) {
tmp = d * Math.pow(0.0, -0.5);
} else {
tmp = d / t_0;
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((h * l)) tmp = 0 if l <= -0.13: tmp = d * (-1.0 / t_0) elif l <= -9.8e-288: tmp = d * math.pow(0.0, -0.5) else: tmp = d / t_0 return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (l <= -0.13) tmp = Float64(d * Float64(-1.0 / t_0)); elseif (l <= -9.8e-288) tmp = Float64(d * (0.0 ^ -0.5)); else tmp = Float64(d / t_0); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((h * l));
tmp = 0.0;
if (l <= -0.13)
tmp = d * (-1.0 / t_0);
elseif (l <= -9.8e-288)
tmp = d * (0.0 ^ -0.5);
else
tmp = d / t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -0.13], N[(d * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -9.8e-288], N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision], N[(d / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -0.13:\\
\;\;\;\;d \cdot \frac{-1}{t\_0}\\
\mathbf{elif}\;\ell \leq -9.8 \cdot 10^{-288}:\\
\;\;\;\;d \cdot {0}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0}\\
\end{array}
\end{array}
if l < -0.13Initial program 53.4%
Simplified53.7%
associate-*r/55.8%
frac-times55.5%
associate-/l*55.8%
*-commutative55.8%
Applied egg-rr55.8%
Taylor expanded in d around inf 13.0%
unpow-113.0%
metadata-eval13.0%
pow-sqr13.0%
rem-sqrt-square13.0%
rem-square-sqrt13.0%
fabs-sqr13.0%
rem-square-sqrt13.0%
Simplified13.0%
expm1-log1p-u13.0%
expm1-undefine16.5%
Applied egg-rr16.5%
sub-neg16.5%
metadata-eval16.5%
+-commutative16.5%
log1p-undefine16.5%
rem-exp-log16.5%
+-commutative16.5%
fma-define16.5%
Simplified16.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt55.6%
neg-mul-155.6%
unpow1/255.6%
rem-exp-log52.3%
exp-neg52.3%
exp-prod52.3%
distribute-lft-neg-out52.3%
rec-exp52.3%
exp-to-pow55.5%
unpow1/255.5%
distribute-neg-frac55.5%
metadata-eval55.5%
Simplified55.5%
if -0.13 < l < -9.80000000000000053e-288Initial program 68.4%
Simplified68.4%
associate-*r/71.6%
frac-times71.7%
associate-/l*71.6%
*-commutative71.6%
Applied egg-rr71.6%
Taylor expanded in d around inf 15.4%
unpow-115.4%
metadata-eval15.4%
pow-sqr15.4%
rem-sqrt-square15.5%
rem-square-sqrt15.5%
fabs-sqr15.5%
rem-square-sqrt15.5%
Simplified15.5%
expm1-log1p-u15.5%
expm1-undefine30.8%
Applied egg-rr30.8%
sub-neg30.8%
metadata-eval30.8%
+-commutative30.8%
log1p-undefine30.8%
rem-exp-log30.8%
+-commutative30.8%
fma-define30.8%
Simplified30.8%
Taylor expanded in h around 0 48.1%
if -9.80000000000000053e-288 < l Initial program 63.5%
Simplified63.5%
Taylor expanded in M around 0 35.4%
sqrt-div42.3%
*-rgt-identity42.3%
sqrt-div50.2%
frac-times50.2%
add-sqr-sqrt50.4%
sqrt-prod45.8%
Applied egg-rr45.8%
Final simplification48.6%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (* h l))))
(if (<= l -0.00078)
(/ (- d) t_0)
(if (<= l -9.8e-288) (* d (pow 0.0 -0.5)) (/ d t_0)))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((h * l));
double tmp;
if (l <= -0.00078) {
tmp = -d / t_0;
} else if (l <= -9.8e-288) {
tmp = d * pow(0.0, -0.5);
} else {
tmp = d / t_0;
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((h * l))
if (l <= (-0.00078d0)) then
tmp = -d / t_0
else if (l <= (-9.8d-288)) then
tmp = d * (0.0d0 ** (-0.5d0))
else
tmp = d / t_0
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((h * l));
double tmp;
if (l <= -0.00078) {
tmp = -d / t_0;
} else if (l <= -9.8e-288) {
tmp = d * Math.pow(0.0, -0.5);
} else {
tmp = d / t_0;
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((h * l)) tmp = 0 if l <= -0.00078: tmp = -d / t_0 elif l <= -9.8e-288: tmp = d * math.pow(0.0, -0.5) else: tmp = d / t_0 return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (l <= -0.00078) tmp = Float64(Float64(-d) / t_0); elseif (l <= -9.8e-288) tmp = Float64(d * (0.0 ^ -0.5)); else tmp = Float64(d / t_0); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((h * l));
tmp = 0.0;
if (l <= -0.00078)
tmp = -d / t_0;
elseif (l <= -9.8e-288)
tmp = d * (0.0 ^ -0.5);
else
tmp = d / t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -0.00078], N[((-d) / t$95$0), $MachinePrecision], If[LessEqual[l, -9.8e-288], N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision], N[(d / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -0.00078:\\
\;\;\;\;\frac{-d}{t\_0}\\
\mathbf{elif}\;\ell \leq -9.8 \cdot 10^{-288}:\\
\;\;\;\;d \cdot {0}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0}\\
\end{array}
\end{array}
if l < -7.79999999999999986e-4Initial program 53.4%
Simplified53.7%
add-sqr-sqrt53.7%
pow253.7%
sqrt-prod53.7%
sqrt-pow157.0%
metadata-eval57.0%
frac-times58.6%
associate-/l*57.0%
pow157.0%
*-commutative57.0%
Applied egg-rr57.0%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
*-commutative0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt55.6%
neg-mul-155.6%
unpow1/255.6%
rem-exp-log52.3%
exp-neg52.3%
exp-prod52.3%
distribute-lft-neg-out52.3%
rec-exp52.3%
exp-to-pow55.5%
unpow1/255.5%
distribute-neg-frac55.5%
metadata-eval55.5%
/-rgt-identity55.5%
Simplified55.5%
if -7.79999999999999986e-4 < l < -9.80000000000000053e-288Initial program 68.4%
Simplified68.4%
associate-*r/71.6%
frac-times71.7%
associate-/l*71.6%
*-commutative71.6%
Applied egg-rr71.6%
Taylor expanded in d around inf 15.4%
unpow-115.4%
metadata-eval15.4%
pow-sqr15.4%
rem-sqrt-square15.5%
rem-square-sqrt15.5%
fabs-sqr15.5%
rem-square-sqrt15.5%
Simplified15.5%
expm1-log1p-u15.5%
expm1-undefine30.8%
Applied egg-rr30.8%
sub-neg30.8%
metadata-eval30.8%
+-commutative30.8%
log1p-undefine30.8%
rem-exp-log30.8%
+-commutative30.8%
fma-define30.8%
Simplified30.8%
Taylor expanded in h around 0 48.1%
if -9.80000000000000053e-288 < l Initial program 63.5%
Simplified63.5%
Taylor expanded in M around 0 35.4%
sqrt-div42.3%
*-rgt-identity42.3%
sqrt-div50.2%
frac-times50.2%
add-sqr-sqrt50.4%
sqrt-prod45.8%
Applied egg-rr45.8%
Final simplification48.6%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= d -3e-273) (* d (pow 0.0 -0.5)) (/ d (sqrt (* h l)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -3e-273) {
tmp = d * pow(0.0, -0.5);
} else {
tmp = d / sqrt((h * l));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-3d-273)) then
tmp = d * (0.0d0 ** (-0.5d0))
else
tmp = d / sqrt((h * l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -3e-273) {
tmp = d * Math.pow(0.0, -0.5);
} else {
tmp = d / Math.sqrt((h * l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= -3e-273: tmp = d * math.pow(0.0, -0.5) else: tmp = d / math.sqrt((h * l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -3e-273) tmp = Float64(d * (0.0 ^ -0.5)); else tmp = Float64(d / sqrt(Float64(h * l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= -3e-273)
tmp = d * (0.0 ^ -0.5);
else
tmp = d / sqrt((h * l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -3e-273], N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3 \cdot 10^{-273}:\\
\;\;\;\;d \cdot {0}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if d < -2.99999999999999987e-273Initial program 63.7%
Simplified63.8%
associate-*r/66.7%
frac-times66.6%
associate-/l*66.7%
*-commutative66.7%
Applied egg-rr66.7%
Taylor expanded in d around inf 12.4%
unpow-112.4%
metadata-eval12.4%
pow-sqr12.4%
rem-sqrt-square12.4%
rem-square-sqrt12.4%
fabs-sqr12.4%
rem-square-sqrt12.4%
Simplified12.4%
expm1-log1p-u12.4%
expm1-undefine22.8%
Applied egg-rr22.8%
sub-neg22.8%
metadata-eval22.8%
+-commutative22.8%
log1p-undefine22.8%
rem-exp-log22.8%
+-commutative22.8%
fma-define22.8%
Simplified22.8%
Taylor expanded in h around 0 31.8%
if -2.99999999999999987e-273 < d Initial program 61.4%
Simplified61.4%
Taylor expanded in M around 0 34.9%
sqrt-div39.9%
*-rgt-identity39.9%
sqrt-div47.4%
frac-times47.4%
add-sqr-sqrt47.6%
sqrt-prod45.5%
Applied egg-rr45.5%
Final simplification39.5%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (/ d (sqrt (* h l))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
return d / sqrt((h * l));
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
code = d / sqrt((h * l))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
return d / Math.sqrt((h * l));
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): return d / math.sqrt((h * l))
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) return Float64(d / sqrt(Float64(h * l))) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
tmp = d / sqrt((h * l));
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 62.4%
Simplified61.8%
Taylor expanded in M around 0 34.9%
sqrt-div22.5%
*-rgt-identity22.5%
sqrt-div26.7%
frac-times26.7%
add-sqr-sqrt26.8%
sqrt-prod31.0%
Applied egg-rr31.0%
herbie shell --seed 2024110
(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)))))