
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
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 -2.45e-290)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(- 1.0 (* 0.5 (pow (* (* (* 0.5 M_m) (/ D d)) (sqrt (/ h l))) 2.0))))
(if (<= d 1.3e-218)
(*
-0.125
(* (/ (pow D 2.0) (/ d (pow M_m 2.0))) (/ (sqrt h) (pow l 1.5))))
(*
(+ 1.0 (* (/ h l) (* (pow (* 0.5 (* M_m (/ D d))) 2.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 (d <= -2.45e-290) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * pow((((0.5 * M_m) * (D / d)) * sqrt((h / l))), 2.0)));
} else if (d <= 1.3e-218) {
tmp = -0.125 * ((pow(D, 2.0) / (d / pow(M_m, 2.0))) * (sqrt(h) / pow(l, 1.5)));
} else {
tmp = (1.0 + ((h / l) * (pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (d <= (-2.45d-290)) then
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0d0 - (0.5d0 * ((((0.5d0 * m_m) * (d_1 / d)) * sqrt((h / l))) ** 2.0d0)))
else if (d <= 1.3d-218) then
tmp = (-0.125d0) * (((d_1 ** 2.0d0) / (d / (m_m ** 2.0d0))) * (sqrt(h) / (l ** 1.5d0)))
else
tmp = (1.0d0 + ((h / l) * (((0.5d0 * (m_m * (d_1 / d))) ** 2.0d0) * (-0.5d0)))) * (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 (d <= -2.45e-290) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l))) * (1.0 - (0.5 * Math.pow((((0.5 * M_m) * (D / d)) * Math.sqrt((h / l))), 2.0)));
} else if (d <= 1.3e-218) {
tmp = -0.125 * ((Math.pow(D, 2.0) / (d / Math.pow(M_m, 2.0))) * (Math.sqrt(h) / Math.pow(l, 1.5)));
} else {
tmp = (1.0 + ((h / l) * (Math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 d <= -2.45e-290: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l))) * (1.0 - (0.5 * math.pow((((0.5 * M_m) * (D / d)) * math.sqrt((h / l))), 2.0))) elif d <= 1.3e-218: tmp = -0.125 * ((math.pow(D, 2.0) / (d / math.pow(M_m, 2.0))) * (math.sqrt(h) / math.pow(l, 1.5))) else: tmp = (1.0 + ((h / l) * (math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (d <= -2.45e-290) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(0.5 * M_m) * Float64(D / d)) * sqrt(Float64(h / l))) ^ 2.0)))); elseif (d <= 1.3e-218) tmp = Float64(-0.125 * Float64(Float64((D ^ 2.0) / Float64(d / (M_m ^ 2.0))) * Float64(sqrt(h) / (l ^ 1.5)))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(0.5 * Float64(M_m * Float64(D / d))) ^ 2.0) * -0.5))) * 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 (d <= -2.45e-290)
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * ((((0.5 * M_m) * (D / d)) * sqrt((h / l))) ^ 2.0)));
elseif (d <= 1.3e-218)
tmp = -0.125 * (((D ^ 2.0) / (d / (M_m ^ 2.0))) * (sqrt(h) / (l ^ 1.5)));
else
tmp = (1.0 + ((h / l) * (((0.5 * (M_m * (D / d))) ^ 2.0) * -0.5))) * (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[d, -2.45e-290], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(0.5 * M$95$m), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.3e-218], N[(-0.125 * N[(N[(N[Power[D, 2.0], $MachinePrecision] / N[(d / N[Power[M$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(0.5 * N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $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}
\mathbf{if}\;d \leq -2.45 \cdot 10^{-290}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\left(0.5 \cdot M_m\right) \cdot \frac{D}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\
\mathbf{elif}\;d \leq 1.3 \cdot 10^{-218}:\\
\;\;\;\;-0.125 \cdot \left(\frac{{D}^{2}}{\frac{d}{{M_m}^{2}}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left({\left(0.5 \cdot \left(M_m \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.45e-290Initial program 68.2%
Simplified67.9%
add-sqr-sqrt67.8%
pow267.8%
sqrt-prod67.8%
sqrt-pow170.1%
metadata-eval70.1%
pow170.1%
div-inv70.1%
metadata-eval70.1%
Applied egg-rr70.1%
frac-2neg70.1%
sqrt-div81.1%
Applied egg-rr81.1%
if -2.45e-290 < d < 1.29999999999999992e-218Initial program 19.9%
Simplified19.9%
Taylor expanded in d around 0 40.7%
associate-/l*45.3%
Simplified45.3%
sqrt-div45.5%
Applied egg-rr45.5%
sqr-pow45.5%
rem-sqrt-square60.8%
metadata-eval60.8%
sqr-pow60.8%
fabs-sqr60.8%
sqr-pow60.8%
Simplified60.8%
if 1.29999999999999992e-218 < d Initial program 72.3%
Simplified72.1%
sub-neg72.1%
distribute-rgt-in56.0%
*-un-lft-identity56.0%
*-commutative56.0%
sqrt-div66.7%
sqrt-div67.6%
frac-times67.5%
add-sqr-sqrt67.7%
Applied egg-rr77.0%
distribute-rgt1-in86.3%
+-commutative86.3%
*-commutative86.3%
associate-*r*86.3%
Simplified86.3%
Final simplification81.7%
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 (<= h -6.6e-46)
(*
(- 1.0 (* 0.5 (pow (* (* (* 0.5 M_m) (/ D d)) (sqrt (/ h l))) 2.0)))
(* (sqrt (/ d h)) (/ 1.0 (sqrt (/ l d)))))
(if (<= h 1.4e-293)
(*
(* (pow (* h l) -0.5) (fabs d))
(- 1.0 (* (/ h l) (* 0.5 (pow (* M_m (* 0.5 (/ D d))) 2.0)))))
(*
(+ 1.0 (* (/ h l) (* (pow (* 0.5 (* M_m (/ D d))) 2.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 (h <= -6.6e-46) {
tmp = (1.0 - (0.5 * pow((((0.5 * M_m) * (D / d)) * sqrt((h / l))), 2.0))) * (sqrt((d / h)) * (1.0 / sqrt((l / d))));
} else if (h <= 1.4e-293) {
tmp = (pow((h * l), -0.5) * fabs(d)) * (1.0 - ((h / l) * (0.5 * pow((M_m * (0.5 * (D / d))), 2.0))));
} else {
tmp = (1.0 + ((h / l) * (pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (h <= (-6.6d-46)) then
tmp = (1.0d0 - (0.5d0 * ((((0.5d0 * m_m) * (d_1 / d)) * sqrt((h / l))) ** 2.0d0))) * (sqrt((d / h)) * (1.0d0 / sqrt((l / d))))
else if (h <= 1.4d-293) then
tmp = (((h * l) ** (-0.5d0)) * abs(d)) * (1.0d0 - ((h / l) * (0.5d0 * ((m_m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
else
tmp = (1.0d0 + ((h / l) * (((0.5d0 * (m_m * (d_1 / d))) ** 2.0d0) * (-0.5d0)))) * (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 (h <= -6.6e-46) {
tmp = (1.0 - (0.5 * Math.pow((((0.5 * M_m) * (D / d)) * Math.sqrt((h / l))), 2.0))) * (Math.sqrt((d / h)) * (1.0 / Math.sqrt((l / d))));
} else if (h <= 1.4e-293) {
tmp = (Math.pow((h * l), -0.5) * Math.abs(d)) * (1.0 - ((h / l) * (0.5 * Math.pow((M_m * (0.5 * (D / d))), 2.0))));
} else {
tmp = (1.0 + ((h / l) * (Math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 h <= -6.6e-46: tmp = (1.0 - (0.5 * math.pow((((0.5 * M_m) * (D / d)) * math.sqrt((h / l))), 2.0))) * (math.sqrt((d / h)) * (1.0 / math.sqrt((l / d)))) elif h <= 1.4e-293: tmp = (math.pow((h * l), -0.5) * math.fabs(d)) * (1.0 - ((h / l) * (0.5 * math.pow((M_m * (0.5 * (D / d))), 2.0)))) else: tmp = (1.0 + ((h / l) * (math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (h <= -6.6e-46) tmp = Float64(Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(0.5 * M_m) * Float64(D / d)) * sqrt(Float64(h / l))) ^ 2.0))) * Float64(sqrt(Float64(d / h)) * Float64(1.0 / sqrt(Float64(l / d))))); elseif (h <= 1.4e-293) tmp = Float64(Float64((Float64(h * l) ^ -0.5) * abs(d)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(M_m * Float64(0.5 * Float64(D / d))) ^ 2.0))))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(0.5 * Float64(M_m * Float64(D / d))) ^ 2.0) * -0.5))) * 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 (h <= -6.6e-46)
tmp = (1.0 - (0.5 * ((((0.5 * M_m) * (D / d)) * sqrt((h / l))) ^ 2.0))) * (sqrt((d / h)) * (1.0 / sqrt((l / d))));
elseif (h <= 1.4e-293)
tmp = (((h * l) ^ -0.5) * abs(d)) * (1.0 - ((h / l) * (0.5 * ((M_m * (0.5 * (D / d))) ^ 2.0))));
else
tmp = (1.0 + ((h / l) * (((0.5 * (M_m * (D / d))) ^ 2.0) * -0.5))) * (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[h, -6.6e-46], N[(N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(0.5 * M$95$m), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.4e-293], N[(N[(N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(M$95$m * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(0.5 * N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $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}
\mathbf{if}\;h \leq -6.6 \cdot 10^{-46}:\\
\;\;\;\;\left(1 - 0.5 \cdot {\left(\left(\left(0.5 \cdot M_m\right) \cdot \frac{D}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right)\\
\mathbf{elif}\;h \leq 1.4 \cdot 10^{-293}:\\
\;\;\;\;\left({\left(h \cdot \ell\right)}^{-0.5} \cdot \left|d\right|\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M_m \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left({\left(0.5 \cdot \left(M_m \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -6.60000000000000027e-46Initial program 72.0%
Simplified71.5%
add-sqr-sqrt71.5%
pow271.5%
sqrt-prod71.5%
sqrt-pow175.3%
metadata-eval75.3%
pow175.3%
div-inv75.3%
metadata-eval75.3%
Applied egg-rr75.3%
clear-num75.4%
sqrt-div75.4%
metadata-eval75.4%
Applied egg-rr75.4%
if -6.60000000000000027e-46 < h < 1.40000000000000013e-293Initial program 60.1%
Simplified60.0%
add-sqr-sqrt60.0%
pow260.0%
sqrt-prod60.0%
sqrt-pow160.0%
metadata-eval60.0%
pow160.0%
div-inv60.0%
metadata-eval60.0%
Applied egg-rr60.0%
Applied egg-rr21.6%
expm1-def26.4%
expm1-log1p54.1%
*-commutative54.1%
Simplified54.1%
pow1/254.1%
frac-times48.7%
unpow248.7%
div-inv48.7%
unpow-prod-down53.3%
pow1/253.3%
inv-pow53.3%
pow-pow53.3%
metadata-eval53.3%
*-commutative53.3%
Applied egg-rr53.3%
*-commutative53.3%
*-commutative53.3%
unpow253.3%
rem-sqrt-square80.8%
Simplified80.8%
if 1.40000000000000013e-293 < h Initial program 65.6%
Simplified65.4%
sub-neg65.4%
distribute-rgt-in52.0%
*-un-lft-identity52.0%
*-commutative52.0%
sqrt-div61.5%
sqrt-div62.3%
frac-times62.2%
add-sqr-sqrt62.4%
Applied egg-rr73.9%
distribute-rgt1-in81.3%
+-commutative81.3%
*-commutative81.3%
associate-*r*81.3%
Simplified81.3%
Final simplification79.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
(if (<= d -2.45e-290)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ D d) (/ M_m 2.0)) 2.0))))))
(if (<= d 7.5e-214)
(*
-0.125
(* (/ (pow D 2.0) (/ d (pow M_m 2.0))) (/ (sqrt h) (pow l 1.5))))
(*
(+ 1.0 (* (/ h l) (* (pow (* 0.5 (* M_m (/ D d))) 2.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 (d <= -2.45e-290) {
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * pow(((D / d) * (M_m / 2.0)), 2.0)))));
} else if (d <= 7.5e-214) {
tmp = -0.125 * ((pow(D, 2.0) / (d / pow(M_m, 2.0))) * (sqrt(h) / pow(l, 1.5)));
} else {
tmp = (1.0 + ((h / l) * (pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (d <= (-2.45d-290)) then
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0d0 + ((h / l) * ((-0.5d0) * (((d_1 / d) * (m_m / 2.0d0)) ** 2.0d0)))))
else if (d <= 7.5d-214) then
tmp = (-0.125d0) * (((d_1 ** 2.0d0) / (d / (m_m ** 2.0d0))) * (sqrt(h) / (l ** 1.5d0)))
else
tmp = (1.0d0 + ((h / l) * (((0.5d0 * (m_m * (d_1 / d))) ** 2.0d0) * (-0.5d0)))) * (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 (d <= -2.45e-290) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (Math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * Math.pow(((D / d) * (M_m / 2.0)), 2.0)))));
} else if (d <= 7.5e-214) {
tmp = -0.125 * ((Math.pow(D, 2.0) / (d / Math.pow(M_m, 2.0))) * (Math.sqrt(h) / Math.pow(l, 1.5)));
} else {
tmp = (1.0 + ((h / l) * (Math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 d <= -2.45e-290: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * math.pow(((D / d) * (M_m / 2.0)), 2.0))))) elif d <= 7.5e-214: tmp = -0.125 * ((math.pow(D, 2.0) / (d / math.pow(M_m, 2.0))) * (math.sqrt(h) / math.pow(l, 1.5))) else: tmp = (1.0 + ((h / l) * (math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (d <= -2.45e-290) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D / d) * Float64(M_m / 2.0)) ^ 2.0)))))); elseif (d <= 7.5e-214) tmp = Float64(-0.125 * Float64(Float64((D ^ 2.0) / Float64(d / (M_m ^ 2.0))) * Float64(sqrt(h) / (l ^ 1.5)))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(0.5 * Float64(M_m * Float64(D / d))) ^ 2.0) * -0.5))) * 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 (d <= -2.45e-290)
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * (((D / d) * (M_m / 2.0)) ^ 2.0)))));
elseif (d <= 7.5e-214)
tmp = -0.125 * (((D ^ 2.0) / (d / (M_m ^ 2.0))) * (sqrt(h) / (l ^ 1.5)));
else
tmp = (1.0 + ((h / l) * (((0.5 * (M_m * (D / d))) ^ 2.0) * -0.5))) * (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[d, -2.45e-290], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.5e-214], N[(-0.125 * N[(N[(N[Power[D, 2.0], $MachinePrecision] / N[(d / N[Power[M$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(0.5 * N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $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}
\mathbf{if}\;d \leq -2.45 \cdot 10^{-290}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D}{d} \cdot \frac{M_m}{2}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;d \leq 7.5 \cdot 10^{-214}:\\
\;\;\;\;-0.125 \cdot \left(\frac{{D}^{2}}{\frac{d}{{M_m}^{2}}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left({\left(0.5 \cdot \left(M_m \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.45e-290Initial program 68.2%
Simplified67.8%
frac-2neg70.1%
sqrt-div81.1%
Applied egg-rr79.1%
if -2.45e-290 < d < 7.49999999999999966e-214Initial program 19.9%
Simplified19.9%
Taylor expanded in d around 0 40.7%
associate-/l*45.3%
Simplified45.3%
sqrt-div45.5%
Applied egg-rr45.5%
sqr-pow45.5%
rem-sqrt-square60.8%
metadata-eval60.8%
sqr-pow60.8%
fabs-sqr60.8%
sqr-pow60.8%
Simplified60.8%
if 7.49999999999999966e-214 < d Initial program 72.3%
Simplified72.1%
sub-neg72.1%
distribute-rgt-in56.0%
*-un-lft-identity56.0%
*-commutative56.0%
sqrt-div66.7%
sqrt-div67.6%
frac-times67.5%
add-sqr-sqrt67.7%
Applied egg-rr77.0%
distribute-rgt1-in86.3%
+-commutative86.3%
*-commutative86.3%
associate-*r*86.3%
Simplified86.3%
Final simplification80.7%
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 (<= h -2.15e-47)
(*
(- 1.0 (* 0.5 (pow (* (* (* 0.5 M_m) (/ D d)) (sqrt (/ h l))) 2.0)))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(if (<= h 1.4e-293)
(*
(* (pow (* h l) -0.5) (fabs d))
(- 1.0 (* (/ h l) (* 0.5 (pow (* M_m (* 0.5 (/ D d))) 2.0)))))
(*
(+ 1.0 (* (/ h l) (* (pow (* 0.5 (* M_m (/ D d))) 2.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 (h <= -2.15e-47) {
tmp = (1.0 - (0.5 * pow((((0.5 * M_m) * (D / d)) * sqrt((h / l))), 2.0))) * (sqrt((d / l)) * sqrt((d / h)));
} else if (h <= 1.4e-293) {
tmp = (pow((h * l), -0.5) * fabs(d)) * (1.0 - ((h / l) * (0.5 * pow((M_m * (0.5 * (D / d))), 2.0))));
} else {
tmp = (1.0 + ((h / l) * (pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (h <= (-2.15d-47)) then
tmp = (1.0d0 - (0.5d0 * ((((0.5d0 * m_m) * (d_1 / d)) * sqrt((h / l))) ** 2.0d0))) * (sqrt((d / l)) * sqrt((d / h)))
else if (h <= 1.4d-293) then
tmp = (((h * l) ** (-0.5d0)) * abs(d)) * (1.0d0 - ((h / l) * (0.5d0 * ((m_m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
else
tmp = (1.0d0 + ((h / l) * (((0.5d0 * (m_m * (d_1 / d))) ** 2.0d0) * (-0.5d0)))) * (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 (h <= -2.15e-47) {
tmp = (1.0 - (0.5 * Math.pow((((0.5 * M_m) * (D / d)) * Math.sqrt((h / l))), 2.0))) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
} else if (h <= 1.4e-293) {
tmp = (Math.pow((h * l), -0.5) * Math.abs(d)) * (1.0 - ((h / l) * (0.5 * Math.pow((M_m * (0.5 * (D / d))), 2.0))));
} else {
tmp = (1.0 + ((h / l) * (Math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 h <= -2.15e-47: tmp = (1.0 - (0.5 * math.pow((((0.5 * M_m) * (D / d)) * math.sqrt((h / l))), 2.0))) * (math.sqrt((d / l)) * math.sqrt((d / h))) elif h <= 1.4e-293: tmp = (math.pow((h * l), -0.5) * math.fabs(d)) * (1.0 - ((h / l) * (0.5 * math.pow((M_m * (0.5 * (D / d))), 2.0)))) else: tmp = (1.0 + ((h / l) * (math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (h <= -2.15e-47) tmp = Float64(Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(0.5 * M_m) * Float64(D / d)) * sqrt(Float64(h / l))) ^ 2.0))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); elseif (h <= 1.4e-293) tmp = Float64(Float64((Float64(h * l) ^ -0.5) * abs(d)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(M_m * Float64(0.5 * Float64(D / d))) ^ 2.0))))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(0.5 * Float64(M_m * Float64(D / d))) ^ 2.0) * -0.5))) * 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 (h <= -2.15e-47)
tmp = (1.0 - (0.5 * ((((0.5 * M_m) * (D / d)) * sqrt((h / l))) ^ 2.0))) * (sqrt((d / l)) * sqrt((d / h)));
elseif (h <= 1.4e-293)
tmp = (((h * l) ^ -0.5) * abs(d)) * (1.0 - ((h / l) * (0.5 * ((M_m * (0.5 * (D / d))) ^ 2.0))));
else
tmp = (1.0 + ((h / l) * (((0.5 * (M_m * (D / d))) ^ 2.0) * -0.5))) * (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[h, -2.15e-47], N[(N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(0.5 * M$95$m), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.4e-293], N[(N[(N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(M$95$m * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(0.5 * N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $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}
\mathbf{if}\;h \leq -2.15 \cdot 10^{-47}:\\
\;\;\;\;\left(1 - 0.5 \cdot {\left(\left(\left(0.5 \cdot M_m\right) \cdot \frac{D}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;h \leq 1.4 \cdot 10^{-293}:\\
\;\;\;\;\left({\left(h \cdot \ell\right)}^{-0.5} \cdot \left|d\right|\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M_m \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left({\left(0.5 \cdot \left(M_m \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -2.1499999999999999e-47Initial program 72.0%
Simplified71.5%
add-sqr-sqrt71.5%
pow271.5%
sqrt-prod71.5%
sqrt-pow175.3%
metadata-eval75.3%
pow175.3%
div-inv75.3%
metadata-eval75.3%
Applied egg-rr75.3%
if -2.1499999999999999e-47 < h < 1.40000000000000013e-293Initial program 60.1%
Simplified60.0%
add-sqr-sqrt60.0%
pow260.0%
sqrt-prod60.0%
sqrt-pow160.0%
metadata-eval60.0%
pow160.0%
div-inv60.0%
metadata-eval60.0%
Applied egg-rr60.0%
Applied egg-rr21.6%
expm1-def26.4%
expm1-log1p54.1%
*-commutative54.1%
Simplified54.1%
pow1/254.1%
frac-times48.7%
unpow248.7%
div-inv48.7%
unpow-prod-down53.3%
pow1/253.3%
inv-pow53.3%
pow-pow53.3%
metadata-eval53.3%
*-commutative53.3%
Applied egg-rr53.3%
*-commutative53.3%
*-commutative53.3%
unpow253.3%
rem-sqrt-square80.8%
Simplified80.8%
if 1.40000000000000013e-293 < h Initial program 65.6%
Simplified65.4%
sub-neg65.4%
distribute-rgt-in52.0%
*-un-lft-identity52.0%
*-commutative52.0%
sqrt-div61.5%
sqrt-div62.3%
frac-times62.2%
add-sqr-sqrt62.4%
Applied egg-rr73.9%
distribute-rgt1-in81.3%
+-commutative81.3%
*-commutative81.3%
associate-*r*81.3%
Simplified81.3%
Final simplification79.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
(let* ((t_0 (pow (* M_m (* 0.5 (/ D d))) 2.0)))
(if (<= h -3.2e+116)
(* (sqrt (* (/ d l) (/ d h))) (- 1.0 (/ (* t_0 (* h 0.5)) l)))
(if (<= h 1.4e-293)
(* (* (pow (* h l) -0.5) (fabs d)) (- 1.0 (* (/ h l) (* 0.5 t_0))))
(*
(+ 1.0 (* (/ h l) (* (pow (* 0.5 (* M_m (/ D d))) 2.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 t_0 = pow((M_m * (0.5 * (D / d))), 2.0);
double tmp;
if (h <= -3.2e+116) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((t_0 * (h * 0.5)) / l));
} else if (h <= 1.4e-293) {
tmp = (pow((h * l), -0.5) * fabs(d)) * (1.0 - ((h / l) * (0.5 * t_0)));
} else {
tmp = (1.0 + ((h / l) * (pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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) :: t_0
real(8) :: tmp
t_0 = (m_m * (0.5d0 * (d_1 / d))) ** 2.0d0
if (h <= (-3.2d+116)) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - ((t_0 * (h * 0.5d0)) / l))
else if (h <= 1.4d-293) then
tmp = (((h * l) ** (-0.5d0)) * abs(d)) * (1.0d0 - ((h / l) * (0.5d0 * t_0)))
else
tmp = (1.0d0 + ((h / l) * (((0.5d0 * (m_m * (d_1 / d))) ** 2.0d0) * (-0.5d0)))) * (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 t_0 = Math.pow((M_m * (0.5 * (D / d))), 2.0);
double tmp;
if (h <= -3.2e+116) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - ((t_0 * (h * 0.5)) / l));
} else if (h <= 1.4e-293) {
tmp = (Math.pow((h * l), -0.5) * Math.abs(d)) * (1.0 - ((h / l) * (0.5 * t_0)));
} else {
tmp = (1.0 + ((h / l) * (Math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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): t_0 = math.pow((M_m * (0.5 * (D / d))), 2.0) tmp = 0 if h <= -3.2e+116: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - ((t_0 * (h * 0.5)) / l)) elif h <= 1.4e-293: tmp = (math.pow((h * l), -0.5) * math.fabs(d)) * (1.0 - ((h / l) * (0.5 * t_0))) else: tmp = (1.0 + ((h / l) * (math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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) t_0 = Float64(M_m * Float64(0.5 * Float64(D / d))) ^ 2.0 tmp = 0.0 if (h <= -3.2e+116) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64(t_0 * Float64(h * 0.5)) / l))); elseif (h <= 1.4e-293) tmp = Float64(Float64((Float64(h * l) ^ -0.5) * abs(d)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * t_0)))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(0.5 * Float64(M_m * Float64(D / d))) ^ 2.0) * -0.5))) * 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)
t_0 = (M_m * (0.5 * (D / d))) ^ 2.0;
tmp = 0.0;
if (h <= -3.2e+116)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((t_0 * (h * 0.5)) / l));
elseif (h <= 1.4e-293)
tmp = (((h * l) ^ -0.5) * abs(d)) * (1.0 - ((h / l) * (0.5 * t_0)));
else
tmp = (1.0 + ((h / l) * (((0.5 * (M_m * (D / d))) ^ 2.0) * -0.5))) * (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_] := Block[{t$95$0 = N[Power[N[(M$95$m * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[h, -3.2e+116], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(t$95$0 * N[(h * 0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.4e-293], N[(N[(N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(0.5 * N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $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 := {\left(M_m \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\\
\mathbf{if}\;h \leq -3.2 \cdot 10^{+116}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{t_0 \cdot \left(h \cdot 0.5\right)}{\ell}\right)\\
\mathbf{elif}\;h \leq 1.4 \cdot 10^{-293}:\\
\;\;\;\;\left({\left(h \cdot \ell\right)}^{-0.5} \cdot \left|d\right|\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot t_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left({\left(0.5 \cdot \left(M_m \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -3.2e116Initial program 65.6%
Simplified62.6%
add-sqr-sqrt62.5%
pow262.5%
sqrt-prod62.5%
sqrt-pow165.1%
metadata-eval65.1%
pow165.1%
div-inv65.1%
metadata-eval65.1%
Applied egg-rr65.1%
Applied egg-rr14.2%
expm1-def26.5%
expm1-log1p59.9%
*-commutative59.9%
Simplified59.9%
associate-*l/61.1%
Applied egg-rr61.1%
associate-*r*61.2%
Simplified61.2%
if -3.2e116 < h < 1.40000000000000013e-293Initial program 67.0%
Simplified67.8%
add-sqr-sqrt67.8%
pow267.8%
sqrt-prod67.8%
sqrt-pow169.7%
metadata-eval69.7%
pow169.7%
div-inv69.7%
metadata-eval69.7%
Applied egg-rr69.7%
Applied egg-rr20.7%
expm1-def25.6%
expm1-log1p56.3%
*-commutative56.3%
Simplified56.3%
pow1/256.3%
frac-times50.0%
unpow250.0%
div-inv50.0%
unpow-prod-down55.7%
pow1/255.7%
inv-pow55.7%
pow-pow55.8%
metadata-eval55.8%
*-commutative55.8%
Applied egg-rr55.8%
*-commutative55.8%
*-commutative55.8%
unpow255.8%
rem-sqrt-square80.2%
Simplified80.2%
if 1.40000000000000013e-293 < h Initial program 65.6%
Simplified65.4%
sub-neg65.4%
distribute-rgt-in52.0%
*-un-lft-identity52.0%
*-commutative52.0%
sqrt-div61.5%
sqrt-div62.3%
frac-times62.2%
add-sqr-sqrt62.4%
Applied egg-rr73.9%
distribute-rgt1-in81.3%
+-commutative81.3%
*-commutative81.3%
associate-*r*81.3%
Simplified81.3%
Final simplification78.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 (<= h -3.8e+63)
(*
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ D d) (/ M_m 2.0)) 2.0)))))
(sqrt (/ d h)))
(if (<= h 1.4e-293)
(*
(* (pow (* h l) -0.5) (fabs d))
(- 1.0 (* (/ h l) (* 0.5 (pow (* M_m (* 0.5 (/ D d))) 2.0)))))
(*
(+ 1.0 (* (/ h l) (* (pow (* 0.5 (* M_m (/ D d))) 2.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 (h <= -3.8e+63) {
tmp = (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * pow(((D / d) * (M_m / 2.0)), 2.0))))) * sqrt((d / h));
} else if (h <= 1.4e-293) {
tmp = (pow((h * l), -0.5) * fabs(d)) * (1.0 - ((h / l) * (0.5 * pow((M_m * (0.5 * (D / d))), 2.0))));
} else {
tmp = (1.0 + ((h / l) * (pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (h <= (-3.8d+63)) then
tmp = (sqrt((d / l)) * (1.0d0 + ((h / l) * ((-0.5d0) * (((d_1 / d) * (m_m / 2.0d0)) ** 2.0d0))))) * sqrt((d / h))
else if (h <= 1.4d-293) then
tmp = (((h * l) ** (-0.5d0)) * abs(d)) * (1.0d0 - ((h / l) * (0.5d0 * ((m_m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
else
tmp = (1.0d0 + ((h / l) * (((0.5d0 * (m_m * (d_1 / d))) ** 2.0d0) * (-0.5d0)))) * (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 (h <= -3.8e+63) {
tmp = (Math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * Math.pow(((D / d) * (M_m / 2.0)), 2.0))))) * Math.sqrt((d / h));
} else if (h <= 1.4e-293) {
tmp = (Math.pow((h * l), -0.5) * Math.abs(d)) * (1.0 - ((h / l) * (0.5 * Math.pow((M_m * (0.5 * (D / d))), 2.0))));
} else {
tmp = (1.0 + ((h / l) * (Math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 h <= -3.8e+63: tmp = (math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * math.pow(((D / d) * (M_m / 2.0)), 2.0))))) * math.sqrt((d / h)) elif h <= 1.4e-293: tmp = (math.pow((h * l), -0.5) * math.fabs(d)) * (1.0 - ((h / l) * (0.5 * math.pow((M_m * (0.5 * (D / d))), 2.0)))) else: tmp = (1.0 + ((h / l) * (math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (h <= -3.8e+63) tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D / d) * Float64(M_m / 2.0)) ^ 2.0))))) * sqrt(Float64(d / h))); elseif (h <= 1.4e-293) tmp = Float64(Float64((Float64(h * l) ^ -0.5) * abs(d)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(M_m * Float64(0.5 * Float64(D / d))) ^ 2.0))))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(0.5 * Float64(M_m * Float64(D / d))) ^ 2.0) * -0.5))) * 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 (h <= -3.8e+63)
tmp = (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * (((D / d) * (M_m / 2.0)) ^ 2.0))))) * sqrt((d / h));
elseif (h <= 1.4e-293)
tmp = (((h * l) ^ -0.5) * abs(d)) * (1.0 - ((h / l) * (0.5 * ((M_m * (0.5 * (D / d))) ^ 2.0))));
else
tmp = (1.0 + ((h / l) * (((0.5 * (M_m * (D / d))) ^ 2.0) * -0.5))) * (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[h, -3.8e+63], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.4e-293], N[(N[(N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(M$95$m * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(0.5 * N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $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}
\mathbf{if}\;h \leq -3.8 \cdot 10^{+63}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D}{d} \cdot \frac{M_m}{2}\right)}^{2}\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;h \leq 1.4 \cdot 10^{-293}:\\
\;\;\;\;\left({\left(h \cdot \ell\right)}^{-0.5} \cdot \left|d\right|\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M_m \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left({\left(0.5 \cdot \left(M_m \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -3.8000000000000001e63Initial program 71.6%
Simplified69.1%
if -3.8000000000000001e63 < h < 1.40000000000000013e-293Initial program 64.1%
Simplified64.9%
add-sqr-sqrt64.9%
pow264.9%
sqrt-prod64.9%
sqrt-pow167.1%
metadata-eval67.1%
pow167.1%
div-inv67.1%
metadata-eval67.1%
Applied egg-rr67.1%
Applied egg-rr19.2%
expm1-def24.6%
expm1-log1p54.5%
*-commutative54.5%
Simplified54.5%
pow1/254.5%
frac-times49.8%
unpow249.8%
div-inv49.8%
unpow-prod-down55.1%
pow1/255.1%
inv-pow55.1%
pow-pow55.1%
metadata-eval55.1%
*-commutative55.1%
Applied egg-rr55.1%
*-commutative55.1%
*-commutative55.1%
unpow255.1%
rem-sqrt-square79.6%
Simplified79.6%
if 1.40000000000000013e-293 < h Initial program 65.6%
Simplified65.4%
sub-neg65.4%
distribute-rgt-in52.0%
*-un-lft-identity52.0%
*-commutative52.0%
sqrt-div61.5%
sqrt-div62.3%
frac-times62.2%
add-sqr-sqrt62.4%
Applied egg-rr73.9%
distribute-rgt1-in81.3%
+-commutative81.3%
*-commutative81.3%
associate-*r*81.3%
Simplified81.3%
Final simplification78.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 (<= h -9.2e+61)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (/ (* 0.5 (* M_m D)) d) 2.0)))))
(if (<= h 5e-290)
(*
(* (pow (* h l) -0.5) (fabs d))
(- 1.0 (* (/ h l) (* 0.5 (pow (* M_m (* 0.5 (/ D d))) 2.0)))))
(*
(+ 1.0 (* (/ h l) (* (pow (* 0.5 (* M_m (/ D d))) 2.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 (h <= -9.2e+61) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * pow(((0.5 * (M_m * D)) / d), 2.0))));
} else if (h <= 5e-290) {
tmp = (pow((h * l), -0.5) * fabs(d)) * (1.0 - ((h / l) * (0.5 * pow((M_m * (0.5 * (D / d))), 2.0))));
} else {
tmp = (1.0 + ((h / l) * (pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (h <= (-9.2d+61)) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (0.5d0 * ((h / l) * (((0.5d0 * (m_m * d_1)) / d) ** 2.0d0))))
else if (h <= 5d-290) then
tmp = (((h * l) ** (-0.5d0)) * abs(d)) * (1.0d0 - ((h / l) * (0.5d0 * ((m_m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
else
tmp = (1.0d0 + ((h / l) * (((0.5d0 * (m_m * (d_1 / d))) ** 2.0d0) * (-0.5d0)))) * (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 (h <= -9.2e+61) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((0.5 * (M_m * D)) / d), 2.0))));
} else if (h <= 5e-290) {
tmp = (Math.pow((h * l), -0.5) * Math.abs(d)) * (1.0 - ((h / l) * (0.5 * Math.pow((M_m * (0.5 * (D / d))), 2.0))));
} else {
tmp = (1.0 + ((h / l) * (Math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 h <= -9.2e+61: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * math.pow(((0.5 * (M_m * D)) / d), 2.0)))) elif h <= 5e-290: tmp = (math.pow((h * l), -0.5) * math.fabs(d)) * (1.0 - ((h / l) * (0.5 * math.pow((M_m * (0.5 * (D / d))), 2.0)))) else: tmp = (1.0 + ((h / l) * (math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (h <= -9.2e+61) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(0.5 * Float64(M_m * D)) / d) ^ 2.0))))); elseif (h <= 5e-290) tmp = Float64(Float64((Float64(h * l) ^ -0.5) * abs(d)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(M_m * Float64(0.5 * Float64(D / d))) ^ 2.0))))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(0.5 * Float64(M_m * Float64(D / d))) ^ 2.0) * -0.5))) * 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 (h <= -9.2e+61)
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * (((0.5 * (M_m * D)) / d) ^ 2.0))));
elseif (h <= 5e-290)
tmp = (((h * l) ^ -0.5) * abs(d)) * (1.0 - ((h / l) * (0.5 * ((M_m * (0.5 * (D / d))) ^ 2.0))));
else
tmp = (1.0 + ((h / l) * (((0.5 * (M_m * (D / d))) ^ 2.0) * -0.5))) * (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[h, -9.2e+61], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(0.5 * N[(M$95$m * D), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5e-290], N[(N[(N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(M$95$m * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(0.5 * N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $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}
\mathbf{if}\;h \leq -9.2 \cdot 10^{+61}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{0.5 \cdot \left(M_m \cdot D\right)}{d}\right)}^{2}\right)\right)\\
\mathbf{elif}\;h \leq 5 \cdot 10^{-290}:\\
\;\;\;\;\left({\left(h \cdot \ell\right)}^{-0.5} \cdot \left|d\right|\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M_m \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left({\left(0.5 \cdot \left(M_m \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -9.1999999999999998e61Initial program 71.6%
Simplified69.1%
frac-times71.6%
associate-/r*71.6%
div-inv71.6%
metadata-eval71.6%
Applied egg-rr71.6%
if -9.1999999999999998e61 < h < 5.0000000000000001e-290Initial program 64.1%
Simplified64.9%
add-sqr-sqrt64.9%
pow264.9%
sqrt-prod64.9%
sqrt-pow167.1%
metadata-eval67.1%
pow167.1%
div-inv67.1%
metadata-eval67.1%
Applied egg-rr67.1%
Applied egg-rr19.2%
expm1-def24.6%
expm1-log1p54.5%
*-commutative54.5%
Simplified54.5%
pow1/254.5%
frac-times49.8%
unpow249.8%
div-inv49.8%
unpow-prod-down55.1%
pow1/255.1%
inv-pow55.1%
pow-pow55.1%
metadata-eval55.1%
*-commutative55.1%
Applied egg-rr55.1%
*-commutative55.1%
*-commutative55.1%
unpow255.1%
rem-sqrt-square79.6%
Simplified79.6%
if 5.0000000000000001e-290 < h Initial program 65.6%
Simplified65.4%
sub-neg65.4%
distribute-rgt-in52.0%
*-un-lft-identity52.0%
*-commutative52.0%
sqrt-div61.5%
sqrt-div62.3%
frac-times62.2%
add-sqr-sqrt62.4%
Applied egg-rr73.9%
distribute-rgt1-in81.3%
+-commutative81.3%
*-commutative81.3%
associate-*r*81.3%
Simplified81.3%
Final simplification79.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 (<= h -2.55e-17)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* 0.5 (/ (* h (pow (* (* 0.5 M_m) (/ D d)) 2.0)) l))))
(if (<= h 4.9e-290)
(*
(* (pow (* h l) -0.5) (fabs d))
(- 1.0 (* (/ h l) (* 0.5 (pow (* M_m (* 0.5 (/ D d))) 2.0)))))
(*
(+ 1.0 (* (/ h l) (* (pow (* 0.5 (* M_m (/ D d))) 2.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 (h <= -2.55e-17) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h * pow(((0.5 * M_m) * (D / d)), 2.0)) / l)));
} else if (h <= 4.9e-290) {
tmp = (pow((h * l), -0.5) * fabs(d)) * (1.0 - ((h / l) * (0.5 * pow((M_m * (0.5 * (D / d))), 2.0))));
} else {
tmp = (1.0 + ((h / l) * (pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (h <= (-2.55d-17)) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (0.5d0 * ((h * (((0.5d0 * m_m) * (d_1 / d)) ** 2.0d0)) / l)))
else if (h <= 4.9d-290) then
tmp = (((h * l) ** (-0.5d0)) * abs(d)) * (1.0d0 - ((h / l) * (0.5d0 * ((m_m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
else
tmp = (1.0d0 + ((h / l) * (((0.5d0 * (m_m * (d_1 / d))) ** 2.0d0) * (-0.5d0)))) * (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 (h <= -2.55e-17) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (0.5 * ((h * Math.pow(((0.5 * M_m) * (D / d)), 2.0)) / l)));
} else if (h <= 4.9e-290) {
tmp = (Math.pow((h * l), -0.5) * Math.abs(d)) * (1.0 - ((h / l) * (0.5 * Math.pow((M_m * (0.5 * (D / d))), 2.0))));
} else {
tmp = (1.0 + ((h / l) * (Math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 h <= -2.55e-17: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (0.5 * ((h * math.pow(((0.5 * M_m) * (D / d)), 2.0)) / l))) elif h <= 4.9e-290: tmp = (math.pow((h * l), -0.5) * math.fabs(d)) * (1.0 - ((h / l) * (0.5 * math.pow((M_m * (0.5 * (D / d))), 2.0)))) else: tmp = (1.0 + ((h / l) * (math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (h <= -2.55e-17) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(0.5 * M_m) * Float64(D / d)) ^ 2.0)) / l)))); elseif (h <= 4.9e-290) tmp = Float64(Float64((Float64(h * l) ^ -0.5) * abs(d)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(M_m * Float64(0.5 * Float64(D / d))) ^ 2.0))))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(0.5 * Float64(M_m * Float64(D / d))) ^ 2.0) * -0.5))) * 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 (h <= -2.55e-17)
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h * (((0.5 * M_m) * (D / d)) ^ 2.0)) / l)));
elseif (h <= 4.9e-290)
tmp = (((h * l) ^ -0.5) * abs(d)) * (1.0 - ((h / l) * (0.5 * ((M_m * (0.5 * (D / d))) ^ 2.0))));
else
tmp = (1.0 + ((h / l) * (((0.5 * (M_m * (D / d))) ^ 2.0) * -0.5))) * (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[h, -2.55e-17], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(0.5 * M$95$m), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 4.9e-290], N[(N[(N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(M$95$m * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(0.5 * N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $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}
\mathbf{if}\;h \leq -2.55 \cdot 10^{-17}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M_m\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;h \leq 4.9 \cdot 10^{-290}:\\
\;\;\;\;\left({\left(h \cdot \ell\right)}^{-0.5} \cdot \left|d\right|\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M_m \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left({\left(0.5 \cdot \left(M_m \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -2.5500000000000001e-17Initial program 70.9%
Simplified70.5%
associate-*r/72.6%
div-inv72.6%
metadata-eval72.6%
Applied egg-rr72.6%
if -2.5500000000000001e-17 < h < 4.9000000000000001e-290Initial program 62.2%
Simplified62.1%
add-sqr-sqrt62.1%
pow262.1%
sqrt-prod62.1%
sqrt-pow163.6%
metadata-eval63.6%
pow163.6%
div-inv63.6%
metadata-eval63.6%
Applied egg-rr63.6%
Applied egg-rr21.1%
expm1-def25.5%
expm1-log1p56.8%
*-commutative56.8%
Simplified56.8%
pow1/256.8%
frac-times51.9%
unpow251.9%
div-inv51.9%
unpow-prod-down56.1%
pow1/256.1%
inv-pow56.1%
pow-pow56.1%
metadata-eval56.1%
*-commutative56.1%
Applied egg-rr56.1%
*-commutative56.1%
*-commutative56.1%
unpow256.1%
rem-sqrt-square81.1%
Simplified81.1%
if 4.9000000000000001e-290 < h Initial program 65.6%
Simplified65.4%
sub-neg65.4%
distribute-rgt-in52.0%
*-un-lft-identity52.0%
*-commutative52.0%
sqrt-div61.5%
sqrt-div62.3%
frac-times62.2%
add-sqr-sqrt62.4%
Applied egg-rr73.9%
distribute-rgt1-in81.3%
+-commutative81.3%
*-commutative81.3%
associate-*r*81.3%
Simplified81.3%
Final simplification78.9%
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 -4.2e+232)
(* (- d) (pow (* h l) -0.5))
(if (<= d -2.45e-290)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (/ (* (pow (* M_m (* 0.5 (/ D d))) 2.0) (* h 0.5)) l)))
(*
(+ 1.0 (* (/ h l) (* (pow (* 0.5 (* M_m (/ D d))) 2.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 (d <= -4.2e+232) {
tmp = -d * pow((h * l), -0.5);
} else if (d <= -2.45e-290) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((pow((M_m * (0.5 * (D / d))), 2.0) * (h * 0.5)) / l));
} else {
tmp = (1.0 + ((h / l) * (pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (d <= (-4.2d+232)) then
tmp = -d * ((h * l) ** (-0.5d0))
else if (d <= (-2.45d-290)) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - ((((m_m * (0.5d0 * (d_1 / d))) ** 2.0d0) * (h * 0.5d0)) / l))
else
tmp = (1.0d0 + ((h / l) * (((0.5d0 * (m_m * (d_1 / d))) ** 2.0d0) * (-0.5d0)))) * (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 (d <= -4.2e+232) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (d <= -2.45e-290) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - ((Math.pow((M_m * (0.5 * (D / d))), 2.0) * (h * 0.5)) / l));
} else {
tmp = (1.0 + ((h / l) * (Math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 d <= -4.2e+232: tmp = -d * math.pow((h * l), -0.5) elif d <= -2.45e-290: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - ((math.pow((M_m * (0.5 * (D / d))), 2.0) * (h * 0.5)) / l)) else: tmp = (1.0 + ((h / l) * (math.pow((0.5 * (M_m * (D / d))), 2.0) * -0.5))) * (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 (d <= -4.2e+232) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (d <= -2.45e-290) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64((Float64(M_m * Float64(0.5 * Float64(D / d))) ^ 2.0) * Float64(h * 0.5)) / l))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(0.5 * Float64(M_m * Float64(D / d))) ^ 2.0) * -0.5))) * 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 (d <= -4.2e+232)
tmp = -d * ((h * l) ^ -0.5);
elseif (d <= -2.45e-290)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((((M_m * (0.5 * (D / d))) ^ 2.0) * (h * 0.5)) / l));
else
tmp = (1.0 + ((h / l) * (((0.5 * (M_m * (D / d))) ^ 2.0) * -0.5))) * (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[d, -4.2e+232], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.45e-290], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[Power[N[(M$95$m * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * 0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(0.5 * N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $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}
\mathbf{if}\;d \leq -4.2 \cdot 10^{+232}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;d \leq -2.45 \cdot 10^{-290}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{{\left(M_m \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \left(h \cdot 0.5\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left({\left(0.5 \cdot \left(M_m \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -4.19999999999999982e232Initial program 61.3%
Simplified61.3%
add-sqr-sqrt61.3%
pow261.3%
sqrt-prod61.3%
sqrt-pow161.3%
metadata-eval61.3%
pow161.3%
div-inv61.3%
metadata-eval61.3%
Applied egg-rr61.3%
clear-num61.3%
sqrt-div61.3%
metadata-eval61.3%
Applied egg-rr61.3%
Taylor expanded in d around -inf 82.2%
mul-1-neg82.2%
*-commutative82.2%
distribute-rgt-neg-in82.2%
*-commutative82.2%
unpow1/282.2%
rem-exp-log78.6%
exp-neg78.6%
exp-prod78.6%
distribute-lft-neg-out78.6%
distribute-rgt-neg-in78.6%
metadata-eval78.6%
exp-to-pow82.3%
*-commutative82.3%
Simplified82.3%
if -4.19999999999999982e232 < d < -2.45e-290Initial program 69.2%
Simplified68.9%
add-sqr-sqrt68.8%
pow268.8%
sqrt-prod68.8%
sqrt-pow171.4%
metadata-eval71.4%
pow171.4%
div-inv71.4%
metadata-eval71.4%
Applied egg-rr71.4%
Applied egg-rr15.2%
expm1-def23.7%
expm1-log1p60.5%
*-commutative60.5%
Simplified60.5%
associate-*l/63.6%
Applied egg-rr63.6%
associate-*r*63.6%
Simplified63.6%
if -2.45e-290 < d Initial program 64.1%
Simplified64.0%
sub-neg64.0%
distribute-rgt-in50.4%
*-un-lft-identity50.4%
*-commutative50.4%
sqrt-div59.4%
sqrt-div60.1%
frac-times60.0%
add-sqr-sqrt60.2%
Applied egg-rr72.0%
distribute-rgt1-in79.8%
+-commutative79.8%
*-commutative79.8%
associate-*r*79.8%
Simplified79.8%
Final simplification73.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 -8e+129)
(* (- d) (pow (* h l) -0.5))
(if (<= l 3e+186)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* 0.5 M_m) (/ 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 <= -8e+129) {
tmp = -d * pow((h * l), -0.5);
} else if (l <= 3e+186) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((h / l) * (0.5 * pow(((0.5 * M_m) / (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 <= (-8d+129)) then
tmp = -d * ((h * l) ** (-0.5d0))
else if (l <= 3d+186) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - ((h / l) * (0.5d0 * (((0.5d0 * m_m) / (d / d_1)) ** 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 <= -8e+129) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (l <= 3e+186) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - ((h / l) * (0.5 * Math.pow(((0.5 * M_m) / (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 <= -8e+129: tmp = -d * math.pow((h * l), -0.5) elif l <= 3e+186: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - ((h / l) * (0.5 * math.pow(((0.5 * M_m) / (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 <= -8e+129) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (l <= 3e+186) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(0.5 * M_m) / 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 <= -8e+129)
tmp = -d * ((h * l) ^ -0.5);
elseif (l <= 3e+186)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((h / l) * (0.5 * (((0.5 * M_m) / (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, -8e+129], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3e+186], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(0.5 * M$95$m), $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 -8 \cdot 10^{+129}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq 3 \cdot 10^{+186}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{0.5 \cdot M_m}{\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 < -8e129Initial program 45.2%
Simplified42.6%
add-sqr-sqrt42.6%
pow242.6%
sqrt-prod42.6%
sqrt-pow149.5%
metadata-eval49.5%
pow149.5%
div-inv49.5%
metadata-eval49.5%
Applied egg-rr49.5%
clear-num47.7%
sqrt-div47.7%
metadata-eval47.7%
Applied egg-rr47.7%
Taylor expanded in d around -inf 47.6%
mul-1-neg47.6%
*-commutative47.6%
distribute-rgt-neg-in47.6%
*-commutative47.6%
unpow1/247.6%
rem-exp-log45.0%
exp-neg45.0%
exp-prod45.0%
distribute-lft-neg-out45.0%
distribute-rgt-neg-in45.0%
metadata-eval45.0%
exp-to-pow47.7%
*-commutative47.7%
Simplified47.7%
if -8e129 < l < 2.99999999999999982e186Initial program 71.7%
Simplified72.1%
add-sqr-sqrt72.0%
pow272.0%
sqrt-prod72.0%
sqrt-pow172.0%
metadata-eval72.0%
pow172.0%
div-inv72.0%
metadata-eval72.0%
Applied egg-rr72.0%
Applied egg-rr19.6%
expm1-def25.1%
expm1-log1p65.1%
*-commutative65.1%
Simplified65.1%
Taylor expanded in M around 0 64.7%
associate-*r/64.7%
*-commutative64.7%
associate-*l*64.7%
associate-/l*64.7%
*-commutative64.7%
Simplified64.7%
if 2.99999999999999982e186 < l Initial program 57.9%
Simplified57.2%
add-sqr-sqrt57.2%
pow257.2%
sqrt-prod57.3%
sqrt-pow157.3%
metadata-eval57.3%
pow157.3%
div-inv57.3%
metadata-eval57.3%
Applied egg-rr57.3%
Taylor expanded in d around inf 57.3%
unpow-157.3%
sqr-pow57.4%
rem-sqrt-square57.4%
metadata-eval57.4%
sqr-pow57.2%
fabs-sqr57.2%
sqr-pow57.4%
Simplified57.4%
*-commutative57.4%
unpow-prod-down72.5%
Applied egg-rr72.5%
Final simplification62.7%
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.85e+172)
(* (- d) (pow (* h l) -0.5))
(if (<= l 7.8e+84)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (/ (* (pow (* M_m (* 0.5 (/ D d))) 2.0) (* h 0.5)) 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 <= -1.85e+172) {
tmp = -d * pow((h * l), -0.5);
} else if (l <= 7.8e+84) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((pow((M_m * (0.5 * (D / d))), 2.0) * (h * 0.5)) / 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 <= (-1.85d+172)) then
tmp = -d * ((h * l) ** (-0.5d0))
else if (l <= 7.8d+84) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - ((((m_m * (0.5d0 * (d_1 / d))) ** 2.0d0) * (h * 0.5d0)) / 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 <= -1.85e+172) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (l <= 7.8e+84) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - ((Math.pow((M_m * (0.5 * (D / d))), 2.0) * (h * 0.5)) / 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 <= -1.85e+172: tmp = -d * math.pow((h * l), -0.5) elif l <= 7.8e+84: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - ((math.pow((M_m * (0.5 * (D / d))), 2.0) * (h * 0.5)) / 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 <= -1.85e+172) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (l <= 7.8e+84) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64((Float64(M_m * Float64(0.5 * Float64(D / d))) ^ 2.0) * Float64(h * 0.5)) / 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 <= -1.85e+172)
tmp = -d * ((h * l) ^ -0.5);
elseif (l <= 7.8e+84)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((((M_m * (0.5 * (D / d))) ^ 2.0) * (h * 0.5)) / 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, -1.85e+172], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.8e+84], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[Power[N[(M$95$m * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * 0.5), $MachinePrecision]), $MachinePrecision] / l), $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.85 \cdot 10^{+172}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq 7.8 \cdot 10^{+84}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{{\left(M_m \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \left(h \cdot 0.5\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.84999999999999986e172Initial program 46.2%
Simplified42.3%
add-sqr-sqrt42.3%
pow242.3%
sqrt-prod42.3%
sqrt-pow149.4%
metadata-eval49.4%
pow149.4%
div-inv49.4%
metadata-eval49.4%
Applied egg-rr49.4%
clear-num49.5%
sqrt-div49.4%
metadata-eval49.4%
Applied egg-rr49.4%
Taylor expanded in d around -inf 49.6%
mul-1-neg49.6%
*-commutative49.6%
distribute-rgt-neg-in49.6%
*-commutative49.6%
unpow1/249.6%
rem-exp-log47.0%
exp-neg47.0%
exp-prod47.0%
distribute-lft-neg-out47.0%
distribute-rgt-neg-in47.0%
metadata-eval47.0%
exp-to-pow49.6%
*-commutative49.6%
Simplified49.6%
if -1.84999999999999986e172 < l < 7.80000000000000032e84Initial program 70.6%
Simplified70.9%
add-sqr-sqrt70.9%
pow270.9%
sqrt-prod70.9%
sqrt-pow171.4%
metadata-eval71.4%
pow171.4%
div-inv71.4%
metadata-eval71.4%
Applied egg-rr71.4%
Applied egg-rr18.1%
expm1-def23.9%
expm1-log1p63.5%
*-commutative63.5%
Simplified63.5%
associate-*l/66.1%
Applied egg-rr66.1%
associate-*r*66.1%
Simplified66.1%
if 7.80000000000000032e84 < l Initial program 58.6%
Simplified58.2%
add-sqr-sqrt58.2%
pow258.2%
sqrt-prod58.2%
sqrt-pow158.2%
metadata-eval58.2%
pow158.2%
div-inv58.2%
metadata-eval58.2%
Applied egg-rr58.2%
Taylor expanded in d around inf 53.6%
unpow-153.6%
sqr-pow53.7%
rem-sqrt-square53.7%
metadata-eval53.7%
sqr-pow53.5%
fabs-sqr53.5%
sqr-pow53.7%
Simplified53.7%
*-commutative53.7%
unpow-prod-down65.5%
Applied egg-rr65.5%
Final simplification64.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
(if (<= d -1.7e+233)
(* (- d) (pow (* h l) -0.5))
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (/ (* M_m D) (/ d 0.5)) 2.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 tmp;
if (d <= -1.7e+233) {
tmp = -d * pow((h * l), -0.5);
} else {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (((h / l) * -0.5) * pow(((M_m * D) / (d / 0.5)), 2.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) :: tmp
if (d <= (-1.7d+233)) then
tmp = -d * ((h * l) ** (-0.5d0))
else
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + (((h / l) * (-0.5d0)) * (((m_m * d_1) / (d / 0.5d0)) ** 2.0d0)))
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 <= -1.7e+233) {
tmp = -d * Math.pow((h * l), -0.5);
} else {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (((h / l) * -0.5) * Math.pow(((M_m * D) / (d / 0.5)), 2.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): tmp = 0 if d <= -1.7e+233: tmp = -d * math.pow((h * l), -0.5) else: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (((h / l) * -0.5) * math.pow(((M_m * D) / (d / 0.5)), 2.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) tmp = 0.0 if (d <= -1.7e+233) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); else tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(Float64(M_m * D) / Float64(d / 0.5)) ^ 2.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)
tmp = 0.0;
if (d <= -1.7e+233)
tmp = -d * ((h * l) ^ -0.5);
else
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (((h / l) * -0.5) * (((M_m * D) / (d / 0.5)) ^ 2.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_] := If[LessEqual[d, -1.7e+233], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], 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[(N[(M$95$m * D), $MachinePrecision] / N[(d / 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $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}
\mathbf{if}\;d \leq -1.7 \cdot 10^{+233}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(\frac{M_m \cdot D}{\frac{d}{0.5}}\right)}^{2}\right)\\
\end{array}
\end{array}
if d < -1.70000000000000011e233Initial program 61.3%
Simplified61.3%
add-sqr-sqrt61.3%
pow261.3%
sqrt-prod61.3%
sqrt-pow161.3%
metadata-eval61.3%
pow161.3%
div-inv61.3%
metadata-eval61.3%
Applied egg-rr61.3%
clear-num61.3%
sqrt-div61.3%
metadata-eval61.3%
Applied egg-rr61.3%
Taylor expanded in d around -inf 82.2%
mul-1-neg82.2%
*-commutative82.2%
distribute-rgt-neg-in82.2%
*-commutative82.2%
unpow1/282.2%
rem-exp-log78.6%
exp-neg78.6%
exp-prod78.6%
distribute-lft-neg-out78.6%
distribute-rgt-neg-in78.6%
metadata-eval78.6%
exp-to-pow82.3%
*-commutative82.3%
Simplified82.3%
if -1.70000000000000011e233 < d Initial program 66.5%
Simplified66.2%
frac-times66.5%
associate-/r*66.5%
div-inv66.5%
metadata-eval66.5%
Applied egg-rr66.5%
expm1-log1p-u31.7%
expm1-udef21.4%
Applied egg-rr19.2%
expm1-def27.6%
expm1-log1p60.0%
rem-log-exp53.9%
rem-log-exp60.0%
associate-*r*60.0%
*-commutative60.0%
Simplified60.0%
Final simplification61.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
(let* ((t_0 (pow (* h l) -0.5)))
(if (<= l -2.3e-135)
(* (- d) t_0)
(if (<= l -5e-310) (* d 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 = pow((h * l), -0.5);
double tmp;
if (l <= -2.3e-135) {
tmp = -d * t_0;
} else if (l <= -5e-310) {
tmp = d * 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 = (h * l) ** (-0.5d0)
if (l <= (-2.3d-135)) then
tmp = -d * t_0
else if (l <= (-5d-310)) then
tmp = d * 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.pow((h * l), -0.5);
double tmp;
if (l <= -2.3e-135) {
tmp = -d * t_0;
} else if (l <= -5e-310) {
tmp = d * 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.pow((h * l), -0.5) tmp = 0 if l <= -2.3e-135: tmp = -d * t_0 elif l <= -5e-310: tmp = d * 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(h * l) ^ -0.5 tmp = 0.0 if (l <= -2.3e-135) tmp = Float64(Float64(-d) * t_0); elseif (l <= -5e-310) tmp = Float64(d * 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 = (h * l) ^ -0.5;
tmp = 0.0;
if (l <= -2.3e-135)
tmp = -d * t_0;
elseif (l <= -5e-310)
tmp = d * 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[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -2.3e-135], N[((-d) * t$95$0), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * 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 := {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -2.3 \cdot 10^{-135}:\\
\;\;\;\;\left(-d\right) \cdot t_0\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -2.2999999999999999e-135Initial program 62.0%
Simplified60.6%
add-sqr-sqrt60.6%
pow260.6%
sqrt-prod60.6%
sqrt-pow163.6%
metadata-eval63.6%
pow163.6%
div-inv63.6%
metadata-eval63.6%
Applied egg-rr63.6%
clear-num62.8%
sqrt-div62.9%
metadata-eval62.9%
Applied egg-rr62.9%
Taylor expanded in d around -inf 47.0%
mul-1-neg47.0%
*-commutative47.0%
distribute-rgt-neg-in47.0%
*-commutative47.0%
unpow1/246.9%
rem-exp-log44.5%
exp-neg44.5%
exp-prod44.4%
distribute-lft-neg-out44.4%
distribute-rgt-neg-in44.4%
metadata-eval44.4%
exp-to-pow47.0%
*-commutative47.0%
Simplified47.0%
if -2.2999999999999999e-135 < l < -4.999999999999985e-310Initial program 78.8%
Simplified81.3%
add-sqr-sqrt81.3%
pow281.3%
sqrt-prod81.3%
sqrt-pow181.3%
metadata-eval81.3%
pow181.3%
div-inv81.3%
metadata-eval81.3%
Applied egg-rr81.3%
Taylor expanded in d around inf 35.3%
unpow-135.3%
sqr-pow35.3%
rem-sqrt-square35.3%
metadata-eval35.3%
sqr-pow35.3%
fabs-sqr35.3%
sqr-pow35.3%
Simplified35.3%
if -4.999999999999985e-310 < l Initial program 65.6%
Simplified65.5%
add-sqr-sqrt65.5%
pow265.5%
sqrt-prod65.5%
sqrt-pow165.5%
metadata-eval65.5%
pow165.5%
div-inv65.5%
metadata-eval65.5%
Applied egg-rr65.5%
Taylor expanded in d around inf 41.6%
unpow-141.6%
sqr-pow41.7%
rem-sqrt-square41.7%
metadata-eval41.7%
sqr-pow41.5%
fabs-sqr41.5%
sqr-pow41.7%
Simplified41.7%
*-commutative41.7%
unpow-prod-down47.6%
Applied egg-rr47.6%
Final simplification45.7%
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.75e-133)
(* (- d) (pow (* h l) -0.5))
(if (<= l -5e-310)
(* d (pow (pow (* h l) 2.0) -0.25))
(* 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.75e-133) {
tmp = -d * pow((h * l), -0.5);
} else if (l <= -5e-310) {
tmp = d * pow(pow((h * l), 2.0), -0.25);
} 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.75d-133)) then
tmp = -d * ((h * l) ** (-0.5d0))
else if (l <= (-5d-310)) then
tmp = d * (((h * l) ** 2.0d0) ** (-0.25d0))
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.75e-133) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (l <= -5e-310) {
tmp = d * Math.pow(Math.pow((h * l), 2.0), -0.25);
} 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.75e-133: tmp = -d * math.pow((h * l), -0.5) elif l <= -5e-310: tmp = d * math.pow(math.pow((h * l), 2.0), -0.25) 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.75e-133) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (l <= -5e-310) tmp = Float64(d * ((Float64(h * l) ^ 2.0) ^ -0.25)); 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.75e-133)
tmp = -d * ((h * l) ^ -0.5);
elseif (l <= -5e-310)
tmp = d * (((h * l) ^ 2.0) ^ -0.25);
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.75e-133], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $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.75 \cdot 10^{-133}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left({\left(h \cdot \ell\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.75000000000000001e-133Initial program 62.0%
Simplified60.6%
add-sqr-sqrt60.6%
pow260.6%
sqrt-prod60.6%
sqrt-pow163.6%
metadata-eval63.6%
pow163.6%
div-inv63.6%
metadata-eval63.6%
Applied egg-rr63.6%
clear-num62.8%
sqrt-div62.9%
metadata-eval62.9%
Applied egg-rr62.9%
Taylor expanded in d around -inf 47.0%
mul-1-neg47.0%
*-commutative47.0%
distribute-rgt-neg-in47.0%
*-commutative47.0%
unpow1/246.9%
rem-exp-log44.5%
exp-neg44.5%
exp-prod44.4%
distribute-lft-neg-out44.4%
distribute-rgt-neg-in44.4%
metadata-eval44.4%
exp-to-pow47.0%
*-commutative47.0%
Simplified47.0%
if -1.75000000000000001e-133 < l < -4.999999999999985e-310Initial program 78.8%
Simplified81.3%
Taylor expanded in d around inf 35.3%
*-commutative35.3%
associate-/r*35.3%
Simplified35.3%
expm1-log1p-u35.3%
expm1-udef35.1%
associate-/l/35.1%
Applied egg-rr35.1%
expm1-def35.3%
expm1-log1p-u35.3%
pow1/235.3%
inv-pow35.3%
pow-pow35.3%
metadata-eval35.3%
sqr-pow35.3%
pow-prod-down51.2%
pow251.2%
*-commutative51.2%
metadata-eval51.2%
Applied egg-rr51.2%
if -4.999999999999985e-310 < l Initial program 65.6%
Simplified65.5%
add-sqr-sqrt65.5%
pow265.5%
sqrt-prod65.5%
sqrt-pow165.5%
metadata-eval65.5%
pow165.5%
div-inv65.5%
metadata-eval65.5%
Applied egg-rr65.5%
Taylor expanded in d around inf 41.6%
unpow-141.6%
sqr-pow41.7%
rem-sqrt-square41.7%
metadata-eval41.7%
sqr-pow41.5%
fabs-sqr41.5%
sqr-pow41.7%
Simplified41.7%
*-commutative41.7%
unpow-prod-down47.6%
Applied egg-rr47.6%
Final simplification47.9%
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 (pow (* h l) -0.5))) (if (<= l -1.7e-135) (* (- d) t_0) (* 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 = pow((h * l), -0.5);
double tmp;
if (l <= -1.7e-135) {
tmp = -d * t_0;
} 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 = (h * l) ** (-0.5d0)
if (l <= (-1.7d-135)) then
tmp = -d * t_0
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.pow((h * l), -0.5);
double tmp;
if (l <= -1.7e-135) {
tmp = -d * t_0;
} 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.pow((h * l), -0.5) tmp = 0 if l <= -1.7e-135: tmp = -d * t_0 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 = Float64(h * l) ^ -0.5 tmp = 0.0 if (l <= -1.7e-135) tmp = Float64(Float64(-d) * t_0); 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 = (h * l) ^ -0.5;
tmp = 0.0;
if (l <= -1.7e-135)
tmp = -d * t_0;
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[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -1.7e-135], N[((-d) * t$95$0), $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 := {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -1.7 \cdot 10^{-135}:\\
\;\;\;\;\left(-d\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot t_0\\
\end{array}
\end{array}
if l < -1.69999999999999995e-135Initial program 62.0%
Simplified60.6%
add-sqr-sqrt60.6%
pow260.6%
sqrt-prod60.6%
sqrt-pow163.6%
metadata-eval63.6%
pow163.6%
div-inv63.6%
metadata-eval63.6%
Applied egg-rr63.6%
clear-num62.8%
sqrt-div62.9%
metadata-eval62.9%
Applied egg-rr62.9%
Taylor expanded in d around -inf 47.0%
mul-1-neg47.0%
*-commutative47.0%
distribute-rgt-neg-in47.0%
*-commutative47.0%
unpow1/246.9%
rem-exp-log44.5%
exp-neg44.5%
exp-prod44.4%
distribute-lft-neg-out44.4%
distribute-rgt-neg-in44.4%
metadata-eval44.4%
exp-to-pow47.0%
*-commutative47.0%
Simplified47.0%
if -1.69999999999999995e-135 < l Initial program 68.6%
Simplified69.0%
add-sqr-sqrt69.0%
pow269.0%
sqrt-prod69.0%
sqrt-pow169.0%
metadata-eval69.0%
pow169.0%
div-inv69.0%
metadata-eval69.0%
Applied egg-rr69.0%
Taylor expanded in d around inf 40.2%
unpow-140.2%
sqr-pow40.2%
rem-sqrt-square40.2%
metadata-eval40.2%
sqr-pow40.1%
fabs-sqr40.1%
sqr-pow40.2%
Simplified40.2%
Final simplification42.7%
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 (pow (* h l) -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) {
return d * pow((h * l), -0.5);
}
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 * ((h * l) ** (-0.5d0))
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.pow((h * l), -0.5);
}
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.pow((h * l), -0.5)
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 * (Float64(h * l) ^ -0.5)) 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 * ((h * l) ^ -0.5);
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[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 66.1%
Simplified65.9%
add-sqr-sqrt65.9%
pow265.9%
sqrt-prod65.9%
sqrt-pow167.0%
metadata-eval67.0%
pow167.0%
div-inv67.0%
metadata-eval67.0%
Applied egg-rr67.0%
Taylor expanded in d around inf 27.0%
unpow-127.0%
sqr-pow27.0%
rem-sqrt-square27.0%
metadata-eval27.0%
sqr-pow26.9%
fabs-sqr26.9%
sqr-pow27.0%
Simplified27.0%
Final simplification27.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 (* d 0.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) {
return d * 0.0;
}
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 * 0.0d0
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 * 0.0;
}
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 * 0.0
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 * 0.0) 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 * 0.0;
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 * 0.0), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot 0
\end{array}
Initial program 66.1%
Simplified65.9%
Taylor expanded in d around inf 27.0%
*-commutative27.0%
associate-/r*27.0%
Simplified27.0%
expm1-log1p-u26.5%
expm1-udef18.0%
associate-/l/18.0%
Applied egg-rr18.0%
Taylor expanded in h around inf 3.8%
Final simplification3.8%
herbie shell --seed 2024016
(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)))))