
(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 20 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)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= d -2e-310)
(*
(/ t_0 (sqrt (- l)))
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M_m 2.0) d)) 2.0) -0.5)))))
(if (<= d 1.8e-51)
(*
(* d (sqrt (/ 1.0 (* l h))))
(- 1.0 (* 0.5 (pow (* (* D_m (* 0.5 (/ M_m d))) (sqrt (/ h l))) 2.0))))
(*
(sqrt (/ d l))
(*
(/ (sqrt d) (sqrt h))
(+
1.0
(/ (* -0.5 (* h (pow (/ (/ d M_m) (* D_m 0.5)) -2.0))) l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(-d);
double tmp;
if (d <= -2e-310) {
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (pow((D_m * ((M_m / 2.0) / d)), 2.0) * -0.5))));
} else if (d <= 1.8e-51) {
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * pow(((D_m * (0.5 * (M_m / d))) * sqrt((h / l))), 2.0)));
} else {
tmp = sqrt((d / l)) * ((sqrt(d) / sqrt(h)) * (1.0 + ((-0.5 * (h * pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(-d)
if (d <= (-2d-310)) then
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0d0 + ((h / l) * (((d_m * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))))
else if (d <= 1.8d-51) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * (1.0d0 - (0.5d0 * (((d_m * (0.5d0 * (m_m / d))) * sqrt((h / l))) ** 2.0d0)))
else
tmp = sqrt((d / l)) * ((sqrt(d) / sqrt(h)) * (1.0d0 + (((-0.5d0) * (h * (((d / m_m) / (d_m * 0.5d0)) ** (-2.0d0)))) / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt(-d);
double tmp;
if (d <= -2e-310) {
tmp = (t_0 / Math.sqrt(-l)) * ((t_0 / Math.sqrt(-h)) * (1.0 + ((h / l) * (Math.pow((D_m * ((M_m / 2.0) / d)), 2.0) * -0.5))));
} else if (d <= 1.8e-51) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * Math.pow(((D_m * (0.5 * (M_m / d))) * Math.sqrt((h / l))), 2.0)));
} else {
tmp = Math.sqrt((d / l)) * ((Math.sqrt(d) / Math.sqrt(h)) * (1.0 + ((-0.5 * (h * Math.pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt(-d) tmp = 0 if d <= -2e-310: tmp = (t_0 / math.sqrt(-l)) * ((t_0 / math.sqrt(-h)) * (1.0 + ((h / l) * (math.pow((D_m * ((M_m / 2.0) / d)), 2.0) * -0.5)))) elif d <= 1.8e-51: tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * math.pow(((D_m * (0.5 * (M_m / d))) * math.sqrt((h / l))), 2.0))) else: tmp = math.sqrt((d / l)) * ((math.sqrt(d) / math.sqrt(h)) * (1.0 + ((-0.5 * (h * math.pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -2e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))))); elseif (d <= 1.8e-51) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(D_m * Float64(0.5 * Float64(M_m / d))) * sqrt(Float64(h / l))) ^ 2.0)))); else tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(d) / sqrt(h)) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h * (Float64(Float64(d / M_m) / Float64(D_m * 0.5)) ^ -2.0))) / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt(-d);
tmp = 0.0;
if (d <= -2e-310)
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (((D_m * ((M_m / 2.0) / d)) ^ 2.0) * -0.5))));
elseif (d <= 1.8e-51)
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * (((D_m * (0.5 * (M_m / d))) * sqrt((h / l))) ^ 2.0)));
else
tmp = sqrt((d / l)) * ((sqrt(d) / sqrt(h)) * (1.0 + ((-0.5 * (h * (((d / M_m) / (D_m * 0.5)) ^ -2.0))) / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -2e-310], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.8e-51], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h * N[Power[N[(N[(d / M$95$m), $MachinePrecision] / N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\frac{t\_0}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{elif}\;d \leq 1.8 \cdot 10^{-51}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(1 + \frac{-0.5 \cdot \left(h \cdot {\left(\frac{\frac{d}{M\_m}}{D\_m \cdot 0.5}\right)}^{-2}\right)}{\ell}\right)\right)\\
\end{array}
\end{array}
if d < -1.999999999999994e-310Initial program 66.2%
Simplified65.3%
frac-2neg65.3%
sqrt-div73.3%
Applied egg-rr73.3%
frac-2neg73.3%
sqrt-div80.4%
Applied egg-rr80.4%
if -1.999999999999994e-310 < d < 1.8e-51Initial program 44.5%
Simplified44.5%
Taylor expanded in d around 0 61.4%
add-sqr-sqrt61.4%
pow261.4%
sqrt-prod61.4%
sqrt-pow164.7%
frac-times68.4%
associate-/r*68.4%
metadata-eval68.4%
pow168.4%
div-inv68.4%
*-commutative68.4%
associate-*r*68.4%
div-inv68.4%
associate-*r/62.9%
associate-/l/62.9%
*-un-lft-identity62.9%
*-commutative62.9%
times-frac62.9%
metadata-eval62.9%
Applied egg-rr62.9%
if 1.8e-51 < d Initial program 86.8%
Simplified86.7%
associate-*r/86.8%
div-inv86.8%
associate-*r*86.8%
*-commutative86.8%
div-inv86.8%
associate-/r*86.8%
frac-times86.8%
associate-*r/86.8%
div-inv86.8%
metadata-eval86.8%
Applied egg-rr86.8%
metadata-eval86.8%
div-inv86.8%
*-commutative86.8%
associate-*r/86.7%
expm1-log1p-u52.5%
log1p-define52.5%
expm1-undefine52.5%
Applied egg-rr86.8%
Simplified89.2%
sqrt-div92.5%
div-inv92.5%
Applied egg-rr92.5%
associate-*r/92.5%
*-rgt-identity92.5%
Simplified92.5%
Final simplification80.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(+ 1.0 (/ (* -0.5 (* h (pow (/ (/ d M_m) (* D_m 0.5)) -2.0))) l))))
(if (<= d -1.7e-304)
(* (/ (sqrt (- d)) (sqrt (- l))) (* t_0 (sqrt (/ d h))))
(if (<= d 1.8e-51)
(*
(* d (sqrt (/ 1.0 (* l h))))
(- 1.0 (* 0.5 (pow (* (* D_m (* 0.5 (/ M_m d))) (sqrt (/ h l))) 2.0))))
(* (sqrt (/ d l)) (* (/ (sqrt d) (sqrt h)) t_0))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 + ((-0.5 * (h * pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l);
double tmp;
if (d <= -1.7e-304) {
tmp = (sqrt(-d) / sqrt(-l)) * (t_0 * sqrt((d / h)));
} else if (d <= 1.8e-51) {
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * pow(((D_m * (0.5 * (M_m / d))) * sqrt((h / l))), 2.0)));
} else {
tmp = sqrt((d / l)) * ((sqrt(d) / sqrt(h)) * t_0);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (((-0.5d0) * (h * (((d / m_m) / (d_m * 0.5d0)) ** (-2.0d0)))) / l)
if (d <= (-1.7d-304)) then
tmp = (sqrt(-d) / sqrt(-l)) * (t_0 * sqrt((d / h)))
else if (d <= 1.8d-51) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * (1.0d0 - (0.5d0 * (((d_m * (0.5d0 * (m_m / d))) * sqrt((h / l))) ** 2.0d0)))
else
tmp = sqrt((d / l)) * ((sqrt(d) / sqrt(h)) * t_0)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 + ((-0.5 * (h * Math.pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l);
double tmp;
if (d <= -1.7e-304) {
tmp = (Math.sqrt(-d) / Math.sqrt(-l)) * (t_0 * Math.sqrt((d / h)));
} else if (d <= 1.8e-51) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * Math.pow(((D_m * (0.5 * (M_m / d))) * Math.sqrt((h / l))), 2.0)));
} else {
tmp = Math.sqrt((d / l)) * ((Math.sqrt(d) / Math.sqrt(h)) * t_0);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 1.0 + ((-0.5 * (h * math.pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l) tmp = 0 if d <= -1.7e-304: tmp = (math.sqrt(-d) / math.sqrt(-l)) * (t_0 * math.sqrt((d / h))) elif d <= 1.8e-51: tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * math.pow(((D_m * (0.5 * (M_m / d))) * math.sqrt((h / l))), 2.0))) else: tmp = math.sqrt((d / l)) * ((math.sqrt(d) / math.sqrt(h)) * t_0) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(1.0 + Float64(Float64(-0.5 * Float64(h * (Float64(Float64(d / M_m) / Float64(D_m * 0.5)) ^ -2.0))) / l)) tmp = 0.0 if (d <= -1.7e-304) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(t_0 * sqrt(Float64(d / h)))); elseif (d <= 1.8e-51) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(D_m * Float64(0.5 * Float64(M_m / d))) * sqrt(Float64(h / l))) ^ 2.0)))); else tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(d) / sqrt(h)) * t_0)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 1.0 + ((-0.5 * (h * (((d / M_m) / (D_m * 0.5)) ^ -2.0))) / l);
tmp = 0.0;
if (d <= -1.7e-304)
tmp = (sqrt(-d) / sqrt(-l)) * (t_0 * sqrt((d / h)));
elseif (d <= 1.8e-51)
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * (((D_m * (0.5 * (M_m / d))) * sqrt((h / l))) ^ 2.0)));
else
tmp = sqrt((d / l)) * ((sqrt(d) / sqrt(h)) * t_0);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(1.0 + N[(N[(-0.5 * N[(h * N[Power[N[(N[(d / M$95$m), $MachinePrecision] / N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.7e-304], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.8e-51], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 1 + \frac{-0.5 \cdot \left(h \cdot {\left(\frac{\frac{d}{M\_m}}{D\_m \cdot 0.5}\right)}^{-2}\right)}{\ell}\\
\mathbf{if}\;d \leq -1.7 \cdot 10^{-304}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(t\_0 \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;d \leq 1.8 \cdot 10^{-51}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot t\_0\right)\\
\end{array}
\end{array}
if d < -1.6999999999999999e-304Initial program 66.7%
Simplified65.9%
associate-*r/66.7%
div-inv66.7%
associate-*r*66.7%
*-commutative66.7%
div-inv66.7%
associate-/r*66.7%
frac-times65.9%
associate-*r/66.7%
div-inv66.7%
metadata-eval66.7%
Applied egg-rr66.7%
metadata-eval66.7%
div-inv66.7%
*-commutative66.7%
associate-*r/65.9%
expm1-log1p-u37.3%
log1p-define37.3%
expm1-undefine37.3%
Applied egg-rr65.9%
Simplified69.4%
frac-2neg73.9%
sqrt-div80.2%
Applied egg-rr77.9%
if -1.6999999999999999e-304 < d < 1.8e-51Initial program 43.7%
Simplified43.7%
Taylor expanded in d around 0 60.3%
add-sqr-sqrt60.3%
pow260.3%
sqrt-prod60.3%
sqrt-pow163.5%
frac-times67.1%
associate-/r*67.1%
metadata-eval67.1%
pow167.1%
div-inv67.1%
*-commutative67.1%
associate-*r*67.1%
div-inv67.1%
associate-*r/61.7%
associate-/l/61.7%
*-un-lft-identity61.7%
*-commutative61.7%
times-frac61.7%
metadata-eval61.7%
Applied egg-rr61.7%
if 1.8e-51 < d Initial program 86.8%
Simplified86.7%
associate-*r/86.8%
div-inv86.8%
associate-*r*86.8%
*-commutative86.8%
div-inv86.8%
associate-/r*86.8%
frac-times86.8%
associate-*r/86.8%
div-inv86.8%
metadata-eval86.8%
Applied egg-rr86.8%
metadata-eval86.8%
div-inv86.8%
*-commutative86.8%
associate-*r/86.7%
expm1-log1p-u52.5%
log1p-define52.5%
expm1-undefine52.5%
Applied egg-rr86.8%
Simplified89.2%
sqrt-div92.5%
div-inv92.5%
Applied egg-rr92.5%
associate-*r/92.5%
*-rgt-identity92.5%
Simplified92.5%
Final simplification79.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= d -1.7e-304)
(*
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M_m 2.0) d)) 2.0) -0.5))))
t_0)
(if (<= d 3.05e-50)
(*
(* d (sqrt (/ 1.0 (* l h))))
(- 1.0 (* 0.5 (pow (* (* D_m (* 0.5 (/ M_m d))) (sqrt (/ h l))) 2.0))))
(*
t_0
(*
(/ (sqrt d) (sqrt h))
(+
1.0
(/ (* -0.5 (* h (pow (/ (/ d M_m) (* D_m 0.5)) -2.0))) l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / l));
double tmp;
if (d <= -1.7e-304) {
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (pow((D_m * ((M_m / 2.0) / d)), 2.0) * -0.5)))) * t_0;
} else if (d <= 3.05e-50) {
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * pow(((D_m * (0.5 * (M_m / d))) * sqrt((h / l))), 2.0)));
} else {
tmp = t_0 * ((sqrt(d) / sqrt(h)) * (1.0 + ((-0.5 * (h * pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (d <= (-1.7d-304)) then
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0d0 + ((h / l) * (((d_m * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0))))) * t_0
else if (d <= 3.05d-50) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * (1.0d0 - (0.5d0 * (((d_m * (0.5d0 * (m_m / d))) * sqrt((h / l))) ** 2.0d0)))
else
tmp = t_0 * ((sqrt(d) / sqrt(h)) * (1.0d0 + (((-0.5d0) * (h * (((d / m_m) / (d_m * 0.5d0)) ** (-2.0d0)))) / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (d <= -1.7e-304) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * (1.0 + ((h / l) * (Math.pow((D_m * ((M_m / 2.0) / d)), 2.0) * -0.5)))) * t_0;
} else if (d <= 3.05e-50) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * Math.pow(((D_m * (0.5 * (M_m / d))) * Math.sqrt((h / l))), 2.0)));
} else {
tmp = t_0 * ((Math.sqrt(d) / Math.sqrt(h)) * (1.0 + ((-0.5 * (h * Math.pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((d / l)) tmp = 0 if d <= -1.7e-304: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * (1.0 + ((h / l) * (math.pow((D_m * ((M_m / 2.0) / d)), 2.0) * -0.5)))) * t_0 elif d <= 3.05e-50: tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * math.pow(((D_m * (0.5 * (M_m / d))) * math.sqrt((h / l))), 2.0))) else: tmp = t_0 * ((math.sqrt(d) / math.sqrt(h)) * (1.0 + ((-0.5 * (h * math.pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -1.7e-304) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5)))) * t_0); elseif (d <= 3.05e-50) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(D_m * Float64(0.5 * Float64(M_m / d))) * sqrt(Float64(h / l))) ^ 2.0)))); else tmp = Float64(t_0 * Float64(Float64(sqrt(d) / sqrt(h)) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h * (Float64(Float64(d / M_m) / Float64(D_m * 0.5)) ^ -2.0))) / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((d / l));
tmp = 0.0;
if (d <= -1.7e-304)
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (((D_m * ((M_m / 2.0) / d)) ^ 2.0) * -0.5)))) * t_0;
elseif (d <= 3.05e-50)
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * (((D_m * (0.5 * (M_m / d))) * sqrt((h / l))) ^ 2.0)));
else
tmp = t_0 * ((sqrt(d) / sqrt(h)) * (1.0 + ((-0.5 * (h * (((d / M_m) / (D_m * 0.5)) ^ -2.0))) / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.7e-304], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, 3.05e-50], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h * N[Power[N[(N[(d / M$95$m), $MachinePrecision] / N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -1.7 \cdot 10^{-304}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot t\_0\\
\mathbf{elif}\;d \leq 3.05 \cdot 10^{-50}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(1 + \frac{-0.5 \cdot \left(h \cdot {\left(\frac{\frac{d}{M\_m}}{D\_m \cdot 0.5}\right)}^{-2}\right)}{\ell}\right)\right)\\
\end{array}
\end{array}
if d < -1.6999999999999999e-304Initial program 66.7%
Simplified65.9%
frac-2neg65.9%
sqrt-div73.9%
Applied egg-rr73.9%
if -1.6999999999999999e-304 < d < 3.0499999999999998e-50Initial program 43.7%
Simplified43.7%
Taylor expanded in d around 0 60.3%
add-sqr-sqrt60.3%
pow260.3%
sqrt-prod60.3%
sqrt-pow163.5%
frac-times67.1%
associate-/r*67.1%
metadata-eval67.1%
pow167.1%
div-inv67.1%
*-commutative67.1%
associate-*r*67.1%
div-inv67.1%
associate-*r/61.7%
associate-/l/61.7%
*-un-lft-identity61.7%
*-commutative61.7%
times-frac61.7%
metadata-eval61.7%
Applied egg-rr61.7%
if 3.0499999999999998e-50 < d Initial program 86.8%
Simplified86.7%
associate-*r/86.8%
div-inv86.8%
associate-*r*86.8%
*-commutative86.8%
div-inv86.8%
associate-/r*86.8%
frac-times86.8%
associate-*r/86.8%
div-inv86.8%
metadata-eval86.8%
Applied egg-rr86.8%
metadata-eval86.8%
div-inv86.8%
*-commutative86.8%
associate-*r/86.7%
expm1-log1p-u52.5%
log1p-define52.5%
expm1-undefine52.5%
Applied egg-rr86.8%
Simplified89.2%
sqrt-div92.5%
div-inv92.5%
Applied egg-rr92.5%
associate-*r/92.5%
*-rgt-identity92.5%
Simplified92.5%
Final simplification77.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(-
1.0
(* 0.5 (pow (* (* D_m (* 0.5 (/ M_m d))) (sqrt (/ h l))) 2.0))))
(t_1 (sqrt (/ d l))))
(if (<= d -1.7e-304)
(* t_0 (* t_1 (sqrt (/ d h))))
(if (<= d 4.5e-47)
(* (* d (sqrt (/ 1.0 (* l h)))) t_0)
(*
t_1
(*
(/ (sqrt d) (sqrt h))
(+
1.0
(/ (* -0.5 (* h (pow (/ (/ d M_m) (* D_m 0.5)) -2.0))) l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 - (0.5 * pow(((D_m * (0.5 * (M_m / d))) * sqrt((h / l))), 2.0));
double t_1 = sqrt((d / l));
double tmp;
if (d <= -1.7e-304) {
tmp = t_0 * (t_1 * sqrt((d / h)));
} else if (d <= 4.5e-47) {
tmp = (d * sqrt((1.0 / (l * h)))) * t_0;
} else {
tmp = t_1 * ((sqrt(d) / sqrt(h)) * (1.0 + ((-0.5 * (h * pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (0.5d0 * (((d_m * (0.5d0 * (m_m / d))) * sqrt((h / l))) ** 2.0d0))
t_1 = sqrt((d / l))
if (d <= (-1.7d-304)) then
tmp = t_0 * (t_1 * sqrt((d / h)))
else if (d <= 4.5d-47) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * t_0
else
tmp = t_1 * ((sqrt(d) / sqrt(h)) * (1.0d0 + (((-0.5d0) * (h * (((d / m_m) / (d_m * 0.5d0)) ** (-2.0d0)))) / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 - (0.5 * Math.pow(((D_m * (0.5 * (M_m / d))) * Math.sqrt((h / l))), 2.0));
double t_1 = Math.sqrt((d / l));
double tmp;
if (d <= -1.7e-304) {
tmp = t_0 * (t_1 * Math.sqrt((d / h)));
} else if (d <= 4.5e-47) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * t_0;
} else {
tmp = t_1 * ((Math.sqrt(d) / Math.sqrt(h)) * (1.0 + ((-0.5 * (h * Math.pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 1.0 - (0.5 * math.pow(((D_m * (0.5 * (M_m / d))) * math.sqrt((h / l))), 2.0)) t_1 = math.sqrt((d / l)) tmp = 0 if d <= -1.7e-304: tmp = t_0 * (t_1 * math.sqrt((d / h))) elif d <= 4.5e-47: tmp = (d * math.sqrt((1.0 / (l * h)))) * t_0 else: tmp = t_1 * ((math.sqrt(d) / math.sqrt(h)) * (1.0 + ((-0.5 * (h * math.pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(1.0 - Float64(0.5 * (Float64(Float64(D_m * Float64(0.5 * Float64(M_m / d))) * sqrt(Float64(h / l))) ^ 2.0))) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -1.7e-304) tmp = Float64(t_0 * Float64(t_1 * sqrt(Float64(d / h)))); elseif (d <= 4.5e-47) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * t_0); else tmp = Float64(t_1 * Float64(Float64(sqrt(d) / sqrt(h)) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h * (Float64(Float64(d / M_m) / Float64(D_m * 0.5)) ^ -2.0))) / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 1.0 - (0.5 * (((D_m * (0.5 * (M_m / d))) * sqrt((h / l))) ^ 2.0));
t_1 = sqrt((d / l));
tmp = 0.0;
if (d <= -1.7e-304)
tmp = t_0 * (t_1 * sqrt((d / h)));
elseif (d <= 4.5e-47)
tmp = (d * sqrt((1.0 / (l * h)))) * t_0;
else
tmp = t_1 * ((sqrt(d) / sqrt(h)) * (1.0 + ((-0.5 * (h * (((d / M_m) / (D_m * 0.5)) ^ -2.0))) / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(1.0 - N[(0.5 * N[Power[N[(N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.7e-304], N[(t$95$0 * N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.5e-47], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$1 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h * N[Power[N[(N[(d / M$95$m), $MachinePrecision] / N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot {\left(\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -1.7 \cdot 10^{-304}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;d \leq 4.5 \cdot 10^{-47}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(1 + \frac{-0.5 \cdot \left(h \cdot {\left(\frac{\frac{d}{M\_m}}{D\_m \cdot 0.5}\right)}^{-2}\right)}{\ell}\right)\right)\\
\end{array}
\end{array}
if d < -1.6999999999999999e-304Initial program 66.7%
Simplified65.9%
add-sqr-sqrt0.9%
pow20.9%
sqrt-prod0.9%
sqrt-pow10.9%
frac-times1.1%
associate-/r*1.1%
metadata-eval1.1%
pow11.1%
div-inv1.1%
*-commutative1.1%
associate-*r*1.1%
div-inv1.1%
associate-*r/1.1%
associate-/l/1.1%
*-un-lft-identity1.1%
*-commutative1.1%
times-frac1.1%
metadata-eval1.1%
Applied egg-rr70.7%
if -1.6999999999999999e-304 < d < 4.5e-47Initial program 43.7%
Simplified43.7%
Taylor expanded in d around 0 60.3%
add-sqr-sqrt60.3%
pow260.3%
sqrt-prod60.3%
sqrt-pow163.5%
frac-times67.1%
associate-/r*67.1%
metadata-eval67.1%
pow167.1%
div-inv67.1%
*-commutative67.1%
associate-*r*67.1%
div-inv67.1%
associate-*r/61.7%
associate-/l/61.7%
*-un-lft-identity61.7%
*-commutative61.7%
times-frac61.7%
metadata-eval61.7%
Applied egg-rr61.7%
if 4.5e-47 < d Initial program 86.8%
Simplified86.7%
associate-*r/86.8%
div-inv86.8%
associate-*r*86.8%
*-commutative86.8%
div-inv86.8%
associate-/r*86.8%
frac-times86.8%
associate-*r/86.8%
div-inv86.8%
metadata-eval86.8%
Applied egg-rr86.8%
metadata-eval86.8%
div-inv86.8%
*-commutative86.8%
associate-*r/86.7%
expm1-log1p-u52.5%
log1p-define52.5%
expm1-undefine52.5%
Applied egg-rr86.8%
Simplified89.2%
sqrt-div92.5%
div-inv92.5%
Applied egg-rr92.5%
associate-*r/92.5%
*-rgt-identity92.5%
Simplified92.5%
Final simplification75.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* D_m (* 0.5 (/ M_m d)))) (t_1 (sqrt (/ d l))))
(if (<= d -1.7e-304)
(* (* t_1 (sqrt (/ d h))) (- 1.0 (* 0.5 (/ (* h (pow t_0 2.0)) l))))
(if (<= d 1.2e-50)
(*
(* d (sqrt (/ 1.0 (* l h))))
(- 1.0 (* 0.5 (pow (* t_0 (sqrt (/ h l))) 2.0))))
(*
t_1
(*
(/ (sqrt d) (sqrt h))
(+
1.0
(/ (* -0.5 (* h (pow (/ (/ d M_m) (* D_m 0.5)) -2.0))) l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = D_m * (0.5 * (M_m / d));
double t_1 = sqrt((d / l));
double tmp;
if (d <= -1.7e-304) {
tmp = (t_1 * sqrt((d / h))) * (1.0 - (0.5 * ((h * pow(t_0, 2.0)) / l)));
} else if (d <= 1.2e-50) {
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * pow((t_0 * sqrt((h / l))), 2.0)));
} else {
tmp = t_1 * ((sqrt(d) / sqrt(h)) * (1.0 + ((-0.5 * (h * pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d_m * (0.5d0 * (m_m / d))
t_1 = sqrt((d / l))
if (d <= (-1.7d-304)) then
tmp = (t_1 * sqrt((d / h))) * (1.0d0 - (0.5d0 * ((h * (t_0 ** 2.0d0)) / l)))
else if (d <= 1.2d-50) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * (1.0d0 - (0.5d0 * ((t_0 * sqrt((h / l))) ** 2.0d0)))
else
tmp = t_1 * ((sqrt(d) / sqrt(h)) * (1.0d0 + (((-0.5d0) * (h * (((d / m_m) / (d_m * 0.5d0)) ** (-2.0d0)))) / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = D_m * (0.5 * (M_m / d));
double t_1 = Math.sqrt((d / l));
double tmp;
if (d <= -1.7e-304) {
tmp = (t_1 * Math.sqrt((d / h))) * (1.0 - (0.5 * ((h * Math.pow(t_0, 2.0)) / l)));
} else if (d <= 1.2e-50) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * Math.pow((t_0 * Math.sqrt((h / l))), 2.0)));
} else {
tmp = t_1 * ((Math.sqrt(d) / Math.sqrt(h)) * (1.0 + ((-0.5 * (h * Math.pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = D_m * (0.5 * (M_m / d)) t_1 = math.sqrt((d / l)) tmp = 0 if d <= -1.7e-304: tmp = (t_1 * math.sqrt((d / h))) * (1.0 - (0.5 * ((h * math.pow(t_0, 2.0)) / l))) elif d <= 1.2e-50: tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * math.pow((t_0 * math.sqrt((h / l))), 2.0))) else: tmp = t_1 * ((math.sqrt(d) / math.sqrt(h)) * (1.0 + ((-0.5 * (h * math.pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(0.5 * Float64(M_m / d))) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -1.7e-304) tmp = Float64(Float64(t_1 * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (t_0 ^ 2.0)) / l)))); elseif (d <= 1.2e-50) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 - Float64(0.5 * (Float64(t_0 * sqrt(Float64(h / l))) ^ 2.0)))); else tmp = Float64(t_1 * Float64(Float64(sqrt(d) / sqrt(h)) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h * (Float64(Float64(d / M_m) / Float64(D_m * 0.5)) ^ -2.0))) / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = D_m * (0.5 * (M_m / d));
t_1 = sqrt((d / l));
tmp = 0.0;
if (d <= -1.7e-304)
tmp = (t_1 * sqrt((d / h))) * (1.0 - (0.5 * ((h * (t_0 ^ 2.0)) / l)));
elseif (d <= 1.2e-50)
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * ((t_0 * sqrt((h / l))) ^ 2.0)));
else
tmp = t_1 * ((sqrt(d) / sqrt(h)) * (1.0 + ((-0.5 * (h * (((d / M_m) / (D_m * 0.5)) ^ -2.0))) / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.7e-304], N[(N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.2e-50], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(t$95$0 * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h * N[Power[N[(N[(d / M$95$m), $MachinePrecision] / N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -1.7 \cdot 10^{-304}:\\
\;\;\;\;\left(t\_1 \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {t\_0}^{2}}{\ell}\right)\\
\mathbf{elif}\;d \leq 1.2 \cdot 10^{-50}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - 0.5 \cdot {\left(t\_0 \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(1 + \frac{-0.5 \cdot \left(h \cdot {\left(\frac{\frac{d}{M\_m}}{D\_m \cdot 0.5}\right)}^{-2}\right)}{\ell}\right)\right)\\
\end{array}
\end{array}
if d < -1.6999999999999999e-304Initial program 66.7%
Simplified65.9%
associate-*r/69.3%
Applied egg-rr69.4%
if -1.6999999999999999e-304 < d < 1.20000000000000001e-50Initial program 43.7%
Simplified43.7%
Taylor expanded in d around 0 60.3%
add-sqr-sqrt60.3%
pow260.3%
sqrt-prod60.3%
sqrt-pow163.5%
frac-times67.1%
associate-/r*67.1%
metadata-eval67.1%
pow167.1%
div-inv67.1%
*-commutative67.1%
associate-*r*67.1%
div-inv67.1%
associate-*r/61.7%
associate-/l/61.7%
*-un-lft-identity61.7%
*-commutative61.7%
times-frac61.7%
metadata-eval61.7%
Applied egg-rr61.7%
if 1.20000000000000001e-50 < d Initial program 86.8%
Simplified86.7%
associate-*r/86.8%
div-inv86.8%
associate-*r*86.8%
*-commutative86.8%
div-inv86.8%
associate-/r*86.8%
frac-times86.8%
associate-*r/86.8%
div-inv86.8%
metadata-eval86.8%
Applied egg-rr86.8%
metadata-eval86.8%
div-inv86.8%
*-commutative86.8%
associate-*r/86.7%
expm1-log1p-u52.5%
log1p-define52.5%
expm1-undefine52.5%
Applied egg-rr86.8%
Simplified89.2%
sqrt-div92.5%
div-inv92.5%
Applied egg-rr92.5%
associate-*r/92.5%
*-rgt-identity92.5%
Simplified92.5%
Final simplification75.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* d (pow (* l h) -0.5)))
(t_1 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))
(if (<= l -4.5e+213)
(*
(- 1.0 (* 0.5 (pow (* (* D_m (* 0.5 (/ M_m d))) (sqrt (/ h l))) 2.0)))
(sqrt (* (/ d l) (/ d h))))
(if (<= l -5e-310)
(* t_0 (+ t_1 -1.0))
(if (<= l 1e-203)
(*
t_0
(- 1.0 (* 0.5 (/ (* h (pow (* D_m (* M_m (/ 0.5 d))) 2.0)) l))))
(* (/ d (* (sqrt h) (sqrt l))) (- 1.0 t_1)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d * pow((l * h), -0.5);
double t_1 = 0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0));
double tmp;
if (l <= -4.5e+213) {
tmp = (1.0 - (0.5 * pow(((D_m * (0.5 * (M_m / d))) * sqrt((h / l))), 2.0))) * sqrt(((d / l) * (d / h)));
} else if (l <= -5e-310) {
tmp = t_0 * (t_1 + -1.0);
} else if (l <= 1e-203) {
tmp = t_0 * (1.0 - (0.5 * ((h * pow((D_m * (M_m * (0.5 / d))), 2.0)) / l)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - t_1);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d * ((l * h) ** (-0.5d0))
t_1 = 0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))
if (l <= (-4.5d+213)) then
tmp = (1.0d0 - (0.5d0 * (((d_m * (0.5d0 * (m_m / d))) * sqrt((h / l))) ** 2.0d0))) * sqrt(((d / l) * (d / h)))
else if (l <= (-5d-310)) then
tmp = t_0 * (t_1 + (-1.0d0))
else if (l <= 1d-203) then
tmp = t_0 * (1.0d0 - (0.5d0 * ((h * ((d_m * (m_m * (0.5d0 / d))) ** 2.0d0)) / l)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 - t_1)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d * Math.pow((l * h), -0.5);
double t_1 = 0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0));
double tmp;
if (l <= -4.5e+213) {
tmp = (1.0 - (0.5 * Math.pow(((D_m * (0.5 * (M_m / d))) * Math.sqrt((h / l))), 2.0))) * Math.sqrt(((d / l) * (d / h)));
} else if (l <= -5e-310) {
tmp = t_0 * (t_1 + -1.0);
} else if (l <= 1e-203) {
tmp = t_0 * (1.0 - (0.5 * ((h * Math.pow((D_m * (M_m * (0.5 / d))), 2.0)) / l)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 - t_1);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = d * math.pow((l * h), -0.5) t_1 = 0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0)) tmp = 0 if l <= -4.5e+213: tmp = (1.0 - (0.5 * math.pow(((D_m * (0.5 * (M_m / d))) * math.sqrt((h / l))), 2.0))) * math.sqrt(((d / l) * (d / h))) elif l <= -5e-310: tmp = t_0 * (t_1 + -1.0) elif l <= 1e-203: tmp = t_0 * (1.0 - (0.5 * ((h * math.pow((D_m * (M_m * (0.5 / d))), 2.0)) / l))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 - t_1) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(d * (Float64(l * h) ^ -0.5)) t_1 = Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))) tmp = 0.0 if (l <= -4.5e+213) tmp = Float64(Float64(1.0 - Float64(0.5 * (Float64(Float64(D_m * Float64(0.5 * Float64(M_m / d))) * sqrt(Float64(h / l))) ^ 2.0))) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); elseif (l <= -5e-310) tmp = Float64(t_0 * Float64(t_1 + -1.0)); elseif (l <= 1e-203) tmp = Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0)) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 - t_1)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = d * ((l * h) ^ -0.5);
t_1 = 0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0));
tmp = 0.0;
if (l <= -4.5e+213)
tmp = (1.0 - (0.5 * (((D_m * (0.5 * (M_m / d))) * sqrt((h / l))) ^ 2.0))) * sqrt(((d / l) * (d / h)));
elseif (l <= -5e-310)
tmp = t_0 * (t_1 + -1.0);
elseif (l <= 1e-203)
tmp = t_0 * (1.0 - (0.5 * ((h * ((D_m * (M_m * (0.5 / d))) ^ 2.0)) / l)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - t_1);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.5e+213], N[(N[(1.0 - N[(0.5 * N[Power[N[(N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(t$95$0 * N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1e-203], N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
t_1 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\\
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{+213}:\\
\;\;\;\;\left(1 - 0.5 \cdot {\left(\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 + -1\right)\\
\mathbf{elif}\;\ell \leq 10^{-203}:\\
\;\;\;\;t\_0 \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 - t\_1\right)\\
\end{array}
\end{array}
if l < -4.5000000000000002e213Initial program 54.2%
Simplified53.9%
add-sqr-sqrt1.8%
pow21.8%
sqrt-prod1.8%
sqrt-pow11.9%
frac-times2.6%
associate-/r*2.6%
metadata-eval2.6%
pow12.6%
div-inv2.6%
*-commutative2.6%
associate-*r*2.6%
div-inv2.6%
associate-*r/2.6%
associate-/l/2.6%
*-un-lft-identity2.6%
*-commutative2.6%
times-frac2.6%
metadata-eval2.6%
Applied egg-rr67.3%
div-inv67.4%
Applied egg-rr67.4%
pow167.4%
sqrt-unprod54.7%
un-div-inv54.7%
Applied egg-rr54.7%
unpow154.7%
*-commutative54.7%
Simplified54.7%
if -4.5000000000000002e213 < l < -4.999999999999985e-310Initial program 67.8%
Simplified67.0%
Taylor expanded in d around 0 0.7%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt73.3%
mul-1-neg73.3%
unpow-173.3%
metadata-eval73.3%
pow-sqr73.3%
rem-sqrt-square73.3%
rem-square-sqrt73.1%
fabs-sqr73.1%
rem-square-sqrt73.3%
Simplified73.3%
if -4.999999999999985e-310 < l < 1e-203Initial program 69.3%
Simplified69.3%
Taylor expanded in d around 0 76.3%
Taylor expanded in M around 0 76.3%
*-commutative76.3%
associate-*l/76.3%
associate-*l*76.3%
*-commutative76.3%
associate-*r/76.3%
*-commutative76.3%
associate-/l*76.3%
Simplified76.3%
*-un-lft-identity76.3%
pow1/276.3%
inv-pow76.3%
pow-pow76.3%
metadata-eval76.3%
Applied egg-rr76.3%
*-lft-identity76.3%
Simplified76.3%
associate-*r/93.1%
Applied egg-rr93.1%
if 1e-203 < l Initial program 70.5%
Simplified70.4%
*-commutative70.4%
sqrt-div76.5%
sqrt-div82.0%
frac-times81.9%
add-sqr-sqrt82.0%
Applied egg-rr82.0%
Final simplification78.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))))
(t_1 (* d (pow (* l h) -0.5))))
(if (<= l -5e-310)
(* t_1 (+ t_0 -1.0))
(if (<= l 3.4e-203)
(* t_1 (- 1.0 (* 0.5 (/ (* h (pow (* D_m (* M_m (/ 0.5 d))) 2.0)) l))))
(* (/ d (* (sqrt h) (sqrt l))) (- 1.0 t_0))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0));
double t_1 = d * pow((l * h), -0.5);
double tmp;
if (l <= -5e-310) {
tmp = t_1 * (t_0 + -1.0);
} else if (l <= 3.4e-203) {
tmp = t_1 * (1.0 - (0.5 * ((h * pow((D_m * (M_m * (0.5 / d))), 2.0)) / l)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - t_0);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))
t_1 = d * ((l * h) ** (-0.5d0))
if (l <= (-5d-310)) then
tmp = t_1 * (t_0 + (-1.0d0))
else if (l <= 3.4d-203) then
tmp = t_1 * (1.0d0 - (0.5d0 * ((h * ((d_m * (m_m * (0.5d0 / d))) ** 2.0d0)) / l)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 - t_0)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0));
double t_1 = d * Math.pow((l * h), -0.5);
double tmp;
if (l <= -5e-310) {
tmp = t_1 * (t_0 + -1.0);
} else if (l <= 3.4e-203) {
tmp = t_1 * (1.0 - (0.5 * ((h * Math.pow((D_m * (M_m * (0.5 / d))), 2.0)) / l)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 - t_0);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0)) t_1 = d * math.pow((l * h), -0.5) tmp = 0 if l <= -5e-310: tmp = t_1 * (t_0 + -1.0) elif l <= 3.4e-203: tmp = t_1 * (1.0 - (0.5 * ((h * math.pow((D_m * (M_m * (0.5 / d))), 2.0)) / l))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 - t_0) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))) t_1 = Float64(d * (Float64(l * h) ^ -0.5)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(t_1 * Float64(t_0 + -1.0)); elseif (l <= 3.4e-203) tmp = Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0)) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 - t_0)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0));
t_1 = d * ((l * h) ^ -0.5);
tmp = 0.0;
if (l <= -5e-310)
tmp = t_1 * (t_0 + -1.0);
elseif (l <= 3.4e-203)
tmp = t_1 * (1.0 - (0.5 * ((h * ((D_m * (M_m * (0.5 / d))) ^ 2.0)) / l)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - t_0);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(t$95$1 * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.4e-203], N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\\
t_1 := d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 + -1\right)\\
\mathbf{elif}\;\ell \leq 3.4 \cdot 10^{-203}:\\
\;\;\;\;t\_1 \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 - t\_0\right)\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.2%
Simplified65.3%
Taylor expanded in d around 0 0.9%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt67.0%
mul-1-neg67.0%
unpow-167.0%
metadata-eval67.0%
pow-sqr67.0%
rem-sqrt-square67.0%
rem-square-sqrt66.8%
fabs-sqr66.8%
rem-square-sqrt67.0%
Simplified67.0%
if -4.999999999999985e-310 < l < 3.3999999999999999e-203Initial program 69.3%
Simplified69.3%
Taylor expanded in d around 0 76.3%
Taylor expanded in M around 0 76.3%
*-commutative76.3%
associate-*l/76.3%
associate-*l*76.3%
*-commutative76.3%
associate-*r/76.3%
*-commutative76.3%
associate-/l*76.3%
Simplified76.3%
*-un-lft-identity76.3%
pow1/276.3%
inv-pow76.3%
pow-pow76.3%
metadata-eval76.3%
Applied egg-rr76.3%
*-lft-identity76.3%
Simplified76.3%
associate-*r/93.1%
Applied egg-rr93.1%
if 3.3999999999999999e-203 < l Initial program 70.5%
Simplified70.4%
*-commutative70.4%
sqrt-div76.5%
sqrt-div82.0%
frac-times81.9%
add-sqr-sqrt82.0%
Applied egg-rr82.0%
Final simplification76.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l 5.5e-202)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* 0.5 (/ (* h (pow (* D_m (* 0.5 (/ M_m d))) 2.0)) l))))
(*
(/ d (* (sqrt h) (sqrt l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 5.5e-202) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h * pow((D_m * (0.5 * (M_m / d))), 2.0)) / l)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (l <= 5.5d-202) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (0.5d0 * ((h * ((d_m * (0.5d0 * (m_m / d))) ** 2.0d0)) / l)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 - (0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 5.5e-202) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (0.5 * ((h * Math.pow((D_m * (0.5 * (M_m / d))), 2.0)) / l)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 5.5e-202: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (0.5 * ((h * math.pow((D_m * (0.5 * (M_m / d))), 2.0)) / l))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 5.5e-202) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D_m * Float64(0.5 * Float64(M_m / d))) ^ 2.0)) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 5.5e-202)
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h * ((D_m * (0.5 * (M_m / d))) ^ 2.0)) / l)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 5.5e-202], 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[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.5 \cdot 10^{-202}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < 5.5e-202Initial program 66.6%
Simplified65.9%
associate-*r/70.6%
Applied egg-rr70.7%
if 5.5e-202 < l Initial program 70.8%
Simplified70.8%
*-commutative70.8%
sqrt-div77.0%
sqrt-div82.6%
frac-times82.5%
add-sqr-sqrt82.6%
Applied egg-rr82.6%
Final simplification75.5%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l 1.65e-203)
(*
(sqrt (/ d l))
(*
(+ 1.0 (/ (* -0.5 (* h (pow (/ (/ d M_m) (* D_m 0.5)) -2.0))) l))
(sqrt (/ d h))))
(*
(/ d (* (sqrt h) (sqrt l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 1.65e-203) {
tmp = sqrt((d / l)) * ((1.0 + ((-0.5 * (h * pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l)) * sqrt((d / h)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (l <= 1.65d-203) then
tmp = sqrt((d / l)) * ((1.0d0 + (((-0.5d0) * (h * (((d / m_m) / (d_m * 0.5d0)) ** (-2.0d0)))) / l)) * sqrt((d / h)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 - (0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 1.65e-203) {
tmp = Math.sqrt((d / l)) * ((1.0 + ((-0.5 * (h * Math.pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l)) * Math.sqrt((d / h)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 1.65e-203: tmp = math.sqrt((d / l)) * ((1.0 + ((-0.5 * (h * math.pow(((d / M_m) / (D_m * 0.5)), -2.0))) / l)) * math.sqrt((d / h))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 1.65e-203) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(1.0 + Float64(Float64(-0.5 * Float64(h * (Float64(Float64(d / M_m) / Float64(D_m * 0.5)) ^ -2.0))) / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 1.65e-203)
tmp = sqrt((d / l)) * ((1.0 + ((-0.5 * (h * (((d / M_m) / (D_m * 0.5)) ^ -2.0))) / l)) * sqrt((d / h)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 1.65e-203], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(N[(-0.5 * N[(h * N[Power[N[(N[(d / M$95$m), $MachinePrecision] / N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.65 \cdot 10^{-203}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\left(1 + \frac{-0.5 \cdot \left(h \cdot {\left(\frac{\frac{d}{M\_m}}{D\_m \cdot 0.5}\right)}^{-2}\right)}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < 1.65000000000000012e-203Initial program 66.8%
Simplified66.1%
associate-*r/66.8%
div-inv66.8%
associate-*r*66.8%
*-commutative66.8%
div-inv66.8%
associate-/r*66.8%
frac-times66.1%
associate-*r/66.8%
div-inv66.8%
metadata-eval66.8%
Applied egg-rr66.8%
metadata-eval66.8%
div-inv66.8%
*-commutative66.8%
associate-*r/66.1%
expm1-log1p-u33.8%
log1p-define33.8%
expm1-undefine33.8%
Applied egg-rr66.1%
Simplified70.9%
if 1.65000000000000012e-203 < l Initial program 70.5%
Simplified70.4%
*-commutative70.4%
sqrt-div76.5%
sqrt-div82.0%
frac-times81.9%
add-sqr-sqrt82.0%
Applied egg-rr82.0%
Final simplification75.5%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -5.4e-218)
(*
(sqrt (/ (* d (/ d l)) h))
(+ 1.0 (* -0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l))))
(if (<= d 1.05e-300)
(* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
(*
(* d (pow (* l h) -0.5))
(- 1.0 (* 0.5 (/ (* h (pow (* D_m (* M_m (/ 0.5 d))) 2.0)) l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -5.4e-218) {
tmp = sqrt(((d * (d / l)) / h)) * (1.0 + (-0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l)));
} else if (d <= 1.05e-300) {
tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
} else {
tmp = (d * pow((l * h), -0.5)) * (1.0 - (0.5 * ((h * pow((D_m * (M_m * (0.5 / d))), 2.0)) / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -5.4e-218) tmp = Float64(sqrt(Float64(Float64(d * Float64(d / l)) / h)) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l)))); elseif (d <= 1.05e-300) tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5)); else tmp = Float64(Float64(d * (Float64(l * h) ^ -0.5)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0)) / l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -5.4e-218], N[(N[Sqrt[N[(N[(d * N[(d / l), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.05e-300], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5.4 \cdot 10^{-218}:\\
\;\;\;\;\sqrt{\frac{d \cdot \frac{d}{\ell}}{h}} \cdot \left(1 + -0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;d \leq 1.05 \cdot 10^{-300}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -5.3999999999999999e-218Initial program 74.5%
Simplified74.5%
add-sqr-sqrt0.9%
pow20.9%
sqrt-prod0.9%
sqrt-pow11.0%
frac-times1.1%
associate-/r*1.1%
metadata-eval1.1%
pow11.1%
div-inv1.1%
*-commutative1.1%
associate-*r*1.1%
div-inv1.1%
associate-*r/1.2%
associate-/l/1.2%
*-un-lft-identity1.2%
*-commutative1.2%
times-frac1.2%
metadata-eval1.2%
Applied egg-rr77.4%
pow177.4%
Applied egg-rr62.8%
unpow162.8%
associate-*l/60.9%
*-commutative60.9%
associate-*l/63.1%
*-commutative63.1%
associate-*r*63.1%
Simplified63.1%
if -5.3999999999999999e-218 < d < 1.05000000000000002e-300Initial program 27.3%
Simplified23.1%
add-sqr-sqrt0.5%
pow20.5%
sqrt-prod0.5%
sqrt-pow10.5%
frac-times0.9%
associate-/r*0.9%
metadata-eval0.9%
pow10.9%
div-inv0.9%
*-commutative0.9%
associate-*r*0.9%
div-inv0.9%
associate-*r/0.9%
associate-/l/0.9%
*-un-lft-identity0.9%
*-commutative0.9%
times-frac0.9%
metadata-eval0.9%
Applied egg-rr35.8%
Taylor expanded in d around inf 11.3%
unpow-111.3%
metadata-eval11.3%
pow-sqr11.3%
rem-sqrt-square11.3%
rem-square-sqrt11.3%
fabs-sqr11.3%
rem-square-sqrt11.3%
Simplified11.3%
expm1-log1p-u11.3%
expm1-undefine28.6%
Applied egg-rr28.6%
sub-neg28.6%
metadata-eval28.6%
+-commutative28.6%
log1p-undefine28.6%
rem-exp-log28.6%
+-commutative28.6%
fma-define28.6%
Simplified28.6%
if 1.05000000000000002e-300 < d Initial program 70.7%
Simplified70.7%
Taylor expanded in d around 0 73.0%
Taylor expanded in M around 0 73.0%
*-commutative73.0%
associate-*l/70.1%
associate-*l*70.1%
*-commutative70.1%
associate-*r/70.1%
*-commutative70.1%
associate-/l*70.1%
Simplified70.1%
*-un-lft-identity70.1%
pow1/270.1%
inv-pow70.1%
pow-pow70.1%
metadata-eval70.1%
Applied egg-rr70.1%
*-lft-identity70.1%
Simplified70.1%
associate-*r/75.2%
Applied egg-rr75.2%
Final simplification66.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (pow (* l h) -0.5)))
(if (<= l -5.1e-179)
(* d (- t_0))
(if (<= l -5e-310)
(* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
(*
(* d t_0)
(- 1.0 (* 0.5 (/ (* h (pow (* D_m (* M_m (/ 0.5 d))) 2.0)) l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (l <= -5.1e-179) {
tmp = d * -t_0;
} else if (l <= -5e-310) {
tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
} else {
tmp = (d * t_0) * (1.0 - (0.5 * ((h * pow((D_m * (M_m * (0.5 / d))), 2.0)) / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (l <= -5.1e-179) tmp = Float64(d * Float64(-t_0)); elseif (l <= -5e-310) tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5)); else tmp = Float64(Float64(d * t_0) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0)) / l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -5.1e-179], N[(d * (-t$95$0)), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(N[(d * t$95$0), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -5.1 \cdot 10^{-179}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\left(d \cdot t\_0\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}\right)\\
\end{array}
\end{array}
if l < -5.10000000000000028e-179Initial program 61.7%
Simplified60.5%
add-sqr-sqrt1.1%
pow21.1%
sqrt-prod1.1%
sqrt-pow11.1%
frac-times1.4%
associate-/r*1.4%
metadata-eval1.4%
pow11.4%
div-inv1.4%
*-commutative1.4%
associate-*r*1.4%
div-inv1.4%
associate-*r/1.4%
associate-/l/1.4%
*-un-lft-identity1.4%
*-commutative1.4%
times-frac1.4%
metadata-eval1.4%
Applied egg-rr65.9%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt46.0%
neg-mul-146.0%
Simplified46.0%
if -5.10000000000000028e-179 < l < -4.999999999999985e-310Initial program 78.7%
Simplified78.7%
add-sqr-sqrt0.1%
pow20.1%
sqrt-prod0.1%
sqrt-pow10.2%
frac-times0.1%
associate-/r*0.1%
metadata-eval0.1%
pow10.1%
div-inv0.1%
*-commutative0.1%
associate-*r*0.1%
div-inv0.1%
associate-*r/0.2%
associate-/l/0.2%
*-un-lft-identity0.2%
*-commutative0.2%
times-frac0.2%
metadata-eval0.2%
Applied egg-rr81.8%
Taylor expanded in d around inf 32.8%
unpow-132.8%
metadata-eval32.8%
pow-sqr32.8%
rem-sqrt-square32.8%
rem-square-sqrt32.8%
fabs-sqr32.8%
rem-square-sqrt32.8%
Simplified32.8%
expm1-log1p-u32.8%
expm1-undefine50.7%
Applied egg-rr50.7%
sub-neg50.7%
metadata-eval50.7%
+-commutative50.7%
log1p-undefine50.7%
rem-exp-log50.7%
+-commutative50.7%
fma-define50.7%
Simplified50.7%
if -4.999999999999985e-310 < l Initial program 70.2%
Simplified70.2%
Taylor expanded in d around 0 72.4%
Taylor expanded in M around 0 72.4%
*-commutative72.4%
associate-*l/69.5%
associate-*l*69.5%
*-commutative69.5%
associate-*r/69.5%
*-commutative69.5%
associate-/l*69.6%
Simplified69.6%
*-un-lft-identity69.6%
pow1/269.6%
inv-pow69.6%
pow-pow69.5%
metadata-eval69.5%
Applied egg-rr69.5%
*-lft-identity69.5%
Simplified69.5%
associate-*r/74.6%
Applied egg-rr74.6%
Final simplification61.7%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (pow (* l h) -0.5)))
(if (<= l -5.8e-175)
(* d (- t_0))
(if (<= l -5e-310)
(* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
(*
d
(*
t_0
(+ 1.0 (* -0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (l <= -5.8e-175) {
tmp = d * -t_0;
} else if (l <= -5e-310) {
tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
} else {
tmp = d * (t_0 * (1.0 + (-0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l))));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (l <= -5.8e-175) tmp = Float64(d * Float64(-t_0)); elseif (l <= -5e-310) tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5)); else tmp = Float64(d * Float64(t_0 * Float64(1.0 + Float64(-0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l))))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -5.8e-175], N[(d * (-t$95$0)), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(t$95$0 * N[(1.0 + N[(-0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -5.8 \cdot 10^{-175}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left(t\_0 \cdot \left(1 + -0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\right)\right)\\
\end{array}
\end{array}
if l < -5.79999999999999998e-175Initial program 61.7%
Simplified60.5%
add-sqr-sqrt1.1%
pow21.1%
sqrt-prod1.1%
sqrt-pow11.1%
frac-times1.4%
associate-/r*1.4%
metadata-eval1.4%
pow11.4%
div-inv1.4%
*-commutative1.4%
associate-*r*1.4%
div-inv1.4%
associate-*r/1.4%
associate-/l/1.4%
*-un-lft-identity1.4%
*-commutative1.4%
times-frac1.4%
metadata-eval1.4%
Applied egg-rr65.9%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt46.0%
neg-mul-146.0%
Simplified46.0%
if -5.79999999999999998e-175 < l < -4.999999999999985e-310Initial program 78.7%
Simplified78.7%
add-sqr-sqrt0.1%
pow20.1%
sqrt-prod0.1%
sqrt-pow10.2%
frac-times0.1%
associate-/r*0.1%
metadata-eval0.1%
pow10.1%
div-inv0.1%
*-commutative0.1%
associate-*r*0.1%
div-inv0.1%
associate-*r/0.2%
associate-/l/0.2%
*-un-lft-identity0.2%
*-commutative0.2%
times-frac0.2%
metadata-eval0.2%
Applied egg-rr81.8%
Taylor expanded in d around inf 32.8%
unpow-132.8%
metadata-eval32.8%
pow-sqr32.8%
rem-sqrt-square32.8%
rem-square-sqrt32.8%
fabs-sqr32.8%
rem-square-sqrt32.8%
Simplified32.8%
expm1-log1p-u32.8%
expm1-undefine50.7%
Applied egg-rr50.7%
sub-neg50.7%
metadata-eval50.7%
+-commutative50.7%
log1p-undefine50.7%
rem-exp-log50.7%
+-commutative50.7%
fma-define50.7%
Simplified50.7%
if -4.999999999999985e-310 < l Initial program 70.2%
Simplified70.2%
Taylor expanded in d around 0 72.4%
pow172.4%
Applied egg-rr72.4%
unpow172.4%
associate-*l*73.2%
*-commutative73.2%
associate-*l/77.6%
*-commutative77.6%
associate-*r*77.6%
Simplified77.6%
Final simplification63.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -5e-310)
(*
(* d (pow (* l h) -0.5))
(+ (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))) -1.0))
(*
(* d (sqrt (/ 1.0 (* l h))))
(- 1.0 (* 0.5 (* (* h (pow (* D_m (* M_m (/ 0.5 d))) 2.0)) (/ 1.0 l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = (d * pow((l * h), -0.5)) * ((0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0);
} else {
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * ((h * pow((D_m * (M_m * (0.5 / d))), 2.0)) * (1.0 / l))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (l <= (-5d-310)) then
tmp = (d * ((l * h) ** (-0.5d0))) * ((0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))) + (-1.0d0))
else
tmp = (d * sqrt((1.0d0 / (l * h)))) * (1.0d0 - (0.5d0 * ((h * ((d_m * (m_m * (0.5d0 / d))) ** 2.0d0)) * (1.0d0 / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = (d * Math.pow((l * h), -0.5)) * ((0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0);
} else {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * ((h * Math.pow((D_m * (M_m * (0.5 / d))), 2.0)) * (1.0 / l))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -5e-310: tmp = (d * math.pow((l * h), -0.5)) * ((0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0) else: tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * ((h * math.pow((D_m * (M_m * (0.5 / d))), 2.0)) * (1.0 / l)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(d * (Float64(l * h) ^ -0.5)) * Float64(Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))) + -1.0)); else tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0)) * Float64(1.0 / l))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -5e-310)
tmp = (d * ((l * h) ^ -0.5)) * ((0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0))) + -1.0);
else
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * ((h * ((D_m * (M_m * (0.5 / d))) ^ 2.0)) * (1.0 / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], N[(N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right) \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - 0.5 \cdot \left(\left(h \cdot {\left(D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}^{2}\right) \cdot \frac{1}{\ell}\right)\right)\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.2%
Simplified65.3%
Taylor expanded in d around 0 0.9%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt67.0%
mul-1-neg67.0%
unpow-167.0%
metadata-eval67.0%
pow-sqr67.0%
rem-sqrt-square67.0%
rem-square-sqrt66.8%
fabs-sqr66.8%
rem-square-sqrt67.0%
Simplified67.0%
if -4.999999999999985e-310 < l Initial program 70.2%
Simplified70.2%
Taylor expanded in d around 0 72.4%
associate-*r/77.5%
clear-num77.5%
Applied egg-rr74.6%
associate-/r/74.6%
*-commutative74.6%
associate-*r/74.6%
*-commutative74.6%
associate-/l*74.7%
Simplified74.7%
Final simplification71.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -5e-310)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* (/ M_m d) (* D_m 0.5)) 2.0))))
(*
(* d (pow (* l h) -0.5))
(- 1.0 (* 0.5 (/ (* h (pow (* D_m (* M_m (/ 0.5 d))) 2.0)) l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (((h / l) * -0.5) * pow(((M_m / d) * (D_m * 0.5)), 2.0)));
} else {
tmp = (d * pow((l * h), -0.5)) * (1.0 - (0.5 * ((h * pow((D_m * (M_m * (0.5 / d))), 2.0)) / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (l <= (-5d-310)) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + (((h / l) * (-0.5d0)) * (((m_m / d) * (d_m * 0.5d0)) ** 2.0d0)))
else
tmp = (d * ((l * h) ** (-0.5d0))) * (1.0d0 - (0.5d0 * ((h * ((d_m * (m_m * (0.5d0 / d))) ** 2.0d0)) / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (((h / l) * -0.5) * Math.pow(((M_m / d) * (D_m * 0.5)), 2.0)));
} else {
tmp = (d * Math.pow((l * h), -0.5)) * (1.0 - (0.5 * ((h * Math.pow((D_m * (M_m * (0.5 / d))), 2.0)) / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -5e-310: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (((h / l) * -0.5) * math.pow(((M_m / d) * (D_m * 0.5)), 2.0))) else: tmp = (d * math.pow((l * h), -0.5)) * (1.0 - (0.5 * ((h * math.pow((D_m * (M_m * (0.5 / d))), 2.0)) / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5e-310) 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_m * 0.5)) ^ 2.0)))); else tmp = Float64(Float64(d * (Float64(l * h) ^ -0.5)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0)) / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -5e-310)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (((h / l) * -0.5) * (((M_m / d) * (D_m * 0.5)) ^ 2.0)));
else
tmp = (d * ((l * h) ^ -0.5)) * (1.0 - (0.5 * ((h * ((D_m * (M_m * (0.5 / d))) ^ 2.0)) / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], 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$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(\frac{M\_m}{d} \cdot \left(D\_m \cdot 0.5\right)\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}\right)\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.2%
Simplified65.3%
add-sqr-sqrt0.9%
pow20.9%
sqrt-prod0.9%
sqrt-pow10.9%
frac-times1.1%
associate-/r*1.1%
metadata-eval1.1%
pow11.1%
div-inv1.1%
*-commutative1.1%
associate-*r*1.1%
div-inv1.1%
associate-*r/1.1%
associate-/l/1.1%
*-un-lft-identity1.1%
*-commutative1.1%
times-frac1.1%
metadata-eval1.1%
Applied egg-rr70.1%
div-inv70.1%
Applied egg-rr70.1%
pow170.1%
Applied egg-rr53.2%
unpow153.2%
+-commutative53.2%
*-commutative53.2%
+-commutative53.2%
associate-*r*53.2%
Simplified53.2%
if -4.999999999999985e-310 < l Initial program 70.2%
Simplified70.2%
Taylor expanded in d around 0 72.4%
Taylor expanded in M around 0 72.4%
*-commutative72.4%
associate-*l/69.5%
associate-*l*69.5%
*-commutative69.5%
associate-*r/69.5%
*-commutative69.5%
associate-/l*69.6%
Simplified69.6%
*-un-lft-identity69.6%
pow1/269.6%
inv-pow69.6%
pow-pow69.5%
metadata-eval69.5%
Applied egg-rr69.5%
*-lft-identity69.5%
Simplified69.5%
associate-*r/74.6%
Applied egg-rr74.6%
Final simplification64.5%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* d (pow (* l h) -0.5))))
(if (<= l -5e-310)
(* t_0 (+ (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))) -1.0))
(* t_0 (- 1.0 (* 0.5 (/ (* h (pow (* D_m (* M_m (/ 0.5 d))) 2.0)) l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d * pow((l * h), -0.5);
double tmp;
if (l <= -5e-310) {
tmp = t_0 * ((0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0);
} else {
tmp = t_0 * (1.0 - (0.5 * ((h * pow((D_m * (M_m * (0.5 / d))), 2.0)) / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = d * ((l * h) ** (-0.5d0))
if (l <= (-5d-310)) then
tmp = t_0 * ((0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))) + (-1.0d0))
else
tmp = t_0 * (1.0d0 - (0.5d0 * ((h * ((d_m * (m_m * (0.5d0 / d))) ** 2.0d0)) / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d * Math.pow((l * h), -0.5);
double tmp;
if (l <= -5e-310) {
tmp = t_0 * ((0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0);
} else {
tmp = t_0 * (1.0 - (0.5 * ((h * Math.pow((D_m * (M_m * (0.5 / d))), 2.0)) / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = d * math.pow((l * h), -0.5) tmp = 0 if l <= -5e-310: tmp = t_0 * ((0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0) else: tmp = t_0 * (1.0 - (0.5 * ((h * math.pow((D_m * (M_m * (0.5 / d))), 2.0)) / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(d * (Float64(l * h) ^ -0.5)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(t_0 * Float64(Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))) + -1.0)); else tmp = Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0)) / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = d * ((l * h) ^ -0.5);
tmp = 0.0;
if (l <= -5e-310)
tmp = t_0 * ((0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0))) + -1.0);
else
tmp = t_0 * (1.0 - (0.5 * ((h * ((D_m * (M_m * (0.5 / d))) ^ 2.0)) / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(t$95$0 * N[(N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}\right)\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.2%
Simplified65.3%
Taylor expanded in d around 0 0.9%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt67.0%
mul-1-neg67.0%
unpow-167.0%
metadata-eval67.0%
pow-sqr67.0%
rem-sqrt-square67.0%
rem-square-sqrt66.8%
fabs-sqr66.8%
rem-square-sqrt67.0%
Simplified67.0%
if -4.999999999999985e-310 < l Initial program 70.2%
Simplified70.2%
Taylor expanded in d around 0 72.4%
Taylor expanded in M around 0 72.4%
*-commutative72.4%
associate-*l/69.5%
associate-*l*69.5%
*-commutative69.5%
associate-*r/69.5%
*-commutative69.5%
associate-/l*69.6%
Simplified69.6%
*-un-lft-identity69.6%
pow1/269.6%
inv-pow69.6%
pow-pow69.5%
metadata-eval69.5%
Applied egg-rr69.5%
*-lft-identity69.5%
Simplified69.5%
associate-*r/74.6%
Applied egg-rr74.6%
Final simplification71.0%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= l 8.2e-265) (* d (- (pow (* l h) -0.5))) (* d (* (pow l -0.5) (pow h -0.5)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 8.2e-265) {
tmp = d * -pow((l * h), -0.5);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (l <= 8.2d-265) then
tmp = d * -((l * h) ** (-0.5d0))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 8.2e-265) {
tmp = d * -Math.pow((l * h), -0.5);
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 8.2e-265: tmp = d * -math.pow((l * h), -0.5) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 8.2e-265) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 8.2e-265)
tmp = d * -((l * h) ^ -0.5);
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 8.2e-265], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 8.2 \cdot 10^{-265}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < 8.2e-265Initial program 66.5%
Simplified65.7%
add-sqr-sqrt7.7%
pow27.7%
sqrt-prod7.7%
sqrt-pow17.8%
frac-times7.9%
associate-/r*7.9%
metadata-eval7.9%
pow17.9%
div-inv7.9%
*-commutative7.9%
associate-*r*7.9%
div-inv7.9%
associate-*r/8.0%
associate-/l/8.0%
*-un-lft-identity8.0%
*-commutative8.0%
times-frac8.0%
metadata-eval8.0%
Applied egg-rr70.1%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt42.3%
neg-mul-142.3%
Simplified42.3%
if 8.2e-265 < l Initial program 70.2%
Simplified70.2%
add-sqr-sqrt71.0%
pow271.0%
sqrt-prod70.9%
sqrt-pow173.1%
frac-times74.7%
associate-/r*74.7%
metadata-eval74.7%
pow174.7%
div-inv74.7%
*-commutative74.7%
associate-*r*74.7%
div-inv74.7%
associate-*r/70.8%
associate-/l/70.8%
*-un-lft-identity70.8%
*-commutative70.8%
times-frac70.8%
metadata-eval70.8%
Applied egg-rr70.7%
Taylor expanded in d around inf 42.1%
unpow-142.1%
metadata-eval42.1%
pow-sqr42.1%
rem-sqrt-square42.1%
rem-square-sqrt41.9%
fabs-sqr41.9%
rem-square-sqrt42.1%
Simplified42.1%
*-commutative42.1%
unpow-prod-down47.3%
Applied egg-rr47.3%
Final simplification44.7%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= l 1.22e-263) (* d (- (pow (* l h) -0.5))) (* d (sqrt (/ (/ 1.0 h) l)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 1.22e-263) {
tmp = d * -pow((l * h), -0.5);
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (l <= 1.22d-263) then
tmp = d * -((l * h) ** (-0.5d0))
else
tmp = d * sqrt(((1.0d0 / h) / l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 1.22e-263) {
tmp = d * -Math.pow((l * h), -0.5);
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 1.22e-263: tmp = d * -math.pow((l * h), -0.5) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 1.22e-263) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 1.22e-263)
tmp = d * -((l * h) ^ -0.5);
else
tmp = d * sqrt(((1.0 / h) / l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 1.22e-263], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.22 \cdot 10^{-263}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if l < 1.22000000000000005e-263Initial program 66.5%
Simplified65.7%
add-sqr-sqrt7.7%
pow27.7%
sqrt-prod7.7%
sqrt-pow17.8%
frac-times7.9%
associate-/r*7.9%
metadata-eval7.9%
pow17.9%
div-inv7.9%
*-commutative7.9%
associate-*r*7.9%
div-inv7.9%
associate-*r/8.0%
associate-/l/8.0%
*-un-lft-identity8.0%
*-commutative8.0%
times-frac8.0%
metadata-eval8.0%
Applied egg-rr70.1%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt42.3%
neg-mul-142.3%
Simplified42.3%
if 1.22000000000000005e-263 < l Initial program 70.2%
Simplified70.2%
add-sqr-sqrt71.0%
pow271.0%
sqrt-prod70.9%
sqrt-pow173.1%
frac-times74.7%
associate-/r*74.7%
metadata-eval74.7%
pow174.7%
div-inv74.7%
*-commutative74.7%
associate-*r*74.7%
div-inv74.7%
associate-*r/70.8%
associate-/l/70.8%
*-un-lft-identity70.8%
*-commutative70.8%
times-frac70.8%
metadata-eval70.8%
Applied egg-rr70.7%
Taylor expanded in d around inf 42.1%
unpow-142.1%
metadata-eval42.1%
pow-sqr42.1%
rem-sqrt-square42.1%
rem-square-sqrt41.9%
fabs-sqr41.9%
rem-square-sqrt42.1%
Simplified42.1%
metadata-eval42.1%
pow-pow42.1%
inv-pow42.1%
pow1/242.1%
associate-/r*42.1%
Applied egg-rr42.1%
Final simplification42.2%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (* d (sqrt (/ (/ 1.0 h) l))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d * sqrt(((1.0 / h) / l));
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
code = d * sqrt(((1.0d0 / h) / l))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d * Math.sqrt(((1.0 / h) / l));
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d * math.sqrt(((1.0 / h) / l))
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d * sqrt(Float64(Float64(1.0 / h) / l))) end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d * sqrt(((1.0 / h) / l));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}
\end{array}
Initial program 68.3%
Simplified67.9%
add-sqr-sqrt38.6%
pow238.6%
sqrt-prod38.6%
sqrt-pow139.7%
frac-times40.5%
associate-/r*40.5%
metadata-eval40.5%
pow140.5%
div-inv40.5%
*-commutative40.5%
associate-*r*40.5%
div-inv40.5%
associate-*r/38.6%
associate-/l/38.6%
*-un-lft-identity38.6%
*-commutative38.6%
times-frac38.6%
metadata-eval38.6%
Applied egg-rr70.4%
Taylor expanded in d around inf 26.7%
unpow-126.7%
metadata-eval26.7%
pow-sqr26.7%
rem-sqrt-square26.7%
rem-square-sqrt26.6%
fabs-sqr26.6%
rem-square-sqrt26.7%
Simplified26.7%
metadata-eval26.7%
pow-pow26.7%
inv-pow26.7%
pow1/226.7%
associate-/r*26.7%
Applied egg-rr26.7%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (* d (sqrt (/ 1.0 (* l h)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d * sqrt((1.0 / (l * h)));
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
code = d * sqrt((1.0d0 / (l * h)))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d * Math.sqrt((1.0 / (l * h)));
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d * math.sqrt((1.0 / (l * h)))
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d * sqrt((1.0 / (l * h)));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\end{array}
Initial program 68.3%
Simplified67.9%
add-sqr-sqrt38.6%
pow238.6%
sqrt-prod38.6%
sqrt-pow139.7%
frac-times40.5%
associate-/r*40.5%
metadata-eval40.5%
pow140.5%
div-inv40.5%
*-commutative40.5%
associate-*r*40.5%
div-inv40.5%
associate-*r/38.6%
associate-/l/38.6%
*-un-lft-identity38.6%
*-commutative38.6%
times-frac38.6%
metadata-eval38.6%
Applied egg-rr70.4%
Taylor expanded in d around inf 26.7%
Final simplification26.7%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (* d (pow (* l h) -0.5)))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d * pow((l * h), -0.5);
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
code = d * ((l * h) ** (-0.5d0))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d * Math.pow((l * h), -0.5);
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d * math.pow((l * h), -0.5)
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d * (Float64(l * h) ^ -0.5)) end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d * ((l * h) ^ -0.5);
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 68.3%
Simplified67.9%
add-sqr-sqrt38.6%
pow238.6%
sqrt-prod38.6%
sqrt-pow139.7%
frac-times40.5%
associate-/r*40.5%
metadata-eval40.5%
pow140.5%
div-inv40.5%
*-commutative40.5%
associate-*r*40.5%
div-inv40.5%
associate-*r/38.6%
associate-/l/38.6%
*-un-lft-identity38.6%
*-commutative38.6%
times-frac38.6%
metadata-eval38.6%
Applied egg-rr70.4%
Taylor expanded in d around inf 26.7%
unpow-126.7%
metadata-eval26.7%
pow-sqr26.7%
rem-sqrt-square26.7%
rem-square-sqrt26.6%
fabs-sqr26.6%
rem-square-sqrt26.7%
Simplified26.7%
Final simplification26.7%
herbie shell --seed 2024178
(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)))))