Henrywood and Agarwal, Equation (12)

Percentage Accurate: 67.2% → 75.5%
Time: 30.2s
Alternatives: 26
Speedup: 1.4×

Specification

?
\[\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} \]
(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:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 26 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 67.2% accurate, 1.0× speedup?

\[\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} \]
(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}

Alternative 1: 75.5% accurate, 0.8× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\\ t_1 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot t_0\right)\right)\\ \mathbf{if}\;d \leq -6.7 \cdot 10^{+109}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq -4.4 \cdot 10^{-56}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{2 \cdot d}{D \cdot M}}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\\ \mathbf{elif}\;d \leq -4.8 \cdot 10^{-238}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq 4.6 \cdot 10^{-303}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot t_0\right)}{\ell}\right)\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (pow (* D (/ M (* 2.0 d))) 2.0))
        (t_1
         (* (* d (sqrt (/ 1.0 (* h l)))) (- -1.0 (* -0.5 (* (/ h l) t_0))))))
   (if (<= d -6.7e+109)
     t_1
     (if (<= d -4.4e-56)
       (*
        (* (sqrt (/ d h)) (sqrt (/ d l)))
        (- 1.0 (* (pow (/ 1.0 (/ (* 2.0 d) (* D M))) 2.0) (* (/ h l) 0.5))))
       (if (<= d -4.8e-238)
         t_1
         (if (<= d 4.6e-303)
           (* (sqrt (/ h (pow l 3.0))) (* 0.125 (* M (/ (* D M) (/ d D)))))
           (*
            (* (/ (sqrt d) (sqrt h)) (pow (/ d l) 0.5))
            (- 1.0 (/ (* h (* 0.5 t_0)) l)))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = pow((D * (M / (2.0 * d))), 2.0);
	double t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_0)));
	double tmp;
	if (d <= -6.7e+109) {
		tmp = t_1;
	} else if (d <= -4.4e-56) {
		tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)));
	} else if (d <= -4.8e-238) {
		tmp = t_1;
	} else if (d <= 4.6e-303) {
		tmp = sqrt((h / pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	} else {
		tmp = ((sqrt(d) / sqrt(h)) * pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * t_0)) / l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (d_1 * (m / (2.0d0 * d))) ** 2.0d0
    t_1 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * t_0)))
    if (d <= (-6.7d+109)) then
        tmp = t_1
    else if (d <= (-4.4d-56)) then
        tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (((1.0d0 / ((2.0d0 * d) / (d_1 * m))) ** 2.0d0) * ((h / l) * 0.5d0)))
    else if (d <= (-4.8d-238)) then
        tmp = t_1
    else if (d <= 4.6d-303) then
        tmp = sqrt((h / (l ** 3.0d0))) * (0.125d0 * (m * ((d_1 * m) / (d / d_1))))
    else
        tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h * (0.5d0 * t_0)) / l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.pow((D * (M / (2.0 * d))), 2.0);
	double t_1 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_0)));
	double tmp;
	if (d <= -6.7e+109) {
		tmp = t_1;
	} else if (d <= -4.4e-56) {
		tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (Math.pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)));
	} else if (d <= -4.8e-238) {
		tmp = t_1;
	} else if (d <= 4.6e-303) {
		tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	} else {
		tmp = ((Math.sqrt(d) / Math.sqrt(h)) * Math.pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * t_0)) / l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.pow((D * (M / (2.0 * d))), 2.0)
	t_1 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_0)))
	tmp = 0
	if d <= -6.7e+109:
		tmp = t_1
	elif d <= -4.4e-56:
		tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (math.pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)))
	elif d <= -4.8e-238:
		tmp = t_1
	elif d <= 4.6e-303:
		tmp = math.sqrt((h / math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))))
	else:
		tmp = ((math.sqrt(d) / math.sqrt(h)) * math.pow((d / l), 0.5)) * (1.0 - ((h * (0.5 * t_0)) / l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0
	t_1 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * t_0))))
	tmp = 0.0
	if (d <= -6.7e+109)
		tmp = t_1;
	elseif (d <= -4.4e-56)
		tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64((Float64(1.0 / Float64(Float64(2.0 * d) / Float64(D * M))) ^ 2.0) * Float64(Float64(h / l) * 0.5))));
	elseif (d <= -4.8e-238)
		tmp = t_1;
	elseif (d <= 4.6e-303)
		tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(0.125 * Float64(M * Float64(Float64(D * M) / Float64(d / D)))));
	else
		tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * t_0)) / l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = (D * (M / (2.0 * d))) ^ 2.0;
	t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_0)));
	tmp = 0.0;
	if (d <= -6.7e+109)
		tmp = t_1;
	elseif (d <= -4.4e-56)
		tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (((1.0 / ((2.0 * d) / (D * M))) ^ 2.0) * ((h / l) * 0.5)));
	elseif (d <= -4.8e-238)
		tmp = t_1;
	elseif (d <= 4.6e-303)
		tmp = sqrt((h / (l ^ 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	else
		tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ^ 0.5)) * (1.0 - ((h * (0.5 * t_0)) / l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -6.7e+109], t$95$1, If[LessEqual[d, -4.4e-56], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[Power[N[(1.0 / N[(N[(2.0 * d), $MachinePrecision] / N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.8e-238], t$95$1, If[LessEqual[d, 4.6e-303], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\\
t_1 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot t_0\right)\right)\\
\mathbf{if}\;d \leq -6.7 \cdot 10^{+109}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;d \leq -4.4 \cdot 10^{-56}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{2 \cdot d}{D \cdot M}}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\\

\mathbf{elif}\;d \leq -4.8 \cdot 10^{-238}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;d \leq 4.6 \cdot 10^{-303}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot t_0\right)}{\ell}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -6.70000000000000036e109 or -4.40000000000000008e-56 < d < -4.7999999999999997e-238

    1. Initial program 67.6%

      \[\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) \]
    2. Applied egg-rr22.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def27.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p56.4%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified56.4%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]

    if -6.70000000000000036e109 < d < -4.40000000000000008e-56

    1. Initial program 91.6%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval91.6%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/291.6%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/291.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified91.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr91.6%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]

    if -4.7999999999999997e-238 < d < 4.59999999999999991e-303

    1. Initial program 28.2%

      \[\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) \]
    2. Applied egg-rr5.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def5.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p22.7%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified22.7%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 33.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg33.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in33.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative33.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified33.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around inf 61.9%

      \[\leadsto \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. *-commutative61.9%

        \[\leadsto 0.125 \cdot \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      2. unpow261.9%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      3. unpow261.9%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      4. associate-*l/56.4%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      5. *-commutative56.4%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right) \cdot 0.125} \]
      6. associate-*l*56.4%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right) \cdot 0.125\right)} \]
      7. *-commutative56.4%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(0.125 \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right)} \]
      8. associate-*r*57.2%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      9. *-commutative57.2%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      10. associate-/l*57.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      11. associate-*l/62.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified62.5%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if 4.59999999999999991e-303 < d

    1. Initial program 66.0%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval66.0%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. pow1/266.0%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. sqrt-div78.6%

        \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \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) \]
    3. Applied egg-rr78.6%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \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) \]
    4. Step-by-step derivation
      1. associate-*r/80.3%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      2. metadata-eval80.3%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      3. *-commutative80.3%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      4. *-commutative80.3%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\left(\frac{D \cdot M}{\color{blue}{d \cdot 2}}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      5. associate-*r/79.5%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(D \cdot \frac{M}{d \cdot 2}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    5. Applied egg-rr79.5%

      \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
  3. Recombined 4 regimes into one program.
  4. Final simplification80.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -6.7 \cdot 10^{+109}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -4.4 \cdot 10^{-56}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{2 \cdot d}{D \cdot M}}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\\ \mathbf{elif}\;d \leq -4.8 \cdot 10^{-238}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq 4.6 \cdot 10^{-303}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)}{\ell}\right)\\ \end{array} \]

Alternative 2: 75.3% accurate, 0.6× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2}\right)\right)\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= h -2e-310)
   (*
    (* d (sqrt (/ 1.0 (* h l))))
    (- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0)))))
   (*
    (* (/ (sqrt d) (sqrt h)) (/ (sqrt d) (sqrt l)))
    (- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D M) (* 2.0 d)) 2.0)))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= -2e-310) {
		tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
	} else {
		tmp = ((sqrt(d) / sqrt(h)) * (sqrt(d) / sqrt(l))) * (1.0 - ((h / l) * (0.5 * pow(((D * M) / (2.0 * d)), 2.0))));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (h <= (-2d-310)) then
        tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
    else
        tmp = ((sqrt(d) / sqrt(h)) * (sqrt(d) / sqrt(l))) * (1.0d0 - ((h / l) * (0.5d0 * (((d_1 * m) / (2.0d0 * d)) ** 2.0d0))))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= -2e-310) {
		tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
	} else {
		tmp = ((Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt(d) / Math.sqrt(l))) * (1.0 - ((h / l) * (0.5 * Math.pow(((D * M) / (2.0 * d)), 2.0))));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if h <= -2e-310:
		tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0))))
	else:
		tmp = ((math.sqrt(d) / math.sqrt(h)) * (math.sqrt(d) / math.sqrt(l))) * (1.0 - ((h / l) * (0.5 * math.pow(((D * M) / (2.0 * d)), 2.0))))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (h <= -2e-310)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0)))));
	else
		tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(d) / sqrt(l))) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0)))));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (h <= -2e-310)
		tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
	else
		tmp = ((sqrt(d) / sqrt(h)) * (sqrt(d) / sqrt(l))) * (1.0 - ((h / l) * (0.5 * (((D * M) / (2.0 * d)) ^ 2.0))));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[h, -2e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if h < -1.999999999999994e-310

    1. Initial program 69.2%

      \[\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) \]
    2. Applied egg-rr21.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def30.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p57.9%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified57.9%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 73.7%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg73.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in73.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative73.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified73.7%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]

    if -1.999999999999994e-310 < h

    1. Initial program 65.5%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval65.5%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. pow1/265.5%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. sqrt-div78.0%

        \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \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) \]
    3. Applied egg-rr78.0%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \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) \]
    4. Step-by-step derivation
      1. metadata-eval78.0%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      2. pow1/278.0%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      3. sqrt-div81.8%

        \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}}\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) \]
    5. Applied egg-rr81.8%

      \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}}\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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification77.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2}\right)\right)\\ \end{array} \]

Alternative 3: 70.9% accurate, 1.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\\ t_3 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot t_2\right)\right)\\ t_4 := \sqrt{\frac{h}{{\ell}^{3}}}\\ t_5 := M \cdot \frac{D}{d}\\ t_6 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\ \mathbf{if}\;d \leq -2.45 \cdot 10^{+113}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;d \leq -3.7 \cdot 10^{-56}:\\ \;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_5 \cdot t_5\right)\right) \cdot 0.25\right)\right)\right)\\ \mathbf{elif}\;d \leq -5.4 \cdot 10^{-238}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;t_4 \cdot \left(0.125 \cdot t_6\right)\\ \mathbf{elif}\;d \leq 1.05 \cdot 10^{-112}:\\ \;\;\;\;t_4 \cdot \left(t_6 \cdot -0.125\right)\\ \mathbf{elif}\;d \leq 9.5 \cdot 10^{+133}:\\ \;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \frac{h \cdot t_2}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d h)))
        (t_1 (sqrt (/ d l)))
        (t_2 (pow (* D (/ M (* 2.0 d))) 2.0))
        (t_3
         (* (* d (sqrt (/ 1.0 (* h l)))) (- -1.0 (* -0.5 (* (/ h l) t_2)))))
        (t_4 (sqrt (/ h (pow l 3.0))))
        (t_5 (* M (/ D d)))
        (t_6 (* M (/ (* D M) (/ d D)))))
   (if (<= d -2.45e+113)
     t_3
     (if (<= d -3.7e-56)
       (* t_0 (* t_1 (- 1.0 (* 0.5 (* (* (/ h l) (* t_5 t_5)) 0.25)))))
       (if (<= d -5.4e-238)
         t_3
         (if (<= d -2e-310)
           (* t_4 (* 0.125 t_6))
           (if (<= d 1.05e-112)
             (* t_4 (* t_6 -0.125))
             (if (<= d 9.5e+133)
               (* t_0 (* t_1 (- 1.0 (* 0.5 (/ (* h t_2) l)))))
               (* d (/ (pow h -0.5) (sqrt l)))))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / h));
	double t_1 = sqrt((d / l));
	double t_2 = pow((D * (M / (2.0 * d))), 2.0);
	double t_3 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_2)));
	double t_4 = sqrt((h / pow(l, 3.0)));
	double t_5 = M * (D / d);
	double t_6 = M * ((D * M) / (d / D));
	double tmp;
	if (d <= -2.45e+113) {
		tmp = t_3;
	} else if (d <= -3.7e-56) {
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_5 * t_5)) * 0.25))));
	} else if (d <= -5.4e-238) {
		tmp = t_3;
	} else if (d <= -2e-310) {
		tmp = t_4 * (0.125 * t_6);
	} else if (d <= 1.05e-112) {
		tmp = t_4 * (t_6 * -0.125);
	} else if (d <= 9.5e+133) {
		tmp = t_0 * (t_1 * (1.0 - (0.5 * ((h * t_2) / l))));
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: t_6
    real(8) :: tmp
    t_0 = sqrt((d / h))
    t_1 = sqrt((d / l))
    t_2 = (d_1 * (m / (2.0d0 * d))) ** 2.0d0
    t_3 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * t_2)))
    t_4 = sqrt((h / (l ** 3.0d0)))
    t_5 = m * (d_1 / d)
    t_6 = m * ((d_1 * m) / (d / d_1))
    if (d <= (-2.45d+113)) then
        tmp = t_3
    else if (d <= (-3.7d-56)) then
        tmp = t_0 * (t_1 * (1.0d0 - (0.5d0 * (((h / l) * (t_5 * t_5)) * 0.25d0))))
    else if (d <= (-5.4d-238)) then
        tmp = t_3
    else if (d <= (-2d-310)) then
        tmp = t_4 * (0.125d0 * t_6)
    else if (d <= 1.05d-112) then
        tmp = t_4 * (t_6 * (-0.125d0))
    else if (d <= 9.5d+133) then
        tmp = t_0 * (t_1 * (1.0d0 - (0.5d0 * ((h * t_2) / l))))
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / h));
	double t_1 = Math.sqrt((d / l));
	double t_2 = Math.pow((D * (M / (2.0 * d))), 2.0);
	double t_3 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_2)));
	double t_4 = Math.sqrt((h / Math.pow(l, 3.0)));
	double t_5 = M * (D / d);
	double t_6 = M * ((D * M) / (d / D));
	double tmp;
	if (d <= -2.45e+113) {
		tmp = t_3;
	} else if (d <= -3.7e-56) {
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_5 * t_5)) * 0.25))));
	} else if (d <= -5.4e-238) {
		tmp = t_3;
	} else if (d <= -2e-310) {
		tmp = t_4 * (0.125 * t_6);
	} else if (d <= 1.05e-112) {
		tmp = t_4 * (t_6 * -0.125);
	} else if (d <= 9.5e+133) {
		tmp = t_0 * (t_1 * (1.0 - (0.5 * ((h * t_2) / l))));
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / h))
	t_1 = math.sqrt((d / l))
	t_2 = math.pow((D * (M / (2.0 * d))), 2.0)
	t_3 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_2)))
	t_4 = math.sqrt((h / math.pow(l, 3.0)))
	t_5 = M * (D / d)
	t_6 = M * ((D * M) / (d / D))
	tmp = 0
	if d <= -2.45e+113:
		tmp = t_3
	elif d <= -3.7e-56:
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_5 * t_5)) * 0.25))))
	elif d <= -5.4e-238:
		tmp = t_3
	elif d <= -2e-310:
		tmp = t_4 * (0.125 * t_6)
	elif d <= 1.05e-112:
		tmp = t_4 * (t_6 * -0.125)
	elif d <= 9.5e+133:
		tmp = t_0 * (t_1 * (1.0 - (0.5 * ((h * t_2) / l))))
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / h))
	t_1 = sqrt(Float64(d / l))
	t_2 = Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0
	t_3 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * t_2))))
	t_4 = sqrt(Float64(h / (l ^ 3.0)))
	t_5 = Float64(M * Float64(D / d))
	t_6 = Float64(M * Float64(Float64(D * M) / Float64(d / D)))
	tmp = 0.0
	if (d <= -2.45e+113)
		tmp = t_3;
	elseif (d <= -3.7e-56)
		tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(Float64(h / l) * Float64(t_5 * t_5)) * 0.25)))));
	elseif (d <= -5.4e-238)
		tmp = t_3;
	elseif (d <= -2e-310)
		tmp = Float64(t_4 * Float64(0.125 * t_6));
	elseif (d <= 1.05e-112)
		tmp = Float64(t_4 * Float64(t_6 * -0.125));
	elseif (d <= 9.5e+133)
		tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(h * t_2) / l)))));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / h));
	t_1 = sqrt((d / l));
	t_2 = (D * (M / (2.0 * d))) ^ 2.0;
	t_3 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * t_2)));
	t_4 = sqrt((h / (l ^ 3.0)));
	t_5 = M * (D / d);
	t_6 = M * ((D * M) / (d / D));
	tmp = 0.0;
	if (d <= -2.45e+113)
		tmp = t_3;
	elseif (d <= -3.7e-56)
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_5 * t_5)) * 0.25))));
	elseif (d <= -5.4e-238)
		tmp = t_3;
	elseif (d <= -2e-310)
		tmp = t_4 * (0.125 * t_6);
	elseif (d <= 1.05e-112)
		tmp = t_4 * (t_6 * -0.125);
	elseif (d <= 9.5e+133)
		tmp = t_0 * (t_1 * (1.0 - (0.5 * ((h * t_2) / l))));
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.45e+113], t$95$3, If[LessEqual[d, -3.7e-56], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(N[(h / l), $MachinePrecision] * N[(t$95$5 * t$95$5), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.4e-238], t$95$3, If[LessEqual[d, -2e-310], N[(t$95$4 * N[(0.125 * t$95$6), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.05e-112], N[(t$95$4 * N[(t$95$6 * -0.125), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.5e+133], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(h * t$95$2), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\\
t_3 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot t_2\right)\right)\\
t_4 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_5 := M \cdot \frac{D}{d}\\
t_6 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -2.45 \cdot 10^{+113}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;d \leq -3.7 \cdot 10^{-56}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_5 \cdot t_5\right)\right) \cdot 0.25\right)\right)\right)\\

\mathbf{elif}\;d \leq -5.4 \cdot 10^{-238}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_4 \cdot \left(0.125 \cdot t_6\right)\\

\mathbf{elif}\;d \leq 1.05 \cdot 10^{-112}:\\
\;\;\;\;t_4 \cdot \left(t_6 \cdot -0.125\right)\\

\mathbf{elif}\;d \leq 9.5 \cdot 10^{+133}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \frac{h \cdot t_2}{\ell}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if d < -2.45000000000000011e113 or -3.7000000000000002e-56 < d < -5.39999999999999981e-238

    1. Initial program 67.6%

      \[\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) \]
    2. Applied egg-rr22.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def27.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p56.4%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified56.4%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]

    if -2.45000000000000011e113 < d < -3.7000000000000002e-56

    1. Initial program 91.6%

      \[\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) \]
    2. Step-by-step derivation
      1. associate-*l*91.6%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right)} \]
      2. metadata-eval91.6%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right) \]
      3. unpow1/291.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right) \]
      4. metadata-eval91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      5. unpow1/291.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      6. associate-*l*91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{1}{2} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      7. metadata-eval91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.5} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      8. times-frac91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    3. Simplified91.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
    4. Taylor expanded in M around 0 80.1%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}\right)}\right)\right) \]
    5. Step-by-step derivation
      1. associate-*r/80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}\right)\right) \]
      2. *-commutative80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}}\right)\right) \]
      3. associate-*r/80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)}\right)\right) \]
      4. *-commutative80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.25\right)}\right)\right) \]
      5. associate-*r*77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.25\right)\right)\right) \]
      6. *-commutative77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{\color{blue}{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}}{{d}^{2} \cdot \ell} \cdot 0.25\right)\right)\right) \]
      7. *-commutative77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}{\color{blue}{\ell \cdot {d}^{2}}} \cdot 0.25\right)\right)\right) \]
      8. times-frac80.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\color{blue}{\left(\frac{h}{\ell} \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}}\right)} \cdot 0.25\right)\right)\right) \]
      9. *-commutative80.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{{M}^{2} \cdot {D}^{2}}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      10. unpow280.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot {D}^{2}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      11. unpow280.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot \color{blue}{\left(D \cdot D\right)}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      12. unswap-sqr88.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      13. unpow288.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\color{blue}{d \cdot d}}\right) \cdot 0.25\right)\right)\right) \]
      14. times-frac91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \color{blue}{\left(\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}\right)}\right) \cdot 0.25\right)\right)\right) \]
      15. associate-*r/91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\color{blue}{\left(M \cdot \frac{D}{d}\right)} \cdot \frac{M \cdot D}{d}\right)\right) \cdot 0.25\right)\right)\right) \]
      16. associate-*r/91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \color{blue}{\left(M \cdot \frac{D}{d}\right)}\right)\right) \cdot 0.25\right)\right)\right) \]
    6. Simplified91.6%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right) \cdot 0.25\right)}\right)\right) \]

    if -5.39999999999999981e-238 < d < -1.999999999999994e-310

    1. Initial program 29.9%

      \[\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) \]
    2. Applied egg-rr5.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def5.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p24.0%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified24.0%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around inf 65.3%

      \[\leadsto \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. *-commutative65.3%

        \[\leadsto 0.125 \cdot \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      2. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      3. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      4. associate-*l/59.5%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      5. *-commutative59.5%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right) \cdot 0.125} \]
      6. associate-*l*59.5%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right) \cdot 0.125\right)} \]
      7. *-commutative59.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(0.125 \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right)} \]
      8. associate-*r*60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      9. *-commutative60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      10. associate-/l*60.2%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      11. associate-*l/65.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified65.9%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if -1.999999999999994e-310 < d < 1.05e-112

    1. Initial program 35.1%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval35.1%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/235.1%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/235.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified35.2%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr35.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. *-commutative35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      3. clear-num35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      4. *-commutative35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} \cdot \frac{h}{\ell}\right) \]
      5. metadata-eval35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. associate-*r/37.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      7. metadata-eval37.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      8. times-frac37.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    7. Applied egg-rr37.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    8. Taylor expanded in d around 0 40.1%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. associate-*r*40.1%

        \[\leadsto \color{blue}{\left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
      2. *-commutative40.1%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      3. unpow240.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      4. unpow240.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      5. associate-*l/39.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      6. associate-*r*42.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      7. *-commutative42.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      8. associate-/l*48.0%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      9. associate-*l/50.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified50.5%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if 1.05e-112 < d < 9.49999999999999996e133

    1. Initial program 85.2%

      \[\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) \]
    2. Step-by-step derivation
      1. associate-*l*85.1%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right)} \]
      2. metadata-eval85.1%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right) \]
      3. unpow1/285.1%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right) \]
      4. metadata-eval85.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      5. unpow1/285.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      6. associate-*l*85.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{1}{2} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      7. metadata-eval85.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.5} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      8. times-frac85.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    3. Simplified85.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r/85.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right)\right) \]
      2. frac-times85.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot h}{\ell}\right)\right) \]
      3. *-commutative85.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{{\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot h}{\ell}\right)\right) \]
      4. *-commutative85.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{{\left(\frac{D \cdot M}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot h}{\ell}\right)\right) \]
      5. associate-*r/81.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{{\color{blue}{\left(D \cdot \frac{M}{d \cdot 2}\right)}}^{2} \cdot h}{\ell}\right)\right) \]
    5. Applied egg-rr81.8%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2} \cdot h}{\ell}}\right)\right) \]

    if 9.49999999999999996e133 < d

    1. Initial program 66.3%

      \[\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) \]
    2. Taylor expanded in d around inf 79.7%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative79.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative79.7%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*79.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified79.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div90.7%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow90.7%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr90.7%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow90.7%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square90.7%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval90.7%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow90.8%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr90.8%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow90.7%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified90.7%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification78.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.45 \cdot 10^{+113}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -3.7 \cdot 10^{-56}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right) \cdot 0.25\right)\right)\right)\\ \mathbf{elif}\;d \leq -5.4 \cdot 10^{-238}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;d \leq 1.05 \cdot 10^{-112}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right) \cdot -0.125\right)\\ \mathbf{elif}\;d \leq 9.5 \cdot 10^{+133}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 4: 70.7% accurate, 1.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \sqrt{\frac{h}{{\ell}^{3}}}\\ t_3 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ t_4 := M \cdot \frac{D}{d}\\ t_5 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\ \mathbf{if}\;d \leq -1.1 \cdot 10^{+109}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;d \leq -4.4 \cdot 10^{-56}:\\ \;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_4 \cdot t_4\right)\right) \cdot 0.25\right)\right)\right)\\ \mathbf{elif}\;d \leq -4.4 \cdot 10^{-238}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;t_2 \cdot \left(0.125 \cdot t_5\right)\\ \mathbf{elif}\;d \leq 7.2 \cdot 10^{-113}:\\ \;\;\;\;t_2 \cdot \left(t_5 \cdot -0.125\right)\\ \mathbf{elif}\;d \leq 1.08 \cdot 10^{+134}:\\ \;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - \left(\frac{h}{\ell} \cdot 0.5\right) \cdot {\left(\frac{\frac{D \cdot M}{2}}{d}\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d h)))
        (t_1 (sqrt (/ d l)))
        (t_2 (sqrt (/ h (pow l 3.0))))
        (t_3
         (*
          (* d (sqrt (/ 1.0 (* h l))))
          (- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0))))))
        (t_4 (* M (/ D d)))
        (t_5 (* M (/ (* D M) (/ d D)))))
   (if (<= d -1.1e+109)
     t_3
     (if (<= d -4.4e-56)
       (* t_0 (* t_1 (- 1.0 (* 0.5 (* (* (/ h l) (* t_4 t_4)) 0.25)))))
       (if (<= d -4.4e-238)
         t_3
         (if (<= d -2e-310)
           (* t_2 (* 0.125 t_5))
           (if (<= d 7.2e-113)
             (* t_2 (* t_5 -0.125))
             (if (<= d 1.08e+134)
               (*
                (* t_0 t_1)
                (- 1.0 (* (* (/ h l) 0.5) (pow (/ (/ (* D M) 2.0) d) 2.0))))
               (* d (/ (pow h -0.5) (sqrt l)))))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / h));
	double t_1 = sqrt((d / l));
	double t_2 = sqrt((h / pow(l, 3.0)));
	double t_3 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
	double t_4 = M * (D / d);
	double t_5 = M * ((D * M) / (d / D));
	double tmp;
	if (d <= -1.1e+109) {
		tmp = t_3;
	} else if (d <= -4.4e-56) {
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_4 * t_4)) * 0.25))));
	} else if (d <= -4.4e-238) {
		tmp = t_3;
	} else if (d <= -2e-310) {
		tmp = t_2 * (0.125 * t_5);
	} else if (d <= 7.2e-113) {
		tmp = t_2 * (t_5 * -0.125);
	} else if (d <= 1.08e+134) {
		tmp = (t_0 * t_1) * (1.0 - (((h / l) * 0.5) * pow((((D * M) / 2.0) / d), 2.0)));
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_0 = sqrt((d / h))
    t_1 = sqrt((d / l))
    t_2 = sqrt((h / (l ** 3.0d0)))
    t_3 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
    t_4 = m * (d_1 / d)
    t_5 = m * ((d_1 * m) / (d / d_1))
    if (d <= (-1.1d+109)) then
        tmp = t_3
    else if (d <= (-4.4d-56)) then
        tmp = t_0 * (t_1 * (1.0d0 - (0.5d0 * (((h / l) * (t_4 * t_4)) * 0.25d0))))
    else if (d <= (-4.4d-238)) then
        tmp = t_3
    else if (d <= (-2d-310)) then
        tmp = t_2 * (0.125d0 * t_5)
    else if (d <= 7.2d-113) then
        tmp = t_2 * (t_5 * (-0.125d0))
    else if (d <= 1.08d+134) then
        tmp = (t_0 * t_1) * (1.0d0 - (((h / l) * 0.5d0) * ((((d_1 * m) / 2.0d0) / d) ** 2.0d0)))
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / h));
	double t_1 = Math.sqrt((d / l));
	double t_2 = Math.sqrt((h / Math.pow(l, 3.0)));
	double t_3 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
	double t_4 = M * (D / d);
	double t_5 = M * ((D * M) / (d / D));
	double tmp;
	if (d <= -1.1e+109) {
		tmp = t_3;
	} else if (d <= -4.4e-56) {
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_4 * t_4)) * 0.25))));
	} else if (d <= -4.4e-238) {
		tmp = t_3;
	} else if (d <= -2e-310) {
		tmp = t_2 * (0.125 * t_5);
	} else if (d <= 7.2e-113) {
		tmp = t_2 * (t_5 * -0.125);
	} else if (d <= 1.08e+134) {
		tmp = (t_0 * t_1) * (1.0 - (((h / l) * 0.5) * Math.pow((((D * M) / 2.0) / d), 2.0)));
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / h))
	t_1 = math.sqrt((d / l))
	t_2 = math.sqrt((h / math.pow(l, 3.0)))
	t_3 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0))))
	t_4 = M * (D / d)
	t_5 = M * ((D * M) / (d / D))
	tmp = 0
	if d <= -1.1e+109:
		tmp = t_3
	elif d <= -4.4e-56:
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_4 * t_4)) * 0.25))))
	elif d <= -4.4e-238:
		tmp = t_3
	elif d <= -2e-310:
		tmp = t_2 * (0.125 * t_5)
	elif d <= 7.2e-113:
		tmp = t_2 * (t_5 * -0.125)
	elif d <= 1.08e+134:
		tmp = (t_0 * t_1) * (1.0 - (((h / l) * 0.5) * math.pow((((D * M) / 2.0) / d), 2.0)))
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / h))
	t_1 = sqrt(Float64(d / l))
	t_2 = sqrt(Float64(h / (l ^ 3.0)))
	t_3 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0)))))
	t_4 = Float64(M * Float64(D / d))
	t_5 = Float64(M * Float64(Float64(D * M) / Float64(d / D)))
	tmp = 0.0
	if (d <= -1.1e+109)
		tmp = t_3;
	elseif (d <= -4.4e-56)
		tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(Float64(h / l) * Float64(t_4 * t_4)) * 0.25)))));
	elseif (d <= -4.4e-238)
		tmp = t_3;
	elseif (d <= -2e-310)
		tmp = Float64(t_2 * Float64(0.125 * t_5));
	elseif (d <= 7.2e-113)
		tmp = Float64(t_2 * Float64(t_5 * -0.125));
	elseif (d <= 1.08e+134)
		tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 - Float64(Float64(Float64(h / l) * 0.5) * (Float64(Float64(Float64(D * M) / 2.0) / d) ^ 2.0))));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / h));
	t_1 = sqrt((d / l));
	t_2 = sqrt((h / (l ^ 3.0)));
	t_3 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
	t_4 = M * (D / d);
	t_5 = M * ((D * M) / (d / D));
	tmp = 0.0;
	if (d <= -1.1e+109)
		tmp = t_3;
	elseif (d <= -4.4e-56)
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_4 * t_4)) * 0.25))));
	elseif (d <= -4.4e-238)
		tmp = t_3;
	elseif (d <= -2e-310)
		tmp = t_2 * (0.125 * t_5);
	elseif (d <= 7.2e-113)
		tmp = t_2 * (t_5 * -0.125);
	elseif (d <= 1.08e+134)
		tmp = (t_0 * t_1) * (1.0 - (((h / l) * 0.5) * ((((D * M) / 2.0) / d) ^ 2.0)));
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.1e+109], t$95$3, If[LessEqual[d, -4.4e-56], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(N[(h / l), $MachinePrecision] * N[(t$95$4 * t$95$4), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.4e-238], t$95$3, If[LessEqual[d, -2e-310], N[(t$95$2 * N[(0.125 * t$95$5), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.2e-113], N[(t$95$2 * N[(t$95$5 * -0.125), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.08e+134], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * 0.5), $MachinePrecision] * N[Power[N[(N[(N[(D * M), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_3 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
t_4 := M \cdot \frac{D}{d}\\
t_5 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -1.1 \cdot 10^{+109}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;d \leq -4.4 \cdot 10^{-56}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_4 \cdot t_4\right)\right) \cdot 0.25\right)\right)\right)\\

\mathbf{elif}\;d \leq -4.4 \cdot 10^{-238}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_2 \cdot \left(0.125 \cdot t_5\right)\\

\mathbf{elif}\;d \leq 7.2 \cdot 10^{-113}:\\
\;\;\;\;t_2 \cdot \left(t_5 \cdot -0.125\right)\\

\mathbf{elif}\;d \leq 1.08 \cdot 10^{+134}:\\
\;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - \left(\frac{h}{\ell} \cdot 0.5\right) \cdot {\left(\frac{\frac{D \cdot M}{2}}{d}\right)}^{2}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if d < -1.1e109 or -4.40000000000000008e-56 < d < -4.39999999999999982e-238

    1. Initial program 67.6%

      \[\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) \]
    2. Applied egg-rr22.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def27.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p56.4%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified56.4%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]

    if -1.1e109 < d < -4.40000000000000008e-56

    1. Initial program 91.6%

      \[\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) \]
    2. Step-by-step derivation
      1. associate-*l*91.6%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right)} \]
      2. metadata-eval91.6%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right) \]
      3. unpow1/291.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right) \]
      4. metadata-eval91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      5. unpow1/291.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      6. associate-*l*91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{1}{2} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      7. metadata-eval91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.5} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      8. times-frac91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    3. Simplified91.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
    4. Taylor expanded in M around 0 80.1%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}\right)}\right)\right) \]
    5. Step-by-step derivation
      1. associate-*r/80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}\right)\right) \]
      2. *-commutative80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}}\right)\right) \]
      3. associate-*r/80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)}\right)\right) \]
      4. *-commutative80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.25\right)}\right)\right) \]
      5. associate-*r*77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.25\right)\right)\right) \]
      6. *-commutative77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{\color{blue}{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}}{{d}^{2} \cdot \ell} \cdot 0.25\right)\right)\right) \]
      7. *-commutative77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}{\color{blue}{\ell \cdot {d}^{2}}} \cdot 0.25\right)\right)\right) \]
      8. times-frac80.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\color{blue}{\left(\frac{h}{\ell} \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}}\right)} \cdot 0.25\right)\right)\right) \]
      9. *-commutative80.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{{M}^{2} \cdot {D}^{2}}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      10. unpow280.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot {D}^{2}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      11. unpow280.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot \color{blue}{\left(D \cdot D\right)}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      12. unswap-sqr88.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      13. unpow288.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\color{blue}{d \cdot d}}\right) \cdot 0.25\right)\right)\right) \]
      14. times-frac91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \color{blue}{\left(\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}\right)}\right) \cdot 0.25\right)\right)\right) \]
      15. associate-*r/91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\color{blue}{\left(M \cdot \frac{D}{d}\right)} \cdot \frac{M \cdot D}{d}\right)\right) \cdot 0.25\right)\right)\right) \]
      16. associate-*r/91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \color{blue}{\left(M \cdot \frac{D}{d}\right)}\right)\right) \cdot 0.25\right)\right)\right) \]
    6. Simplified91.6%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right) \cdot 0.25\right)}\right)\right) \]

    if -4.39999999999999982e-238 < d < -1.999999999999994e-310

    1. Initial program 29.9%

      \[\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) \]
    2. Applied egg-rr5.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def5.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p24.0%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified24.0%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around inf 65.3%

      \[\leadsto \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. *-commutative65.3%

        \[\leadsto 0.125 \cdot \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      2. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      3. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      4. associate-*l/59.5%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      5. *-commutative59.5%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right) \cdot 0.125} \]
      6. associate-*l*59.5%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right) \cdot 0.125\right)} \]
      7. *-commutative59.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(0.125 \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right)} \]
      8. associate-*r*60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      9. *-commutative60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      10. associate-/l*60.2%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      11. associate-*l/65.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified65.9%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if -1.999999999999994e-310 < d < 7.1999999999999995e-113

    1. Initial program 35.1%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval35.1%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/235.1%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/235.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified35.2%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr35.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. *-commutative35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      3. clear-num35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      4. *-commutative35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} \cdot \frac{h}{\ell}\right) \]
      5. metadata-eval35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. associate-*r/37.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      7. metadata-eval37.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      8. times-frac37.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    7. Applied egg-rr37.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    8. Taylor expanded in d around 0 40.1%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. associate-*r*40.1%

        \[\leadsto \color{blue}{\left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
      2. *-commutative40.1%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      3. unpow240.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      4. unpow240.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      5. associate-*l/39.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      6. associate-*r*42.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      7. *-commutative42.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      8. associate-/l*48.0%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      9. associate-*l/50.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified50.5%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if 7.1999999999999995e-113 < d < 1.0800000000000001e134

    1. Initial program 85.2%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval85.2%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/285.2%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval85.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/285.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative85.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*85.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac85.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval85.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified85.2%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times87.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
      2. associate-/r*87.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{\frac{M \cdot D}{2}}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    5. Applied egg-rr85.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{\frac{M \cdot D}{2}}{d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]

    if 1.0800000000000001e134 < d

    1. Initial program 66.3%

      \[\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) \]
    2. Taylor expanded in d around inf 79.7%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative79.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative79.7%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*79.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified79.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div90.7%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow90.7%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr90.7%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow90.7%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square90.7%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval90.7%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow90.8%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr90.8%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow90.7%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified90.7%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification79.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.1 \cdot 10^{+109}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -4.4 \cdot 10^{-56}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right) \cdot 0.25\right)\right)\right)\\ \mathbf{elif}\;d \leq -4.4 \cdot 10^{-238}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;d \leq 7.2 \cdot 10^{-113}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right) \cdot -0.125\right)\\ \mathbf{elif}\;d \leq 1.08 \cdot 10^{+134}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\frac{h}{\ell} \cdot 0.5\right) \cdot {\left(\frac{\frac{D \cdot M}{2}}{d}\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 5: 71.6% accurate, 1.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ t_3 := M \cdot \frac{D}{d}\\ \mathbf{if}\;d \leq -3.15 \cdot 10^{+111}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-56}:\\ \;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_3 \cdot t_3\right)\right) \cdot 0.25\right)\right)\right)\\ \mathbf{elif}\;d \leq -4.4 \cdot 10^{-238}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;d \leq 4 \cdot 10^{-236}:\\ \;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\ \mathbf{elif}\;d \leq 3.5 \cdot 10^{+134}:\\ \;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d h)))
        (t_1 (sqrt (/ d l)))
        (t_2
         (*
          (* d (sqrt (/ 1.0 (* h l))))
          (- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0))))))
        (t_3 (* M (/ D d))))
   (if (<= d -3.15e+111)
     t_2
     (if (<= d -5e-56)
       (* t_0 (* t_1 (- 1.0 (* 0.5 (* (* (/ h l) (* t_3 t_3)) 0.25)))))
       (if (<= d -4.4e-238)
         t_2
         (if (<= d -2e-310)
           (* (sqrt (/ h (pow l 3.0))) (* 0.125 (* M (/ (* D M) (/ d D)))))
           (if (<= d 4e-236)
             (* -0.125 (* (/ (* D D) (/ d (* M M))) (/ (sqrt h) (pow l 1.5))))
             (if (<= d 3.5e+134)
               (*
                (* t_0 t_1)
                (- 1.0 (/ (* h (* 0.5 (pow (* (/ D d) (/ M 2.0)) 2.0))) l)))
               (* d (/ (pow h -0.5) (sqrt l)))))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / h));
	double t_1 = sqrt((d / l));
	double t_2 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
	double t_3 = M * (D / d);
	double tmp;
	if (d <= -3.15e+111) {
		tmp = t_2;
	} else if (d <= -5e-56) {
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25))));
	} else if (d <= -4.4e-238) {
		tmp = t_2;
	} else if (d <= -2e-310) {
		tmp = sqrt((h / pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	} else if (d <= 4e-236) {
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / pow(l, 1.5)));
	} else if (d <= 3.5e+134) {
		tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * pow(((D / d) * (M / 2.0)), 2.0))) / l));
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = sqrt((d / h))
    t_1 = sqrt((d / l))
    t_2 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
    t_3 = m * (d_1 / d)
    if (d <= (-3.15d+111)) then
        tmp = t_2
    else if (d <= (-5d-56)) then
        tmp = t_0 * (t_1 * (1.0d0 - (0.5d0 * (((h / l) * (t_3 * t_3)) * 0.25d0))))
    else if (d <= (-4.4d-238)) then
        tmp = t_2
    else if (d <= (-2d-310)) then
        tmp = sqrt((h / (l ** 3.0d0))) * (0.125d0 * (m * ((d_1 * m) / (d / d_1))))
    else if (d <= 4d-236) then
        tmp = (-0.125d0) * (((d_1 * d_1) / (d / (m * m))) * (sqrt(h) / (l ** 1.5d0)))
    else if (d <= 3.5d+134) then
        tmp = (t_0 * t_1) * (1.0d0 - ((h * (0.5d0 * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0))) / l))
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / h));
	double t_1 = Math.sqrt((d / l));
	double t_2 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
	double t_3 = M * (D / d);
	double tmp;
	if (d <= -3.15e+111) {
		tmp = t_2;
	} else if (d <= -5e-56) {
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25))));
	} else if (d <= -4.4e-238) {
		tmp = t_2;
	} else if (d <= -2e-310) {
		tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	} else if (d <= 4e-236) {
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (Math.sqrt(h) / Math.pow(l, 1.5)));
	} else if (d <= 3.5e+134) {
		tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * Math.pow(((D / d) * (M / 2.0)), 2.0))) / l));
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / h))
	t_1 = math.sqrt((d / l))
	t_2 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0))))
	t_3 = M * (D / d)
	tmp = 0
	if d <= -3.15e+111:
		tmp = t_2
	elif d <= -5e-56:
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25))))
	elif d <= -4.4e-238:
		tmp = t_2
	elif d <= -2e-310:
		tmp = math.sqrt((h / math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))))
	elif d <= 4e-236:
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (math.sqrt(h) / math.pow(l, 1.5)))
	elif d <= 3.5e+134:
		tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * math.pow(((D / d) * (M / 2.0)), 2.0))) / l))
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / h))
	t_1 = sqrt(Float64(d / l))
	t_2 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0)))))
	t_3 = Float64(M * Float64(D / d))
	tmp = 0.0
	if (d <= -3.15e+111)
		tmp = t_2;
	elseif (d <= -5e-56)
		tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(Float64(h / l) * Float64(t_3 * t_3)) * 0.25)))));
	elseif (d <= -4.4e-238)
		tmp = t_2;
	elseif (d <= -2e-310)
		tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(0.125 * Float64(M * Float64(Float64(D * M) / Float64(d / D)))));
	elseif (d <= 4e-236)
		tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d / Float64(M * M))) * Float64(sqrt(h) / (l ^ 1.5))));
	elseif (d <= 3.5e+134)
		tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0))) / l)));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / h));
	t_1 = sqrt((d / l));
	t_2 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
	t_3 = M * (D / d);
	tmp = 0.0;
	if (d <= -3.15e+111)
		tmp = t_2;
	elseif (d <= -5e-56)
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25))));
	elseif (d <= -4.4e-238)
		tmp = t_2;
	elseif (d <= -2e-310)
		tmp = sqrt((h / (l ^ 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	elseif (d <= 4e-236)
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / (l ^ 1.5)));
	elseif (d <= 3.5e+134)
		tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * (((D / d) * (M / 2.0)) ^ 2.0))) / l));
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.15e+111], t$95$2, If[LessEqual[d, -5e-56], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(N[(h / l), $MachinePrecision] * N[(t$95$3 * t$95$3), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.4e-238], t$95$2, If[LessEqual[d, -2e-310], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4e-236], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.5e+134], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
t_3 := M \cdot \frac{D}{d}\\
\mathbf{if}\;d \leq -3.15 \cdot 10^{+111}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;d \leq -5 \cdot 10^{-56}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_3 \cdot t_3\right)\right) \cdot 0.25\right)\right)\right)\\

\mathbf{elif}\;d \leq -4.4 \cdot 10^{-238}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\

\mathbf{elif}\;d \leq 4 \cdot 10^{-236}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\

\mathbf{elif}\;d \leq 3.5 \cdot 10^{+134}:\\
\;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)}{\ell}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if d < -3.1500000000000001e111 or -4.99999999999999997e-56 < d < -4.39999999999999982e-238

    1. Initial program 67.6%

      \[\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) \]
    2. Applied egg-rr22.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def27.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p56.4%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified56.4%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]

    if -3.1500000000000001e111 < d < -4.99999999999999997e-56

    1. Initial program 91.6%

      \[\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) \]
    2. Step-by-step derivation
      1. associate-*l*91.6%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right)} \]
      2. metadata-eval91.6%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right) \]
      3. unpow1/291.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right) \]
      4. metadata-eval91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      5. unpow1/291.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      6. associate-*l*91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{1}{2} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      7. metadata-eval91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.5} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      8. times-frac91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    3. Simplified91.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
    4. Taylor expanded in M around 0 80.1%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}\right)}\right)\right) \]
    5. Step-by-step derivation
      1. associate-*r/80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}\right)\right) \]
      2. *-commutative80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}}\right)\right) \]
      3. associate-*r/80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)}\right)\right) \]
      4. *-commutative80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.25\right)}\right)\right) \]
      5. associate-*r*77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.25\right)\right)\right) \]
      6. *-commutative77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{\color{blue}{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}}{{d}^{2} \cdot \ell} \cdot 0.25\right)\right)\right) \]
      7. *-commutative77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}{\color{blue}{\ell \cdot {d}^{2}}} \cdot 0.25\right)\right)\right) \]
      8. times-frac80.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\color{blue}{\left(\frac{h}{\ell} \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}}\right)} \cdot 0.25\right)\right)\right) \]
      9. *-commutative80.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{{M}^{2} \cdot {D}^{2}}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      10. unpow280.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot {D}^{2}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      11. unpow280.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot \color{blue}{\left(D \cdot D\right)}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      12. unswap-sqr88.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      13. unpow288.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\color{blue}{d \cdot d}}\right) \cdot 0.25\right)\right)\right) \]
      14. times-frac91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \color{blue}{\left(\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}\right)}\right) \cdot 0.25\right)\right)\right) \]
      15. associate-*r/91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\color{blue}{\left(M \cdot \frac{D}{d}\right)} \cdot \frac{M \cdot D}{d}\right)\right) \cdot 0.25\right)\right)\right) \]
      16. associate-*r/91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \color{blue}{\left(M \cdot \frac{D}{d}\right)}\right)\right) \cdot 0.25\right)\right)\right) \]
    6. Simplified91.6%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right) \cdot 0.25\right)}\right)\right) \]

    if -4.39999999999999982e-238 < d < -1.999999999999994e-310

    1. Initial program 29.9%

      \[\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) \]
    2. Applied egg-rr5.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def5.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p24.0%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified24.0%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around inf 65.3%

      \[\leadsto \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. *-commutative65.3%

        \[\leadsto 0.125 \cdot \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      2. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      3. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      4. associate-*l/59.5%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      5. *-commutative59.5%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right) \cdot 0.125} \]
      6. associate-*l*59.5%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right) \cdot 0.125\right)} \]
      7. *-commutative59.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(0.125 \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right)} \]
      8. associate-*r*60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      9. *-commutative60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      10. associate-/l*60.2%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      11. associate-*l/65.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified65.9%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if -1.999999999999994e-310 < d < 4.0000000000000002e-236

    1. Initial program 33.4%

      \[\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) \]
    2. Taylor expanded in d around 0 49.2%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    3. Step-by-step derivation
      1. associate-/l*44.3%

        \[\leadsto -0.125 \cdot \left(\color{blue}{\frac{{D}^{2}}{\frac{d}{{M}^{2}}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      2. unpow244.3%

        \[\leadsto -0.125 \cdot \left(\frac{\color{blue}{D \cdot D}}{\frac{d}{{M}^{2}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      3. unpow244.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
    4. Simplified44.3%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    5. Step-by-step derivation
      1. sqrt-div44.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \color{blue}{\frac{\sqrt{h}}{\sqrt{{\ell}^{3}}}}\right) \]
    6. Applied egg-rr44.3%

      \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \color{blue}{\frac{\sqrt{h}}{\sqrt{{\ell}^{3}}}}\right) \]
    7. Step-by-step derivation
      1. sqr-pow44.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\sqrt{\color{blue}{{\ell}^{\left(\frac{3}{2}\right)} \cdot {\ell}^{\left(\frac{3}{2}\right)}}}}\right) \]
      2. rem-sqrt-square54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\color{blue}{\left|{\ell}^{\left(\frac{3}{2}\right)}\right|}}\right) \]
      3. sqr-pow54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\left|\color{blue}{{\ell}^{\left(\frac{\frac{3}{2}}{2}\right)} \cdot {\ell}^{\left(\frac{\frac{3}{2}}{2}\right)}}\right|}\right) \]
      4. fabs-sqr54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\color{blue}{{\ell}^{\left(\frac{\frac{3}{2}}{2}\right)} \cdot {\ell}^{\left(\frac{\frac{3}{2}}{2}\right)}}}\right) \]
      5. sqr-pow54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\color{blue}{{\ell}^{\left(\frac{3}{2}\right)}}}\right) \]
      6. metadata-eval54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{\color{blue}{1.5}}}\right) \]
    8. Simplified54.3%

      \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \color{blue}{\frac{\sqrt{h}}{{\ell}^{1.5}}}\right) \]

    if 4.0000000000000002e-236 < d < 3.50000000000000003e134

    1. Initial program 73.6%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval73.6%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/273.6%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/273.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified73.7%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr73.7%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. *-commutative73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      3. clear-num73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      4. *-commutative73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} \cdot \frac{h}{\ell}\right) \]
      5. metadata-eval73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. associate-*r/76.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      7. metadata-eval76.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      8. times-frac76.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    7. Applied egg-rr76.3%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]

    if 3.50000000000000003e134 < d

    1. Initial program 66.3%

      \[\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) \]
    2. Taylor expanded in d around inf 79.7%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative79.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative79.7%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*79.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified79.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div90.7%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow90.7%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr90.7%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow90.7%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square90.7%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval90.7%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow90.8%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr90.8%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow90.7%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified90.7%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification79.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -3.15 \cdot 10^{+111}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-56}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right) \cdot 0.25\right)\right)\right)\\ \mathbf{elif}\;d \leq -4.4 \cdot 10^{-238}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;d \leq 4 \cdot 10^{-236}:\\ \;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\ \mathbf{elif}\;d \leq 3.5 \cdot 10^{+134}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 6: 71.7% accurate, 1.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ t_3 := M \cdot \frac{D}{d}\\ \mathbf{if}\;d \leq -8 \cdot 10^{+113}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;d \leq -5.2 \cdot 10^{-56}:\\ \;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_3 \cdot t_3\right)\right) \cdot 0.25\right)\right)\right)\\ \mathbf{elif}\;d \leq -5.2 \cdot 10^{-238}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;d \leq 4 \cdot 10^{-236}:\\ \;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\ \mathbf{elif}\;d \leq 1.9 \cdot 10^{+134}:\\ \;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{\frac{D \cdot M}{2}}{d}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d h)))
        (t_1 (sqrt (/ d l)))
        (t_2
         (*
          (* d (sqrt (/ 1.0 (* h l))))
          (- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0))))))
        (t_3 (* M (/ D d))))
   (if (<= d -8e+113)
     t_2
     (if (<= d -5.2e-56)
       (* t_0 (* t_1 (- 1.0 (* 0.5 (* (* (/ h l) (* t_3 t_3)) 0.25)))))
       (if (<= d -5.2e-238)
         t_2
         (if (<= d -2e-310)
           (* (sqrt (/ h (pow l 3.0))) (* 0.125 (* M (/ (* D M) (/ d D)))))
           (if (<= d 4e-236)
             (* -0.125 (* (/ (* D D) (/ d (* M M))) (/ (sqrt h) (pow l 1.5))))
             (if (<= d 1.9e+134)
               (*
                (* t_0 t_1)
                (- 1.0 (/ (* h (* 0.5 (pow (/ (/ (* D M) 2.0) d) 2.0))) l)))
               (* d (/ (pow h -0.5) (sqrt l)))))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / h));
	double t_1 = sqrt((d / l));
	double t_2 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
	double t_3 = M * (D / d);
	double tmp;
	if (d <= -8e+113) {
		tmp = t_2;
	} else if (d <= -5.2e-56) {
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25))));
	} else if (d <= -5.2e-238) {
		tmp = t_2;
	} else if (d <= -2e-310) {
		tmp = sqrt((h / pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	} else if (d <= 4e-236) {
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / pow(l, 1.5)));
	} else if (d <= 1.9e+134) {
		tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * pow((((D * M) / 2.0) / d), 2.0))) / l));
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = sqrt((d / h))
    t_1 = sqrt((d / l))
    t_2 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
    t_3 = m * (d_1 / d)
    if (d <= (-8d+113)) then
        tmp = t_2
    else if (d <= (-5.2d-56)) then
        tmp = t_0 * (t_1 * (1.0d0 - (0.5d0 * (((h / l) * (t_3 * t_3)) * 0.25d0))))
    else if (d <= (-5.2d-238)) then
        tmp = t_2
    else if (d <= (-2d-310)) then
        tmp = sqrt((h / (l ** 3.0d0))) * (0.125d0 * (m * ((d_1 * m) / (d / d_1))))
    else if (d <= 4d-236) then
        tmp = (-0.125d0) * (((d_1 * d_1) / (d / (m * m))) * (sqrt(h) / (l ** 1.5d0)))
    else if (d <= 1.9d+134) then
        tmp = (t_0 * t_1) * (1.0d0 - ((h * (0.5d0 * ((((d_1 * m) / 2.0d0) / d) ** 2.0d0))) / l))
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / h));
	double t_1 = Math.sqrt((d / l));
	double t_2 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
	double t_3 = M * (D / d);
	double tmp;
	if (d <= -8e+113) {
		tmp = t_2;
	} else if (d <= -5.2e-56) {
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25))));
	} else if (d <= -5.2e-238) {
		tmp = t_2;
	} else if (d <= -2e-310) {
		tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	} else if (d <= 4e-236) {
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (Math.sqrt(h) / Math.pow(l, 1.5)));
	} else if (d <= 1.9e+134) {
		tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * Math.pow((((D * M) / 2.0) / d), 2.0))) / l));
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / h))
	t_1 = math.sqrt((d / l))
	t_2 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0))))
	t_3 = M * (D / d)
	tmp = 0
	if d <= -8e+113:
		tmp = t_2
	elif d <= -5.2e-56:
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25))))
	elif d <= -5.2e-238:
		tmp = t_2
	elif d <= -2e-310:
		tmp = math.sqrt((h / math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))))
	elif d <= 4e-236:
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (math.sqrt(h) / math.pow(l, 1.5)))
	elif d <= 1.9e+134:
		tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * math.pow((((D * M) / 2.0) / d), 2.0))) / l))
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / h))
	t_1 = sqrt(Float64(d / l))
	t_2 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0)))))
	t_3 = Float64(M * Float64(D / d))
	tmp = 0.0
	if (d <= -8e+113)
		tmp = t_2;
	elseif (d <= -5.2e-56)
		tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(Float64(h / l) * Float64(t_3 * t_3)) * 0.25)))));
	elseif (d <= -5.2e-238)
		tmp = t_2;
	elseif (d <= -2e-310)
		tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(0.125 * Float64(M * Float64(Float64(D * M) / Float64(d / D)))));
	elseif (d <= 4e-236)
		tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d / Float64(M * M))) * Float64(sqrt(h) / (l ^ 1.5))));
	elseif (d <= 1.9e+134)
		tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(Float64(D * M) / 2.0) / d) ^ 2.0))) / l)));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / h));
	t_1 = sqrt((d / l));
	t_2 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
	t_3 = M * (D / d);
	tmp = 0.0;
	if (d <= -8e+113)
		tmp = t_2;
	elseif (d <= -5.2e-56)
		tmp = t_0 * (t_1 * (1.0 - (0.5 * (((h / l) * (t_3 * t_3)) * 0.25))));
	elseif (d <= -5.2e-238)
		tmp = t_2;
	elseif (d <= -2e-310)
		tmp = sqrt((h / (l ^ 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	elseif (d <= 4e-236)
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / (l ^ 1.5)));
	elseif (d <= 1.9e+134)
		tmp = (t_0 * t_1) * (1.0 - ((h * (0.5 * ((((D * M) / 2.0) / d) ^ 2.0))) / l));
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8e+113], t$95$2, If[LessEqual[d, -5.2e-56], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(N[(h / l), $MachinePrecision] * N[(t$95$3 * t$95$3), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.2e-238], t$95$2, If[LessEqual[d, -2e-310], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4e-236], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.9e+134], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(N[(D * M), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
t_3 := M \cdot \frac{D}{d}\\
\mathbf{if}\;d \leq -8 \cdot 10^{+113}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;d \leq -5.2 \cdot 10^{-56}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_3 \cdot t_3\right)\right) \cdot 0.25\right)\right)\right)\\

\mathbf{elif}\;d \leq -5.2 \cdot 10^{-238}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\

\mathbf{elif}\;d \leq 4 \cdot 10^{-236}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\

\mathbf{elif}\;d \leq 1.9 \cdot 10^{+134}:\\
\;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{\frac{D \cdot M}{2}}{d}\right)}^{2}\right)}{\ell}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if d < -8e113 or -5.19999999999999994e-56 < d < -5.2000000000000002e-238

    1. Initial program 67.6%

      \[\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) \]
    2. Applied egg-rr22.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def27.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p56.4%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified56.4%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]

    if -8e113 < d < -5.19999999999999994e-56

    1. Initial program 91.6%

      \[\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) \]
    2. Step-by-step derivation
      1. associate-*l*91.6%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right)} \]
      2. metadata-eval91.6%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right) \]
      3. unpow1/291.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right) \]
      4. metadata-eval91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      5. unpow1/291.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      6. associate-*l*91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{1}{2} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      7. metadata-eval91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.5} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      8. times-frac91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    3. Simplified91.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
    4. Taylor expanded in M around 0 80.1%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}\right)}\right)\right) \]
    5. Step-by-step derivation
      1. associate-*r/80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}\right)\right) \]
      2. *-commutative80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}}\right)\right) \]
      3. associate-*r/80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)}\right)\right) \]
      4. *-commutative80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.25\right)}\right)\right) \]
      5. associate-*r*77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.25\right)\right)\right) \]
      6. *-commutative77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{\color{blue}{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}}{{d}^{2} \cdot \ell} \cdot 0.25\right)\right)\right) \]
      7. *-commutative77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}{\color{blue}{\ell \cdot {d}^{2}}} \cdot 0.25\right)\right)\right) \]
      8. times-frac80.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\color{blue}{\left(\frac{h}{\ell} \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}}\right)} \cdot 0.25\right)\right)\right) \]
      9. *-commutative80.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{{M}^{2} \cdot {D}^{2}}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      10. unpow280.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot {D}^{2}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      11. unpow280.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot \color{blue}{\left(D \cdot D\right)}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      12. unswap-sqr88.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      13. unpow288.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\color{blue}{d \cdot d}}\right) \cdot 0.25\right)\right)\right) \]
      14. times-frac91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \color{blue}{\left(\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}\right)}\right) \cdot 0.25\right)\right)\right) \]
      15. associate-*r/91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\color{blue}{\left(M \cdot \frac{D}{d}\right)} \cdot \frac{M \cdot D}{d}\right)\right) \cdot 0.25\right)\right)\right) \]
      16. associate-*r/91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \color{blue}{\left(M \cdot \frac{D}{d}\right)}\right)\right) \cdot 0.25\right)\right)\right) \]
    6. Simplified91.6%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right) \cdot 0.25\right)}\right)\right) \]

    if -5.2000000000000002e-238 < d < -1.999999999999994e-310

    1. Initial program 29.9%

      \[\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) \]
    2. Applied egg-rr5.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def5.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p24.0%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified24.0%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around inf 65.3%

      \[\leadsto \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. *-commutative65.3%

        \[\leadsto 0.125 \cdot \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      2. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      3. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      4. associate-*l/59.5%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      5. *-commutative59.5%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right) \cdot 0.125} \]
      6. associate-*l*59.5%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right) \cdot 0.125\right)} \]
      7. *-commutative59.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(0.125 \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right)} \]
      8. associate-*r*60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      9. *-commutative60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      10. associate-/l*60.2%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      11. associate-*l/65.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified65.9%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if -1.999999999999994e-310 < d < 4.0000000000000002e-236

    1. Initial program 33.4%

      \[\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) \]
    2. Taylor expanded in d around 0 49.2%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    3. Step-by-step derivation
      1. associate-/l*44.3%

        \[\leadsto -0.125 \cdot \left(\color{blue}{\frac{{D}^{2}}{\frac{d}{{M}^{2}}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      2. unpow244.3%

        \[\leadsto -0.125 \cdot \left(\frac{\color{blue}{D \cdot D}}{\frac{d}{{M}^{2}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      3. unpow244.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
    4. Simplified44.3%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    5. Step-by-step derivation
      1. sqrt-div44.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \color{blue}{\frac{\sqrt{h}}{\sqrt{{\ell}^{3}}}}\right) \]
    6. Applied egg-rr44.3%

      \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \color{blue}{\frac{\sqrt{h}}{\sqrt{{\ell}^{3}}}}\right) \]
    7. Step-by-step derivation
      1. sqr-pow44.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\sqrt{\color{blue}{{\ell}^{\left(\frac{3}{2}\right)} \cdot {\ell}^{\left(\frac{3}{2}\right)}}}}\right) \]
      2. rem-sqrt-square54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\color{blue}{\left|{\ell}^{\left(\frac{3}{2}\right)}\right|}}\right) \]
      3. sqr-pow54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\left|\color{blue}{{\ell}^{\left(\frac{\frac{3}{2}}{2}\right)} \cdot {\ell}^{\left(\frac{\frac{3}{2}}{2}\right)}}\right|}\right) \]
      4. fabs-sqr54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\color{blue}{{\ell}^{\left(\frac{\frac{3}{2}}{2}\right)} \cdot {\ell}^{\left(\frac{\frac{3}{2}}{2}\right)}}}\right) \]
      5. sqr-pow54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\color{blue}{{\ell}^{\left(\frac{3}{2}\right)}}}\right) \]
      6. metadata-eval54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{\color{blue}{1.5}}}\right) \]
    8. Simplified54.3%

      \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \color{blue}{\frac{\sqrt{h}}{{\ell}^{1.5}}}\right) \]

    if 4.0000000000000002e-236 < d < 1.89999999999999999e134

    1. Initial program 73.6%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval73.6%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/273.6%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/273.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified73.7%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr73.7%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. *-commutative73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      3. clear-num73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      4. *-commutative73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} \cdot \frac{h}{\ell}\right) \]
      5. metadata-eval73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. associate-*r/76.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      7. metadata-eval76.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      8. times-frac76.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    7. Applied egg-rr76.3%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    8. Step-by-step derivation
      1. frac-times76.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
      2. associate-/r*76.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{\frac{M \cdot D}{2}}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    9. Applied egg-rr76.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{\frac{M \cdot D}{2}}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]

    if 1.89999999999999999e134 < d

    1. Initial program 66.3%

      \[\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) \]
    2. Taylor expanded in d around inf 79.7%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative79.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative79.7%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*79.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified79.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div90.7%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow90.7%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr90.7%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow90.7%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square90.7%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval90.7%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow90.8%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr90.8%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow90.7%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified90.7%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification79.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -8 \cdot 10^{+113}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -5.2 \cdot 10^{-56}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right) \cdot 0.25\right)\right)\right)\\ \mathbf{elif}\;d \leq -5.2 \cdot 10^{-238}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;d \leq 4 \cdot 10^{-236}:\\ \;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\ \mathbf{elif}\;d \leq 1.9 \cdot 10^{+134}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{\frac{D \cdot M}{2}}{d}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 7: 71.8% accurate, 1.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ t_1 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{if}\;d \leq -8 \cdot 10^{+113}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq -3.5 \cdot 10^{-56}:\\ \;\;\;\;t_0 \cdot \left(1 - {\left(\frac{1}{\frac{2 \cdot d}{D \cdot M}}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\\ \mathbf{elif}\;d \leq -5.1 \cdot 10^{-238}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;d \leq 6.8 \cdot 10^{-239}:\\ \;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\ \mathbf{elif}\;d \leq 2 \cdot 10^{+134}:\\ \;\;\;\;t_0 \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{\frac{D \cdot M}{2}}{d}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* (sqrt (/ d h)) (sqrt (/ d l))))
        (t_1
         (*
          (* d (sqrt (/ 1.0 (* h l))))
          (- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0)))))))
   (if (<= d -8e+113)
     t_1
     (if (<= d -3.5e-56)
       (*
        t_0
        (- 1.0 (* (pow (/ 1.0 (/ (* 2.0 d) (* D M))) 2.0) (* (/ h l) 0.5))))
       (if (<= d -5.1e-238)
         t_1
         (if (<= d -2e-310)
           (* (sqrt (/ h (pow l 3.0))) (* 0.125 (* M (/ (* D M) (/ d D)))))
           (if (<= d 6.8e-239)
             (* -0.125 (* (/ (* D D) (/ d (* M M))) (/ (sqrt h) (pow l 1.5))))
             (if (<= d 2e+134)
               (*
                t_0
                (- 1.0 (/ (* h (* 0.5 (pow (/ (/ (* D M) 2.0) d) 2.0))) l)))
               (* d (/ (pow h -0.5) (sqrt l)))))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / h)) * sqrt((d / l));
	double t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
	double tmp;
	if (d <= -8e+113) {
		tmp = t_1;
	} else if (d <= -3.5e-56) {
		tmp = t_0 * (1.0 - (pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)));
	} else if (d <= -5.1e-238) {
		tmp = t_1;
	} else if (d <= -2e-310) {
		tmp = sqrt((h / pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	} else if (d <= 6.8e-239) {
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / pow(l, 1.5)));
	} else if (d <= 2e+134) {
		tmp = t_0 * (1.0 - ((h * (0.5 * pow((((D * M) / 2.0) / d), 2.0))) / l));
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sqrt((d / h)) * sqrt((d / l))
    t_1 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
    if (d <= (-8d+113)) then
        tmp = t_1
    else if (d <= (-3.5d-56)) then
        tmp = t_0 * (1.0d0 - (((1.0d0 / ((2.0d0 * d) / (d_1 * m))) ** 2.0d0) * ((h / l) * 0.5d0)))
    else if (d <= (-5.1d-238)) then
        tmp = t_1
    else if (d <= (-2d-310)) then
        tmp = sqrt((h / (l ** 3.0d0))) * (0.125d0 * (m * ((d_1 * m) / (d / d_1))))
    else if (d <= 6.8d-239) then
        tmp = (-0.125d0) * (((d_1 * d_1) / (d / (m * m))) * (sqrt(h) / (l ** 1.5d0)))
    else if (d <= 2d+134) then
        tmp = t_0 * (1.0d0 - ((h * (0.5d0 * ((((d_1 * m) / 2.0d0) / d) ** 2.0d0))) / l))
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / h)) * Math.sqrt((d / l));
	double t_1 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
	double tmp;
	if (d <= -8e+113) {
		tmp = t_1;
	} else if (d <= -3.5e-56) {
		tmp = t_0 * (1.0 - (Math.pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)));
	} else if (d <= -5.1e-238) {
		tmp = t_1;
	} else if (d <= -2e-310) {
		tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	} else if (d <= 6.8e-239) {
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (Math.sqrt(h) / Math.pow(l, 1.5)));
	} else if (d <= 2e+134) {
		tmp = t_0 * (1.0 - ((h * (0.5 * Math.pow((((D * M) / 2.0) / d), 2.0))) / l));
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / h)) * math.sqrt((d / l))
	t_1 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0))))
	tmp = 0
	if d <= -8e+113:
		tmp = t_1
	elif d <= -3.5e-56:
		tmp = t_0 * (1.0 - (math.pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)))
	elif d <= -5.1e-238:
		tmp = t_1
	elif d <= -2e-310:
		tmp = math.sqrt((h / math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))))
	elif d <= 6.8e-239:
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (math.sqrt(h) / math.pow(l, 1.5)))
	elif d <= 2e+134:
		tmp = t_0 * (1.0 - ((h * (0.5 * math.pow((((D * M) / 2.0) / d), 2.0))) / l))
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))
	t_1 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0)))))
	tmp = 0.0
	if (d <= -8e+113)
		tmp = t_1;
	elseif (d <= -3.5e-56)
		tmp = Float64(t_0 * Float64(1.0 - Float64((Float64(1.0 / Float64(Float64(2.0 * d) / Float64(D * M))) ^ 2.0) * Float64(Float64(h / l) * 0.5))));
	elseif (d <= -5.1e-238)
		tmp = t_1;
	elseif (d <= -2e-310)
		tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(0.125 * Float64(M * Float64(Float64(D * M) / Float64(d / D)))));
	elseif (d <= 6.8e-239)
		tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d / Float64(M * M))) * Float64(sqrt(h) / (l ^ 1.5))));
	elseif (d <= 2e+134)
		tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(Float64(D * M) / 2.0) / d) ^ 2.0))) / l)));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / h)) * sqrt((d / l));
	t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
	tmp = 0.0;
	if (d <= -8e+113)
		tmp = t_1;
	elseif (d <= -3.5e-56)
		tmp = t_0 * (1.0 - (((1.0 / ((2.0 * d) / (D * M))) ^ 2.0) * ((h / l) * 0.5)));
	elseif (d <= -5.1e-238)
		tmp = t_1;
	elseif (d <= -2e-310)
		tmp = sqrt((h / (l ^ 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	elseif (d <= 6.8e-239)
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / (l ^ 1.5)));
	elseif (d <= 2e+134)
		tmp = t_0 * (1.0 - ((h * (0.5 * ((((D * M) / 2.0) / d) ^ 2.0))) / l));
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8e+113], t$95$1, If[LessEqual[d, -3.5e-56], N[(t$95$0 * N[(1.0 - N[(N[Power[N[(1.0 / N[(N[(2.0 * d), $MachinePrecision] / N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.1e-238], t$95$1, If[LessEqual[d, -2e-310], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.8e-239], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2e+134], N[(t$95$0 * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(N[(D * M), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
t_1 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
\mathbf{if}\;d \leq -8 \cdot 10^{+113}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;d \leq -3.5 \cdot 10^{-56}:\\
\;\;\;\;t_0 \cdot \left(1 - {\left(\frac{1}{\frac{2 \cdot d}{D \cdot M}}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\\

\mathbf{elif}\;d \leq -5.1 \cdot 10^{-238}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\

\mathbf{elif}\;d \leq 6.8 \cdot 10^{-239}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\

\mathbf{elif}\;d \leq 2 \cdot 10^{+134}:\\
\;\;\;\;t_0 \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{\frac{D \cdot M}{2}}{d}\right)}^{2}\right)}{\ell}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if d < -8e113 or -3.4999999999999998e-56 < d < -5.1000000000000001e-238

    1. Initial program 67.6%

      \[\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) \]
    2. Applied egg-rr22.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def27.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p56.4%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified56.4%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]

    if -8e113 < d < -3.4999999999999998e-56

    1. Initial program 91.6%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval91.6%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/291.6%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/291.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified91.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr91.6%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]

    if -5.1000000000000001e-238 < d < -1.999999999999994e-310

    1. Initial program 29.9%

      \[\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) \]
    2. Applied egg-rr5.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def5.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p24.0%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified24.0%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around inf 65.3%

      \[\leadsto \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. *-commutative65.3%

        \[\leadsto 0.125 \cdot \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      2. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      3. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      4. associate-*l/59.5%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      5. *-commutative59.5%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right) \cdot 0.125} \]
      6. associate-*l*59.5%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right) \cdot 0.125\right)} \]
      7. *-commutative59.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(0.125 \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right)} \]
      8. associate-*r*60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      9. *-commutative60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      10. associate-/l*60.2%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      11. associate-*l/65.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified65.9%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if -1.999999999999994e-310 < d < 6.8e-239

    1. Initial program 33.4%

      \[\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) \]
    2. Taylor expanded in d around 0 49.2%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    3. Step-by-step derivation
      1. associate-/l*44.3%

        \[\leadsto -0.125 \cdot \left(\color{blue}{\frac{{D}^{2}}{\frac{d}{{M}^{2}}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      2. unpow244.3%

        \[\leadsto -0.125 \cdot \left(\frac{\color{blue}{D \cdot D}}{\frac{d}{{M}^{2}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      3. unpow244.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
    4. Simplified44.3%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    5. Step-by-step derivation
      1. sqrt-div44.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \color{blue}{\frac{\sqrt{h}}{\sqrt{{\ell}^{3}}}}\right) \]
    6. Applied egg-rr44.3%

      \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \color{blue}{\frac{\sqrt{h}}{\sqrt{{\ell}^{3}}}}\right) \]
    7. Step-by-step derivation
      1. sqr-pow44.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\sqrt{\color{blue}{{\ell}^{\left(\frac{3}{2}\right)} \cdot {\ell}^{\left(\frac{3}{2}\right)}}}}\right) \]
      2. rem-sqrt-square54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\color{blue}{\left|{\ell}^{\left(\frac{3}{2}\right)}\right|}}\right) \]
      3. sqr-pow54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\left|\color{blue}{{\ell}^{\left(\frac{\frac{3}{2}}{2}\right)} \cdot {\ell}^{\left(\frac{\frac{3}{2}}{2}\right)}}\right|}\right) \]
      4. fabs-sqr54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\color{blue}{{\ell}^{\left(\frac{\frac{3}{2}}{2}\right)} \cdot {\ell}^{\left(\frac{\frac{3}{2}}{2}\right)}}}\right) \]
      5. sqr-pow54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\color{blue}{{\ell}^{\left(\frac{3}{2}\right)}}}\right) \]
      6. metadata-eval54.3%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{\color{blue}{1.5}}}\right) \]
    8. Simplified54.3%

      \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \color{blue}{\frac{\sqrt{h}}{{\ell}^{1.5}}}\right) \]

    if 6.8e-239 < d < 1.99999999999999984e134

    1. Initial program 73.6%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval73.6%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/273.6%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/273.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified73.7%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr73.7%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. *-commutative73.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      3. clear-num73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      4. *-commutative73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} \cdot \frac{h}{\ell}\right) \]
      5. metadata-eval73.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. associate-*r/76.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      7. metadata-eval76.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      8. times-frac76.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    7. Applied egg-rr76.3%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    8. Step-by-step derivation
      1. frac-times76.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
      2. associate-/r*76.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{\frac{M \cdot D}{2}}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    9. Applied egg-rr76.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{\frac{M \cdot D}{2}}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]

    if 1.99999999999999984e134 < d

    1. Initial program 66.3%

      \[\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) \]
    2. Taylor expanded in d around inf 79.7%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative79.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative79.7%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*79.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified79.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div90.7%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow90.7%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr90.7%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow90.7%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square90.7%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval90.7%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow90.8%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr90.8%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow90.7%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified90.7%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification79.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -8 \cdot 10^{+113}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -3.5 \cdot 10^{-56}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{2 \cdot d}{D \cdot M}}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\\ \mathbf{elif}\;d \leq -5.1 \cdot 10^{-238}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;d \leq 6.8 \cdot 10^{-239}:\\ \;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\ \mathbf{elif}\;d \leq 2 \cdot 10^{+134}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{\frac{D \cdot M}{2}}{d}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 8: 74.5% accurate, 1.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ t_1 := M \cdot \frac{D}{d}\\ \mathbf{if}\;d \leq -1.15 \cdot 10^{+115}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq -3.5 \cdot 10^{-56}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{2 \cdot d}{D \cdot M}}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\\ \mathbf{elif}\;d \leq -5.9 \cdot 10^{-238}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 4.6 \cdot 10^{-303}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \left(t_1 \cdot t_1\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0
         (*
          (* d (sqrt (/ 1.0 (* h l))))
          (- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0))))))
        (t_1 (* M (/ D d))))
   (if (<= d -1.15e+115)
     t_0
     (if (<= d -3.5e-56)
       (*
        (* (sqrt (/ d h)) (sqrt (/ d l)))
        (- 1.0 (* (pow (/ 1.0 (/ (* 2.0 d) (* D M))) 2.0) (* (/ h l) 0.5))))
       (if (<= d -5.9e-238)
         t_0
         (if (<= d 4.6e-303)
           (* (sqrt (/ h (pow l 3.0))) (* 0.125 (* M (/ (* D M) (/ d D)))))
           (*
            (* (/ (sqrt d) (sqrt h)) (pow (/ d l) 0.5))
            (- 1.0 (* 0.125 (* (/ h l) (* t_1 t_1)))))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
	double t_1 = M * (D / d);
	double tmp;
	if (d <= -1.15e+115) {
		tmp = t_0;
	} else if (d <= -3.5e-56) {
		tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)));
	} else if (d <= -5.9e-238) {
		tmp = t_0;
	} else if (d <= 4.6e-303) {
		tmp = sqrt((h / pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	} else {
		tmp = ((sqrt(d) / sqrt(h)) * pow((d / l), 0.5)) * (1.0 - (0.125 * ((h / l) * (t_1 * t_1))));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
    t_1 = m * (d_1 / d)
    if (d <= (-1.15d+115)) then
        tmp = t_0
    else if (d <= (-3.5d-56)) then
        tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (((1.0d0 / ((2.0d0 * d) / (d_1 * m))) ** 2.0d0) * ((h / l) * 0.5d0)))
    else if (d <= (-5.9d-238)) then
        tmp = t_0
    else if (d <= 4.6d-303) then
        tmp = sqrt((h / (l ** 3.0d0))) * (0.125d0 * (m * ((d_1 * m) / (d / d_1))))
    else
        tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ** 0.5d0)) * (1.0d0 - (0.125d0 * ((h / l) * (t_1 * t_1))))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
	double t_1 = M * (D / d);
	double tmp;
	if (d <= -1.15e+115) {
		tmp = t_0;
	} else if (d <= -3.5e-56) {
		tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (Math.pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)));
	} else if (d <= -5.9e-238) {
		tmp = t_0;
	} else if (d <= 4.6e-303) {
		tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	} else {
		tmp = ((Math.sqrt(d) / Math.sqrt(h)) * Math.pow((d / l), 0.5)) * (1.0 - (0.125 * ((h / l) * (t_1 * t_1))));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0))))
	t_1 = M * (D / d)
	tmp = 0
	if d <= -1.15e+115:
		tmp = t_0
	elif d <= -3.5e-56:
		tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (math.pow((1.0 / ((2.0 * d) / (D * M))), 2.0) * ((h / l) * 0.5)))
	elif d <= -5.9e-238:
		tmp = t_0
	elif d <= 4.6e-303:
		tmp = math.sqrt((h / math.pow(l, 3.0))) * (0.125 * (M * ((D * M) / (d / D))))
	else:
		tmp = ((math.sqrt(d) / math.sqrt(h)) * math.pow((d / l), 0.5)) * (1.0 - (0.125 * ((h / l) * (t_1 * t_1))))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0)))))
	t_1 = Float64(M * Float64(D / d))
	tmp = 0.0
	if (d <= -1.15e+115)
		tmp = t_0;
	elseif (d <= -3.5e-56)
		tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64((Float64(1.0 / Float64(Float64(2.0 * d) / Float64(D * M))) ^ 2.0) * Float64(Float64(h / l) * 0.5))));
	elseif (d <= -5.9e-238)
		tmp = t_0;
	elseif (d <= 4.6e-303)
		tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(0.125 * Float64(M * Float64(Float64(D * M) / Float64(d / D)))));
	else
		tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(0.125 * Float64(Float64(h / l) * Float64(t_1 * t_1)))));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
	t_1 = M * (D / d);
	tmp = 0.0;
	if (d <= -1.15e+115)
		tmp = t_0;
	elseif (d <= -3.5e-56)
		tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (((1.0 / ((2.0 * d) / (D * M))) ^ 2.0) * ((h / l) * 0.5)));
	elseif (d <= -5.9e-238)
		tmp = t_0;
	elseif (d <= 4.6e-303)
		tmp = sqrt((h / (l ^ 3.0))) * (0.125 * (M * ((D * M) / (d / D))));
	else
		tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ^ 0.5)) * (1.0 - (0.125 * ((h / l) * (t_1 * t_1))));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.15e+115], t$95$0, If[LessEqual[d, -3.5e-56], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[Power[N[(1.0 / N[(N[(2.0 * d), $MachinePrecision] / N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.9e-238], t$95$0, If[LessEqual[d, 4.6e-303], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(h / l), $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
t_1 := M \cdot \frac{D}{d}\\
\mathbf{if}\;d \leq -1.15 \cdot 10^{+115}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;d \leq -3.5 \cdot 10^{-56}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{2 \cdot d}{D \cdot M}}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\\

\mathbf{elif}\;d \leq -5.9 \cdot 10^{-238}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;d \leq 4.6 \cdot 10^{-303}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \left(t_1 \cdot t_1\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -1.15000000000000002e115 or -3.4999999999999998e-56 < d < -5.8999999999999998e-238

    1. Initial program 67.6%

      \[\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) \]
    2. Applied egg-rr22.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def27.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p56.4%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified56.4%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]

    if -1.15000000000000002e115 < d < -3.4999999999999998e-56

    1. Initial program 91.6%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval91.6%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/291.6%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/291.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified91.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative91.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr91.6%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]

    if -5.8999999999999998e-238 < d < 4.59999999999999991e-303

    1. Initial program 28.2%

      \[\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) \]
    2. Applied egg-rr5.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def5.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p22.7%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified22.7%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 33.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg33.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in33.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative33.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified33.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around inf 61.9%

      \[\leadsto \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. *-commutative61.9%

        \[\leadsto 0.125 \cdot \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      2. unpow261.9%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      3. unpow261.9%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      4. associate-*l/56.4%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      5. *-commutative56.4%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right) \cdot 0.125} \]
      6. associate-*l*56.4%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right) \cdot 0.125\right)} \]
      7. *-commutative56.4%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(0.125 \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right)} \]
      8. associate-*r*57.2%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      9. *-commutative57.2%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      10. associate-/l*57.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      11. associate-*l/62.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified62.5%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if 4.59999999999999991e-303 < d

    1. Initial program 66.0%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval66.0%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. pow1/266.0%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. sqrt-div78.6%

        \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \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) \]
    3. Applied egg-rr78.6%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \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) \]
    4. Taylor expanded in M around 0 44.8%

      \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}}\right) \]
    5. Step-by-step derivation
      1. associate-*r/38.0%

        \[\leadsto \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 - \color{blue}{\frac{0.125 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}\right) \]
      2. *-commutative38.0%

        \[\leadsto \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 - \frac{0.125 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}}\right) \]
      3. associate-*r/38.0%

        \[\leadsto \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 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\right) \]
      4. associate-*r*41.9%

        \[\leadsto \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 - 0.125 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell}\right) \]
      5. *-commutative41.9%

        \[\leadsto \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 - 0.125 \cdot \frac{\color{blue}{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}}{{d}^{2} \cdot \ell}\right) \]
      6. *-commutative41.9%

        \[\leadsto \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 - 0.125 \cdot \frac{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}{\color{blue}{\ell \cdot {d}^{2}}}\right) \]
      7. times-frac42.7%

        \[\leadsto \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 - 0.125 \cdot \color{blue}{\left(\frac{h}{\ell} \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}}\right)}\right) \]
      8. *-commutative42.7%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \frac{\color{blue}{{M}^{2} \cdot {D}^{2}}}{{d}^{2}}\right)\right) \]
      9. unpow242.7%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot {D}^{2}}{{d}^{2}}\right)\right) \]
      10. unpow242.7%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot \color{blue}{\left(D \cdot D\right)}}{{d}^{2}}\right)\right) \]
      11. unswap-sqr57.2%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}}{{d}^{2}}\right)\right) \]
      12. unpow257.2%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\color{blue}{d \cdot d}}\right)\right) \]
      13. times-frac66.0%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \color{blue}{\left(\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}\right)}\right)\right) \]
      14. associate-*r/65.2%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \left(\color{blue}{\left(M \cdot \frac{D}{d}\right)} \cdot \frac{M \cdot D}{d}\right)\right)\right) \]
      15. associate-*r/66.0%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \color{blue}{\left(M \cdot \frac{D}{d}\right)}\right)\right)\right) \]
    6. Simplified78.7%

      \[\leadsto \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{0.125 \cdot \left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right)}\right) \]
  3. Recombined 4 regimes into one program.
  4. Final simplification80.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.15 \cdot 10^{+115}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -3.5 \cdot 10^{-56}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{2 \cdot d}{D \cdot M}}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\\ \mathbf{elif}\;d \leq -5.9 \cdot 10^{-238}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq 4.6 \cdot 10^{-303}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right)\right)\\ \end{array} \]

Alternative 9: 70.4% accurate, 1.4× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\ t_1 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ t_2 := M \cdot \frac{D}{d}\\ t_3 := \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_2 \cdot t_2\right)\right) \cdot 0.25\right)\right)\right)\\ t_4 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\ \mathbf{if}\;d \leq -3.35 \cdot 10^{+112}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq -4.1 \cdot 10^{-56}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;d \leq -5.6 \cdot 10^{-238}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;t_0 \cdot \left(0.125 \cdot t_4\right)\\ \mathbf{elif}\;d \leq 7.8 \cdot 10^{-113}:\\ \;\;\;\;t_0 \cdot \left(t_4 \cdot -0.125\right)\\ \mathbf{elif}\;d \leq 1.28 \cdot 10^{+134}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ h (pow l 3.0))))
        (t_1
         (*
          (* d (sqrt (/ 1.0 (* h l))))
          (- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0))))))
        (t_2 (* M (/ D d)))
        (t_3
         (*
          (sqrt (/ d h))
          (* (sqrt (/ d l)) (- 1.0 (* 0.5 (* (* (/ h l) (* t_2 t_2)) 0.25))))))
        (t_4 (* M (/ (* D M) (/ d D)))))
   (if (<= d -3.35e+112)
     t_1
     (if (<= d -4.1e-56)
       t_3
       (if (<= d -5.6e-238)
         t_1
         (if (<= d -2e-310)
           (* t_0 (* 0.125 t_4))
           (if (<= d 7.8e-113)
             (* t_0 (* t_4 -0.125))
             (if (<= d 1.28e+134) t_3 (* d (/ (pow h -0.5) (sqrt l)))))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((h / pow(l, 3.0)));
	double t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
	double t_2 = M * (D / d);
	double t_3 = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (((h / l) * (t_2 * t_2)) * 0.25))));
	double t_4 = M * ((D * M) / (d / D));
	double tmp;
	if (d <= -3.35e+112) {
		tmp = t_1;
	} else if (d <= -4.1e-56) {
		tmp = t_3;
	} else if (d <= -5.6e-238) {
		tmp = t_1;
	} else if (d <= -2e-310) {
		tmp = t_0 * (0.125 * t_4);
	} else if (d <= 7.8e-113) {
		tmp = t_0 * (t_4 * -0.125);
	} else if (d <= 1.28e+134) {
		tmp = t_3;
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_0 = sqrt((h / (l ** 3.0d0)))
    t_1 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
    t_2 = m * (d_1 / d)
    t_3 = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * (((h / l) * (t_2 * t_2)) * 0.25d0))))
    t_4 = m * ((d_1 * m) / (d / d_1))
    if (d <= (-3.35d+112)) then
        tmp = t_1
    else if (d <= (-4.1d-56)) then
        tmp = t_3
    else if (d <= (-5.6d-238)) then
        tmp = t_1
    else if (d <= (-2d-310)) then
        tmp = t_0 * (0.125d0 * t_4)
    else if (d <= 7.8d-113) then
        tmp = t_0 * (t_4 * (-0.125d0))
    else if (d <= 1.28d+134) then
        tmp = t_3
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((h / Math.pow(l, 3.0)));
	double t_1 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
	double t_2 = M * (D / d);
	double t_3 = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (((h / l) * (t_2 * t_2)) * 0.25))));
	double t_4 = M * ((D * M) / (d / D));
	double tmp;
	if (d <= -3.35e+112) {
		tmp = t_1;
	} else if (d <= -4.1e-56) {
		tmp = t_3;
	} else if (d <= -5.6e-238) {
		tmp = t_1;
	} else if (d <= -2e-310) {
		tmp = t_0 * (0.125 * t_4);
	} else if (d <= 7.8e-113) {
		tmp = t_0 * (t_4 * -0.125);
	} else if (d <= 1.28e+134) {
		tmp = t_3;
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((h / math.pow(l, 3.0)))
	t_1 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0))))
	t_2 = M * (D / d)
	t_3 = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (((h / l) * (t_2 * t_2)) * 0.25))))
	t_4 = M * ((D * M) / (d / D))
	tmp = 0
	if d <= -3.35e+112:
		tmp = t_1
	elif d <= -4.1e-56:
		tmp = t_3
	elif d <= -5.6e-238:
		tmp = t_1
	elif d <= -2e-310:
		tmp = t_0 * (0.125 * t_4)
	elif d <= 7.8e-113:
		tmp = t_0 * (t_4 * -0.125)
	elif d <= 1.28e+134:
		tmp = t_3
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(h / (l ^ 3.0)))
	t_1 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0)))))
	t_2 = Float64(M * Float64(D / d))
	t_3 = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(Float64(h / l) * Float64(t_2 * t_2)) * 0.25)))))
	t_4 = Float64(M * Float64(Float64(D * M) / Float64(d / D)))
	tmp = 0.0
	if (d <= -3.35e+112)
		tmp = t_1;
	elseif (d <= -4.1e-56)
		tmp = t_3;
	elseif (d <= -5.6e-238)
		tmp = t_1;
	elseif (d <= -2e-310)
		tmp = Float64(t_0 * Float64(0.125 * t_4));
	elseif (d <= 7.8e-113)
		tmp = Float64(t_0 * Float64(t_4 * -0.125));
	elseif (d <= 1.28e+134)
		tmp = t_3;
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((h / (l ^ 3.0)));
	t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
	t_2 = M * (D / d);
	t_3 = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (((h / l) * (t_2 * t_2)) * 0.25))));
	t_4 = M * ((D * M) / (d / D));
	tmp = 0.0;
	if (d <= -3.35e+112)
		tmp = t_1;
	elseif (d <= -4.1e-56)
		tmp = t_3;
	elseif (d <= -5.6e-238)
		tmp = t_1;
	elseif (d <= -2e-310)
		tmp = t_0 * (0.125 * t_4);
	elseif (d <= 7.8e-113)
		tmp = t_0 * (t_4 * -0.125);
	elseif (d <= 1.28e+134)
		tmp = t_3;
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(N[(h / l), $MachinePrecision] * N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.35e+112], t$95$1, If[LessEqual[d, -4.1e-56], t$95$3, If[LessEqual[d, -5.6e-238], t$95$1, If[LessEqual[d, -2e-310], N[(t$95$0 * N[(0.125 * t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.8e-113], N[(t$95$0 * N[(t$95$4 * -0.125), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.28e+134], t$95$3, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
t_2 := M \cdot \frac{D}{d}\\
t_3 := \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(t_2 \cdot t_2\right)\right) \cdot 0.25\right)\right)\right)\\
t_4 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -3.35 \cdot 10^{+112}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;d \leq -4.1 \cdot 10^{-56}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;d \leq -5.6 \cdot 10^{-238}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(0.125 \cdot t_4\right)\\

\mathbf{elif}\;d \leq 7.8 \cdot 10^{-113}:\\
\;\;\;\;t_0 \cdot \left(t_4 \cdot -0.125\right)\\

\mathbf{elif}\;d \leq 1.28 \cdot 10^{+134}:\\
\;\;\;\;t_3\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -3.3499999999999999e112 or -4.1000000000000001e-56 < d < -5.60000000000000008e-238

    1. Initial program 67.6%

      \[\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) \]
    2. Applied egg-rr22.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def27.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p56.4%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified56.4%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]

    if -3.3499999999999999e112 < d < -4.1000000000000001e-56 or 7.7999999999999997e-113 < d < 1.27999999999999999e134

    1. Initial program 87.6%

      \[\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) \]
    2. Step-by-step derivation
      1. associate-*l*87.6%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right)} \]
      2. metadata-eval87.6%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right) \]
      3. unpow1/287.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right) \]
      4. metadata-eval87.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      5. unpow1/287.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      6. associate-*l*87.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{1}{2} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      7. metadata-eval87.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.5} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      8. times-frac87.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    3. Simplified87.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
    4. Taylor expanded in M around 0 65.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}\right)}\right)\right) \]
    5. Step-by-step derivation
      1. associate-*r/65.4%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}\right)\right) \]
      2. *-commutative65.4%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}}\right)\right) \]
      3. associate-*r/65.4%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)}\right)\right) \]
      4. *-commutative65.4%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.25\right)}\right)\right) \]
      5. associate-*r*65.4%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.25\right)\right)\right) \]
      6. *-commutative65.4%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{\color{blue}{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}}{{d}^{2} \cdot \ell} \cdot 0.25\right)\right)\right) \]
      7. *-commutative65.4%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}{\color{blue}{\ell \cdot {d}^{2}}} \cdot 0.25\right)\right)\right) \]
      8. times-frac68.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\color{blue}{\left(\frac{h}{\ell} \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}}\right)} \cdot 0.25\right)\right)\right) \]
      9. *-commutative68.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{{M}^{2} \cdot {D}^{2}}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      10. unpow268.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot {D}^{2}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      11. unpow268.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot \color{blue}{\left(D \cdot D\right)}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      12. unswap-sqr85.4%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      13. unpow285.4%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\color{blue}{d \cdot d}}\right) \cdot 0.25\right)\right)\right) \]
      14. times-frac87.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \color{blue}{\left(\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}\right)}\right) \cdot 0.25\right)\right)\right) \]
      15. associate-*r/87.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\color{blue}{\left(M \cdot \frac{D}{d}\right)} \cdot \frac{M \cdot D}{d}\right)\right) \cdot 0.25\right)\right)\right) \]
      16. associate-*r/87.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \color{blue}{\left(M \cdot \frac{D}{d}\right)}\right)\right) \cdot 0.25\right)\right)\right) \]
    6. Simplified87.6%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right) \cdot 0.25\right)}\right)\right) \]

    if -5.60000000000000008e-238 < d < -1.999999999999994e-310

    1. Initial program 29.9%

      \[\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) \]
    2. Applied egg-rr5.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def5.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p24.0%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified24.0%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around inf 65.3%

      \[\leadsto \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. *-commutative65.3%

        \[\leadsto 0.125 \cdot \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      2. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      3. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      4. associate-*l/59.5%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      5. *-commutative59.5%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right) \cdot 0.125} \]
      6. associate-*l*59.5%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right) \cdot 0.125\right)} \]
      7. *-commutative59.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(0.125 \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right)} \]
      8. associate-*r*60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      9. *-commutative60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      10. associate-/l*60.2%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      11. associate-*l/65.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified65.9%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if -1.999999999999994e-310 < d < 7.7999999999999997e-113

    1. Initial program 35.1%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval35.1%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/235.1%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/235.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified35.2%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr35.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. *-commutative35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      3. clear-num35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      4. *-commutative35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} \cdot \frac{h}{\ell}\right) \]
      5. metadata-eval35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. associate-*r/37.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      7. metadata-eval37.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      8. times-frac37.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    7. Applied egg-rr37.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    8. Taylor expanded in d around 0 40.1%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. associate-*r*40.1%

        \[\leadsto \color{blue}{\left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
      2. *-commutative40.1%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      3. unpow240.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      4. unpow240.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      5. associate-*l/39.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      6. associate-*r*42.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      7. *-commutative42.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      8. associate-/l*48.0%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      9. associate-*l/50.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified50.5%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if 1.27999999999999999e134 < d

    1. Initial program 66.3%

      \[\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) \]
    2. Taylor expanded in d around inf 79.7%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative79.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative79.7%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*79.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified79.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div90.7%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow90.7%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr90.7%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow90.7%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square90.7%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval90.7%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow90.8%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr90.8%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow90.7%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified90.7%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification79.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -3.35 \cdot 10^{+112}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -4.1 \cdot 10^{-56}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right) \cdot 0.25\right)\right)\right)\\ \mathbf{elif}\;d \leq -5.6 \cdot 10^{-238}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;d \leq 7.8 \cdot 10^{-113}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right) \cdot -0.125\right)\\ \mathbf{elif}\;d \leq 1.28 \cdot 10^{+134}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right) \cdot 0.25\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 10: 70.5% accurate, 1.4× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\ t_1 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ t_2 := M \cdot \frac{D}{d}\\ t_3 := \frac{h}{\ell} \cdot \left(t_2 \cdot t_2\right)\\ t_4 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\ \mathbf{if}\;d \leq -4.9 \cdot 10^{+115}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq -3.6 \cdot 10^{-56}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(t_3 \cdot 0.25\right)\right)\right)\\ \mathbf{elif}\;d \leq -4.5 \cdot 10^{-238}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;t_0 \cdot \left(0.125 \cdot t_4\right)\\ \mathbf{elif}\;d \leq 7.2 \cdot 10^{-113}:\\ \;\;\;\;t_0 \cdot \left(t_4 \cdot -0.125\right)\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{+133}:\\ \;\;\;\;\left(1 - 0.125 \cdot t_3\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{0.5} \cdot {\left(\frac{d}{h}\right)}^{0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ h (pow l 3.0))))
        (t_1
         (*
          (* d (sqrt (/ 1.0 (* h l))))
          (- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0))))))
        (t_2 (* M (/ D d)))
        (t_3 (* (/ h l) (* t_2 t_2)))
        (t_4 (* M (/ (* D M) (/ d D)))))
   (if (<= d -4.9e+115)
     t_1
     (if (<= d -3.6e-56)
       (* (sqrt (/ d h)) (* (sqrt (/ d l)) (- 1.0 (* 0.5 (* t_3 0.25)))))
       (if (<= d -4.5e-238)
         t_1
         (if (<= d -2e-310)
           (* t_0 (* 0.125 t_4))
           (if (<= d 7.2e-113)
             (* t_0 (* t_4 -0.125))
             (if (<= d 2.6e+133)
               (*
                (- 1.0 (* 0.125 t_3))
                (* (pow (/ d l) 0.5) (pow (/ d h) 0.5)))
               (* d (/ (pow h -0.5) (sqrt l)))))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((h / pow(l, 3.0)));
	double t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
	double t_2 = M * (D / d);
	double t_3 = (h / l) * (t_2 * t_2);
	double t_4 = M * ((D * M) / (d / D));
	double tmp;
	if (d <= -4.9e+115) {
		tmp = t_1;
	} else if (d <= -3.6e-56) {
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (t_3 * 0.25))));
	} else if (d <= -4.5e-238) {
		tmp = t_1;
	} else if (d <= -2e-310) {
		tmp = t_0 * (0.125 * t_4);
	} else if (d <= 7.2e-113) {
		tmp = t_0 * (t_4 * -0.125);
	} else if (d <= 2.6e+133) {
		tmp = (1.0 - (0.125 * t_3)) * (pow((d / l), 0.5) * pow((d / h), 0.5));
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_0 = sqrt((h / (l ** 3.0d0)))
    t_1 = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
    t_2 = m * (d_1 / d)
    t_3 = (h / l) * (t_2 * t_2)
    t_4 = m * ((d_1 * m) / (d / d_1))
    if (d <= (-4.9d+115)) then
        tmp = t_1
    else if (d <= (-3.6d-56)) then
        tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * (t_3 * 0.25d0))))
    else if (d <= (-4.5d-238)) then
        tmp = t_1
    else if (d <= (-2d-310)) then
        tmp = t_0 * (0.125d0 * t_4)
    else if (d <= 7.2d-113) then
        tmp = t_0 * (t_4 * (-0.125d0))
    else if (d <= 2.6d+133) then
        tmp = (1.0d0 - (0.125d0 * t_3)) * (((d / l) ** 0.5d0) * ((d / h) ** 0.5d0))
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((h / Math.pow(l, 3.0)));
	double t_1 = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
	double t_2 = M * (D / d);
	double t_3 = (h / l) * (t_2 * t_2);
	double t_4 = M * ((D * M) / (d / D));
	double tmp;
	if (d <= -4.9e+115) {
		tmp = t_1;
	} else if (d <= -3.6e-56) {
		tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (t_3 * 0.25))));
	} else if (d <= -4.5e-238) {
		tmp = t_1;
	} else if (d <= -2e-310) {
		tmp = t_0 * (0.125 * t_4);
	} else if (d <= 7.2e-113) {
		tmp = t_0 * (t_4 * -0.125);
	} else if (d <= 2.6e+133) {
		tmp = (1.0 - (0.125 * t_3)) * (Math.pow((d / l), 0.5) * Math.pow((d / h), 0.5));
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((h / math.pow(l, 3.0)))
	t_1 = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0))))
	t_2 = M * (D / d)
	t_3 = (h / l) * (t_2 * t_2)
	t_4 = M * ((D * M) / (d / D))
	tmp = 0
	if d <= -4.9e+115:
		tmp = t_1
	elif d <= -3.6e-56:
		tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (t_3 * 0.25))))
	elif d <= -4.5e-238:
		tmp = t_1
	elif d <= -2e-310:
		tmp = t_0 * (0.125 * t_4)
	elif d <= 7.2e-113:
		tmp = t_0 * (t_4 * -0.125)
	elif d <= 2.6e+133:
		tmp = (1.0 - (0.125 * t_3)) * (math.pow((d / l), 0.5) * math.pow((d / h), 0.5))
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(h / (l ^ 3.0)))
	t_1 = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0)))))
	t_2 = Float64(M * Float64(D / d))
	t_3 = Float64(Float64(h / l) * Float64(t_2 * t_2))
	t_4 = Float64(M * Float64(Float64(D * M) / Float64(d / D)))
	tmp = 0.0
	if (d <= -4.9e+115)
		tmp = t_1;
	elseif (d <= -3.6e-56)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(t_3 * 0.25)))));
	elseif (d <= -4.5e-238)
		tmp = t_1;
	elseif (d <= -2e-310)
		tmp = Float64(t_0 * Float64(0.125 * t_4));
	elseif (d <= 7.2e-113)
		tmp = Float64(t_0 * Float64(t_4 * -0.125));
	elseif (d <= 2.6e+133)
		tmp = Float64(Float64(1.0 - Float64(0.125 * t_3)) * Float64((Float64(d / l) ^ 0.5) * (Float64(d / h) ^ 0.5)));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((h / (l ^ 3.0)));
	t_1 = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
	t_2 = M * (D / d);
	t_3 = (h / l) * (t_2 * t_2);
	t_4 = M * ((D * M) / (d / D));
	tmp = 0.0;
	if (d <= -4.9e+115)
		tmp = t_1;
	elseif (d <= -3.6e-56)
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (t_3 * 0.25))));
	elseif (d <= -4.5e-238)
		tmp = t_1;
	elseif (d <= -2e-310)
		tmp = t_0 * (0.125 * t_4);
	elseif (d <= 7.2e-113)
		tmp = t_0 * (t_4 * -0.125);
	elseif (d <= 2.6e+133)
		tmp = (1.0 - (0.125 * t_3)) * (((d / l) ^ 0.5) * ((d / h) ^ 0.5));
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(h / l), $MachinePrecision] * N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.9e+115], t$95$1, If[LessEqual[d, -3.6e-56], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(t$95$3 * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.5e-238], t$95$1, If[LessEqual[d, -2e-310], N[(t$95$0 * N[(0.125 * t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.2e-113], N[(t$95$0 * N[(t$95$4 * -0.125), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.6e+133], N[(N[(1.0 - N[(0.125 * t$95$3), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\
t_2 := M \cdot \frac{D}{d}\\
t_3 := \frac{h}{\ell} \cdot \left(t_2 \cdot t_2\right)\\
t_4 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -4.9 \cdot 10^{+115}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;d \leq -3.6 \cdot 10^{-56}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(t_3 \cdot 0.25\right)\right)\right)\\

\mathbf{elif}\;d \leq -4.5 \cdot 10^{-238}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(0.125 \cdot t_4\right)\\

\mathbf{elif}\;d \leq 7.2 \cdot 10^{-113}:\\
\;\;\;\;t_0 \cdot \left(t_4 \cdot -0.125\right)\\

\mathbf{elif}\;d \leq 2.6 \cdot 10^{+133}:\\
\;\;\;\;\left(1 - 0.125 \cdot t_3\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{0.5} \cdot {\left(\frac{d}{h}\right)}^{0.5}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if d < -4.89999999999999964e115 or -3.59999999999999978e-56 < d < -4.49999999999999996e-238

    1. Initial program 67.6%

      \[\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) \]
    2. Applied egg-rr22.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def27.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p56.4%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified56.4%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative81.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified81.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]

    if -4.89999999999999964e115 < d < -3.59999999999999978e-56

    1. Initial program 91.6%

      \[\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) \]
    2. Step-by-step derivation
      1. associate-*l*91.6%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right)} \]
      2. metadata-eval91.6%

        \[\leadsto {\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right) \]
      3. unpow1/291.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\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)\right) \]
      4. metadata-eval91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      5. unpow1/291.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right) \]
      6. associate-*l*91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{1}{2} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      7. metadata-eval91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \color{blue}{0.5} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
      8. times-frac91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
    3. Simplified91.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} \]
    4. Taylor expanded in M around 0 80.1%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}\right)}\right)\right) \]
    5. Step-by-step derivation
      1. associate-*r/80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}\right)\right) \]
      2. *-commutative80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}}\right)\right) \]
      3. associate-*r/80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)}\right)\right) \]
      4. *-commutative80.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.25\right)}\right)\right) \]
      5. associate-*r*77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.25\right)\right)\right) \]
      6. *-commutative77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{\color{blue}{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}}{{d}^{2} \cdot \ell} \cdot 0.25\right)\right)\right) \]
      7. *-commutative77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}{\color{blue}{\ell \cdot {d}^{2}}} \cdot 0.25\right)\right)\right) \]
      8. times-frac80.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\color{blue}{\left(\frac{h}{\ell} \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}}\right)} \cdot 0.25\right)\right)\right) \]
      9. *-commutative80.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{{M}^{2} \cdot {D}^{2}}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      10. unpow280.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot {D}^{2}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      11. unpow280.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot \color{blue}{\left(D \cdot D\right)}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      12. unswap-sqr88.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}}{{d}^{2}}\right) \cdot 0.25\right)\right)\right) \]
      13. unpow288.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\color{blue}{d \cdot d}}\right) \cdot 0.25\right)\right)\right) \]
      14. times-frac91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \color{blue}{\left(\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}\right)}\right) \cdot 0.25\right)\right)\right) \]
      15. associate-*r/91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\color{blue}{\left(M \cdot \frac{D}{d}\right)} \cdot \frac{M \cdot D}{d}\right)\right) \cdot 0.25\right)\right)\right) \]
      16. associate-*r/91.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \color{blue}{\left(M \cdot \frac{D}{d}\right)}\right)\right) \cdot 0.25\right)\right)\right) \]
    6. Simplified91.6%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right) \cdot 0.25\right)}\right)\right) \]

    if -4.49999999999999996e-238 < d < -1.999999999999994e-310

    1. Initial program 29.9%

      \[\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) \]
    2. Applied egg-rr5.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def5.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p24.0%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified24.0%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around inf 65.3%

      \[\leadsto \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. *-commutative65.3%

        \[\leadsto 0.125 \cdot \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      2. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      3. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      4. associate-*l/59.5%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      5. *-commutative59.5%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right) \cdot 0.125} \]
      6. associate-*l*59.5%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right) \cdot 0.125\right)} \]
      7. *-commutative59.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(0.125 \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right)} \]
      8. associate-*r*60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      9. *-commutative60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      10. associate-/l*60.2%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      11. associate-*l/65.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified65.9%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if -1.999999999999994e-310 < d < 7.1999999999999995e-113

    1. Initial program 35.1%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval35.1%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/235.1%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/235.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified35.2%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr35.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. *-commutative35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      3. clear-num35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      4. *-commutative35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} \cdot \frac{h}{\ell}\right) \]
      5. metadata-eval35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. associate-*r/37.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      7. metadata-eval37.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      8. times-frac37.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    7. Applied egg-rr37.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    8. Taylor expanded in d around 0 40.1%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. associate-*r*40.1%

        \[\leadsto \color{blue}{\left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
      2. *-commutative40.1%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      3. unpow240.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      4. unpow240.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      5. associate-*l/39.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      6. associate-*r*42.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      7. *-commutative42.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      8. associate-/l*48.0%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      9. associate-*l/50.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified50.5%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if 7.1999999999999995e-113 < d < 2.5999999999999998e133

    1. Initial program 85.2%

      \[\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) \]
    2. Taylor expanded in M around 0 56.4%

      \[\leadsto \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 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}}\right) \]
    3. Step-by-step derivation
      1. associate-*r/56.4%

        \[\leadsto \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 - \color{blue}{\frac{0.125 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}\right) \]
      2. *-commutative56.4%

        \[\leadsto \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 - \frac{0.125 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}}\right) \]
      3. associate-*r/56.4%

        \[\leadsto \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 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\right) \]
      4. associate-*r*58.2%

        \[\leadsto \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 - 0.125 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell}\right) \]
      5. *-commutative58.2%

        \[\leadsto \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 - 0.125 \cdot \frac{\color{blue}{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}}{{d}^{2} \cdot \ell}\right) \]
      6. *-commutative58.2%

        \[\leadsto \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 - 0.125 \cdot \frac{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}{\color{blue}{\ell \cdot {d}^{2}}}\right) \]
      7. times-frac61.7%

        \[\leadsto \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 - 0.125 \cdot \color{blue}{\left(\frac{h}{\ell} \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}}\right)}\right) \]
      8. *-commutative61.7%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \frac{\color{blue}{{M}^{2} \cdot {D}^{2}}}{{d}^{2}}\right)\right) \]
      9. unpow261.7%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot {D}^{2}}{{d}^{2}}\right)\right) \]
      10. unpow261.7%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot \color{blue}{\left(D \cdot D\right)}}{{d}^{2}}\right)\right) \]
      11. unswap-sqr83.5%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \frac{\color{blue}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}}{{d}^{2}}\right)\right) \]
      12. unpow283.5%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\color{blue}{d \cdot d}}\right)\right) \]
      13. times-frac85.2%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \color{blue}{\left(\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}\right)}\right)\right) \]
      14. associate-*r/85.2%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \left(\color{blue}{\left(M \cdot \frac{D}{d}\right)} \cdot \frac{M \cdot D}{d}\right)\right)\right) \]
      15. associate-*r/85.2%

        \[\leadsto \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 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \color{blue}{\left(M \cdot \frac{D}{d}\right)}\right)\right)\right) \]
    4. Simplified85.2%

      \[\leadsto \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 - \color{blue}{0.125 \cdot \left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right)}\right) \]

    if 2.5999999999999998e133 < d

    1. Initial program 66.3%

      \[\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) \]
    2. Taylor expanded in d around inf 79.7%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative79.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative79.7%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*79.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified79.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div90.7%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow90.7%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr90.7%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow90.7%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square90.7%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval90.7%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow90.8%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr90.8%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow90.7%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified90.7%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification79.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4.9 \cdot 10^{+115}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -3.6 \cdot 10^{-56}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right) \cdot 0.25\right)\right)\right)\\ \mathbf{elif}\;d \leq -4.5 \cdot 10^{-238}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;d \leq 7.2 \cdot 10^{-113}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right) \cdot -0.125\right)\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{+133}:\\ \;\;\;\;\left(1 - 0.125 \cdot \left(\frac{h}{\ell} \cdot \left(\left(M \cdot \frac{D}{d}\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)\right)\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{0.5} \cdot {\left(\frac{d}{h}\right)}^{0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 11: 61.9% accurate, 1.4× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\ t_1 := 0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\\ t_2 := \sqrt{\frac{1}{h \cdot \ell}}\\ t_3 := d \cdot t_2\\ t_4 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\ \mathbf{if}\;d \leq -3.1 \cdot 10^{+233}:\\ \;\;\;\;t_2 \cdot \left(-d\right)\\ \mathbf{elif}\;d \leq -2.3 \cdot 10^{+110}:\\ \;\;\;\;t_3 \cdot \left(-1 - -0.5 \cdot \left(t_1 \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq -8.2 \cdot 10^{-63}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - h \cdot \frac{0.5 \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}{\ell}\right)\\ \mathbf{elif}\;d \leq -1.85 \cdot 10^{-200}:\\ \;\;\;\;t_3 \cdot \left(-1 - -0.5 \cdot \left(t_1 \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;t_0 \cdot \left(0.125 \cdot t_4\right)\\ \mathbf{elif}\;d \leq 1.4 \cdot 10^{-112}:\\ \;\;\;\;t_0 \cdot \left(t_4 \cdot -0.125\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ h (pow l 3.0))))
        (t_1 (* 0.25 (* (/ D d) (/ D d))))
        (t_2 (sqrt (/ 1.0 (* h l))))
        (t_3 (* d t_2))
        (t_4 (* M (/ (* D M) (/ d D)))))
   (if (<= d -3.1e+233)
     (* t_2 (- d))
     (if (<= d -2.3e+110)
       (* t_3 (- -1.0 (* -0.5 (* t_1 (/ (* M (* h M)) l)))))
       (if (<= d -8.2e-63)
         (*
          (sqrt (* (/ d h) (/ d l)))
          (- 1.0 (* h (/ (* 0.5 (pow (* (/ M d) (/ D 2.0)) 2.0)) l))))
         (if (<= d -1.85e-200)
           (* t_3 (- -1.0 (* -0.5 (* t_1 (/ (* M M) (/ l h))))))
           (if (<= d -2e-310)
             (* t_0 (* 0.125 t_4))
             (if (<= d 1.4e-112)
               (* t_0 (* t_4 -0.125))
               (* d (/ (pow h -0.5) (sqrt l)))))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((h / pow(l, 3.0)));
	double t_1 = 0.25 * ((D / d) * (D / d));
	double t_2 = sqrt((1.0 / (h * l)));
	double t_3 = d * t_2;
	double t_4 = M * ((D * M) / (d / D));
	double tmp;
	if (d <= -3.1e+233) {
		tmp = t_2 * -d;
	} else if (d <= -2.3e+110) {
		tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * (h * M)) / l))));
	} else if (d <= -8.2e-63) {
		tmp = sqrt(((d / h) * (d / l))) * (1.0 - (h * ((0.5 * pow(((M / d) * (D / 2.0)), 2.0)) / l)));
	} else if (d <= -1.85e-200) {
		tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * M) / (l / h)))));
	} else if (d <= -2e-310) {
		tmp = t_0 * (0.125 * t_4);
	} else if (d <= 1.4e-112) {
		tmp = t_0 * (t_4 * -0.125);
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_0 = sqrt((h / (l ** 3.0d0)))
    t_1 = 0.25d0 * ((d_1 / d) * (d_1 / d))
    t_2 = sqrt((1.0d0 / (h * l)))
    t_3 = d * t_2
    t_4 = m * ((d_1 * m) / (d / d_1))
    if (d <= (-3.1d+233)) then
        tmp = t_2 * -d
    else if (d <= (-2.3d+110)) then
        tmp = t_3 * ((-1.0d0) - ((-0.5d0) * (t_1 * ((m * (h * m)) / l))))
    else if (d <= (-8.2d-63)) then
        tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (h * ((0.5d0 * (((m / d) * (d_1 / 2.0d0)) ** 2.0d0)) / l)))
    else if (d <= (-1.85d-200)) then
        tmp = t_3 * ((-1.0d0) - ((-0.5d0) * (t_1 * ((m * m) / (l / h)))))
    else if (d <= (-2d-310)) then
        tmp = t_0 * (0.125d0 * t_4)
    else if (d <= 1.4d-112) then
        tmp = t_0 * (t_4 * (-0.125d0))
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((h / Math.pow(l, 3.0)));
	double t_1 = 0.25 * ((D / d) * (D / d));
	double t_2 = Math.sqrt((1.0 / (h * l)));
	double t_3 = d * t_2;
	double t_4 = M * ((D * M) / (d / D));
	double tmp;
	if (d <= -3.1e+233) {
		tmp = t_2 * -d;
	} else if (d <= -2.3e+110) {
		tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * (h * M)) / l))));
	} else if (d <= -8.2e-63) {
		tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (h * ((0.5 * Math.pow(((M / d) * (D / 2.0)), 2.0)) / l)));
	} else if (d <= -1.85e-200) {
		tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * M) / (l / h)))));
	} else if (d <= -2e-310) {
		tmp = t_0 * (0.125 * t_4);
	} else if (d <= 1.4e-112) {
		tmp = t_0 * (t_4 * -0.125);
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((h / math.pow(l, 3.0)))
	t_1 = 0.25 * ((D / d) * (D / d))
	t_2 = math.sqrt((1.0 / (h * l)))
	t_3 = d * t_2
	t_4 = M * ((D * M) / (d / D))
	tmp = 0
	if d <= -3.1e+233:
		tmp = t_2 * -d
	elif d <= -2.3e+110:
		tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * (h * M)) / l))))
	elif d <= -8.2e-63:
		tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (h * ((0.5 * math.pow(((M / d) * (D / 2.0)), 2.0)) / l)))
	elif d <= -1.85e-200:
		tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * M) / (l / h)))))
	elif d <= -2e-310:
		tmp = t_0 * (0.125 * t_4)
	elif d <= 1.4e-112:
		tmp = t_0 * (t_4 * -0.125)
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(h / (l ^ 3.0)))
	t_1 = Float64(0.25 * Float64(Float64(D / d) * Float64(D / d)))
	t_2 = sqrt(Float64(1.0 / Float64(h * l)))
	t_3 = Float64(d * t_2)
	t_4 = Float64(M * Float64(Float64(D * M) / Float64(d / D)))
	tmp = 0.0
	if (d <= -3.1e+233)
		tmp = Float64(t_2 * Float64(-d));
	elseif (d <= -2.3e+110)
		tmp = Float64(t_3 * Float64(-1.0 - Float64(-0.5 * Float64(t_1 * Float64(Float64(M * Float64(h * M)) / l)))));
	elseif (d <= -8.2e-63)
		tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(h * Float64(Float64(0.5 * (Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0)) / l))));
	elseif (d <= -1.85e-200)
		tmp = Float64(t_3 * Float64(-1.0 - Float64(-0.5 * Float64(t_1 * Float64(Float64(M * M) / Float64(l / h))))));
	elseif (d <= -2e-310)
		tmp = Float64(t_0 * Float64(0.125 * t_4));
	elseif (d <= 1.4e-112)
		tmp = Float64(t_0 * Float64(t_4 * -0.125));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((h / (l ^ 3.0)));
	t_1 = 0.25 * ((D / d) * (D / d));
	t_2 = sqrt((1.0 / (h * l)));
	t_3 = d * t_2;
	t_4 = M * ((D * M) / (d / D));
	tmp = 0.0;
	if (d <= -3.1e+233)
		tmp = t_2 * -d;
	elseif (d <= -2.3e+110)
		tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * (h * M)) / l))));
	elseif (d <= -8.2e-63)
		tmp = sqrt(((d / h) * (d / l))) * (1.0 - (h * ((0.5 * (((M / d) * (D / 2.0)) ^ 2.0)) / l)));
	elseif (d <= -1.85e-200)
		tmp = t_3 * (-1.0 - (-0.5 * (t_1 * ((M * M) / (l / h)))));
	elseif (d <= -2e-310)
		tmp = t_0 * (0.125 * t_4);
	elseif (d <= 1.4e-112)
		tmp = t_0 * (t_4 * -0.125);
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(d * t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.1e+233], N[(t$95$2 * (-d)), $MachinePrecision], If[LessEqual[d, -2.3e+110], N[(t$95$3 * N[(-1.0 - N[(-0.5 * N[(t$95$1 * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -8.2e-63], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(h * N[(N[(0.5 * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.85e-200], N[(t$95$3 * N[(-1.0 - N[(-0.5 * N[(t$95$1 * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], N[(t$95$0 * N[(0.125 * t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.4e-112], N[(t$95$0 * N[(t$95$4 * -0.125), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := 0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\\
t_2 := \sqrt{\frac{1}{h \cdot \ell}}\\
t_3 := d \cdot t_2\\
t_4 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -3.1 \cdot 10^{+233}:\\
\;\;\;\;t_2 \cdot \left(-d\right)\\

\mathbf{elif}\;d \leq -2.3 \cdot 10^{+110}:\\
\;\;\;\;t_3 \cdot \left(-1 - -0.5 \cdot \left(t_1 \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\

\mathbf{elif}\;d \leq -8.2 \cdot 10^{-63}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - h \cdot \frac{0.5 \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}{\ell}\right)\\

\mathbf{elif}\;d \leq -1.85 \cdot 10^{-200}:\\
\;\;\;\;t_3 \cdot \left(-1 - -0.5 \cdot \left(t_1 \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\

\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(0.125 \cdot t_4\right)\\

\mathbf{elif}\;d \leq 1.4 \cdot 10^{-112}:\\
\;\;\;\;t_0 \cdot \left(t_4 \cdot -0.125\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 7 regimes
  2. if d < -3.10000000000000016e233

    1. Initial program 66.8%

      \[\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) \]
    2. Applied egg-rr48.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def48.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p66.8%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified66.8%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 88.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified88.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around 0 82.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    9. Step-by-step derivation
      1. associate-/l/82.2%

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}}\right) \]
      2. associate-*r*82.2%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
      3. *-commutative82.2%

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-1 \cdot d\right)} \]
      4. associate-/l/82.3%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \cdot \left(-1 \cdot d\right) \]
      5. *-commutative82.3%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
      6. mul-1-neg82.3%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(-d\right)} \]
    10. Simplified82.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]

    if -3.10000000000000016e233 < d < -2.3e110

    1. Initial program 63.7%

      \[\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) \]
    2. Applied egg-rr18.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def18.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p53.5%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified53.5%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 78.5%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg78.5%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in78.5%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative78.5%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified78.5%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 55.3%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac56.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative56.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*56.2%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow256.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow256.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac84.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*73.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow273.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified73.0%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    11. Taylor expanded in M around 0 84.0%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2} \cdot h}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    12. Step-by-step derivation
      1. unpow284.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. associate-*l*94.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot \left(M \cdot h\right)}}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    13. Simplified94.0%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{M \cdot \left(M \cdot h\right)}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]

    if -2.3e110 < d < -8.1999999999999995e-63

    1. Initial program 89.6%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval89.6%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/289.6%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval89.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/289.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative89.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*89.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac89.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval89.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified89.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times89.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num89.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative89.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr89.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*89.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. *-commutative89.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      3. clear-num89.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      4. *-commutative89.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} \cdot \frac{h}{\ell}\right) \]
      5. metadata-eval89.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. associate-*r/89.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      7. metadata-eval89.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      8. times-frac89.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    7. Applied egg-rr89.6%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    8. Step-by-step derivation
      1. frac-times89.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
      2. associate-/r*89.6%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{\frac{M \cdot D}{2}}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    9. Applied egg-rr89.6%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{\frac{M \cdot D}{2}}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    10. Step-by-step derivation
      1. pow189.6%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2}\right) \cdot h}{\ell}\right)\right)}^{1}} \]
      2. sqrt-unprod76.8%

        \[\leadsto {\left(\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - \frac{\left(0.5 \cdot {\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2}\right) \cdot h}{\ell}\right)\right)}^{1} \]
      3. associate-/l*76.8%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{0.5 \cdot {\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2}}{\frac{\ell}{h}}}\right)\right)}^{1} \]
      4. associate-/l/76.8%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \frac{0.5 \cdot {\color{blue}{\left(\frac{M \cdot D}{d \cdot 2}\right)}}^{2}}{\frac{\ell}{h}}\right)\right)}^{1} \]
    11. Applied egg-rr76.8%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \frac{0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}{\frac{\ell}{h}}\right)\right)}^{1}} \]
    12. Step-by-step derivation
      1. unpow176.8%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \frac{0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}{\frac{\ell}{h}}\right)} \]
      2. associate-/r/76.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \color{blue}{\frac{0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}{\ell} \cdot h}\right) \]
      3. times-frac76.8%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \frac{0.5 \cdot {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2}}{\ell} \cdot h\right) \]
    13. Simplified76.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - \frac{0.5 \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}{\ell} \cdot h\right)} \]

    if -8.1999999999999995e-63 < d < -1.85000000000000005e-200

    1. Initial program 74.3%

      \[\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) \]
    2. Applied egg-rr15.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def23.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p56.0%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified56.0%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 80.9%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg80.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in80.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative80.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified80.9%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 65.0%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac61.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative61.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*61.1%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow261.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow261.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac73.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*77.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow277.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified77.0%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]

    if -1.85000000000000005e-200 < d < -1.999999999999994e-310

    1. Initial program 42.8%

      \[\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) \]
    2. Applied egg-rr7.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def7.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p32.3%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified32.3%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 55.6%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg55.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in55.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative55.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified55.6%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around inf 69.1%

      \[\leadsto \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. *-commutative69.1%

        \[\leadsto 0.125 \cdot \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      2. unpow269.1%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      3. unpow269.1%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      4. associate-*l/62.1%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      5. *-commutative62.1%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right) \cdot 0.125} \]
      6. associate-*l*62.1%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right) \cdot 0.125\right)} \]
      7. *-commutative62.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(0.125 \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right)} \]
      8. associate-*r*63.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      9. *-commutative63.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      10. associate-/l*63.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      11. associate-*l/66.6%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified66.6%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if -1.999999999999994e-310 < d < 1.40000000000000011e-112

    1. Initial program 35.1%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval35.1%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/235.1%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/235.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified35.2%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr35.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. *-commutative35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      3. clear-num35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      4. *-commutative35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} \cdot \frac{h}{\ell}\right) \]
      5. metadata-eval35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. associate-*r/37.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      7. metadata-eval37.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      8. times-frac37.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    7. Applied egg-rr37.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    8. Taylor expanded in d around 0 40.1%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. associate-*r*40.1%

        \[\leadsto \color{blue}{\left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
      2. *-commutative40.1%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      3. unpow240.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      4. unpow240.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      5. associate-*l/39.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      6. associate-*r*42.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      7. *-commutative42.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      8. associate-/l*48.0%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      9. associate-*l/50.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified50.5%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if 1.40000000000000011e-112 < d

    1. Initial program 78.1%

      \[\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) \]
    2. Taylor expanded in d around inf 60.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative60.1%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*60.1%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified60.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div72.4%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow72.4%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr72.4%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow72.5%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square72.5%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval72.5%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow72.3%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr72.3%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow72.5%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified72.5%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 7 regimes into one program.
  4. Final simplification71.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -3.1 \cdot 10^{+233}:\\ \;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\ \mathbf{elif}\;d \leq -2.3 \cdot 10^{+110}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq -8.2 \cdot 10^{-63}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - h \cdot \frac{0.5 \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}{\ell}\right)\\ \mathbf{elif}\;d \leq -1.85 \cdot 10^{-200}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;d \leq 1.4 \cdot 10^{-112}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right) \cdot -0.125\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 12: 62.1% accurate, 1.4× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -9 \cdot 10^{+119}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\ \mathbf{elif}\;\ell \leq -7.8 \cdot 10^{-131}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;\ell \leq 4.8 \cdot 10^{-39}:\\ \;\;\;\;\left(1 + -0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq 6.8 \cdot 10^{+58}:\\ \;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\ \mathbf{elif}\;\ell \leq 4 \cdot 10^{+96}:\\ \;\;\;\;-0.125 \cdot \frac{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(D \cdot \left(D \cdot \left(M \cdot M\right)\right)\right)}{d}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -9e+119)
   (* (sqrt (/ (/ 1.0 l) h)) (- d))
   (if (<= l -7.8e-131)
     (*
      (* d (sqrt (/ 1.0 (* h l))))
      (- -1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M (* h M)) l)))))
     (if (<= l 4.8e-39)
       (*
        (+ 1.0 (* -0.5 (/ (* h (pow (* (/ D d) (/ M 2.0)) 2.0)) l)))
        (sqrt (* (/ d h) (/ d l))))
       (if (<= l 6.8e+58)
         (* d (/ 1.0 (sqrt (* h l))))
         (if (<= l 4e+96)
           (* -0.125 (/ (* (sqrt (/ h (pow l 3.0))) (* D (* D (* M M)))) d))
           (* d (/ (pow h -0.5) (sqrt l)))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -9e+119) {
		tmp = sqrt(((1.0 / l) / h)) * -d;
	} else if (l <= -7.8e-131) {
		tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	} else if (l <= 4.8e-39) {
		tmp = (1.0 + (-0.5 * ((h * pow(((D / d) * (M / 2.0)), 2.0)) / l))) * sqrt(((d / h) * (d / l)));
	} else if (l <= 6.8e+58) {
		tmp = d * (1.0 / sqrt((h * l)));
	} else if (l <= 4e+96) {
		tmp = -0.125 * ((sqrt((h / pow(l, 3.0))) * (D * (D * (M * M)))) / d);
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= (-9d+119)) then
        tmp = sqrt(((1.0d0 / l) / h)) * -d
    else if (l <= (-7.8d-131)) then
        tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * (h * m)) / l))))
    else if (l <= 4.8d-39) then
        tmp = (1.0d0 + ((-0.5d0) * ((h * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0)) / l))) * sqrt(((d / h) * (d / l)))
    else if (l <= 6.8d+58) then
        tmp = d * (1.0d0 / sqrt((h * l)))
    else if (l <= 4d+96) then
        tmp = (-0.125d0) * ((sqrt((h / (l ** 3.0d0))) * (d_1 * (d_1 * (m * m)))) / d)
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -9e+119) {
		tmp = Math.sqrt(((1.0 / l) / h)) * -d;
	} else if (l <= -7.8e-131) {
		tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	} else if (l <= 4.8e-39) {
		tmp = (1.0 + (-0.5 * ((h * Math.pow(((D / d) * (M / 2.0)), 2.0)) / l))) * Math.sqrt(((d / h) * (d / l)));
	} else if (l <= 6.8e+58) {
		tmp = d * (1.0 / Math.sqrt((h * l)));
	} else if (l <= 4e+96) {
		tmp = -0.125 * ((Math.sqrt((h / Math.pow(l, 3.0))) * (D * (D * (M * M)))) / d);
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if l <= -9e+119:
		tmp = math.sqrt(((1.0 / l) / h)) * -d
	elif l <= -7.8e-131:
		tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))))
	elif l <= 4.8e-39:
		tmp = (1.0 + (-0.5 * ((h * math.pow(((D / d) * (M / 2.0)), 2.0)) / l))) * math.sqrt(((d / h) * (d / l)))
	elif l <= 6.8e+58:
		tmp = d * (1.0 / math.sqrt((h * l)))
	elif l <= 4e+96:
		tmp = -0.125 * ((math.sqrt((h / math.pow(l, 3.0))) * (D * (D * (M * M)))) / d)
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -9e+119)
		tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * Float64(-d));
	elseif (l <= -7.8e-131)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * Float64(h * M)) / l)))));
	elseif (l <= 4.8e-39)
		tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)) / l))) * sqrt(Float64(Float64(d / h) * Float64(d / l))));
	elseif (l <= 6.8e+58)
		tmp = Float64(d * Float64(1.0 / sqrt(Float64(h * l))));
	elseif (l <= 4e+96)
		tmp = Float64(-0.125 * Float64(Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(D * Float64(D * Float64(M * M)))) / d));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -9e+119)
		tmp = sqrt(((1.0 / l) / h)) * -d;
	elseif (l <= -7.8e-131)
		tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	elseif (l <= 4.8e-39)
		tmp = (1.0 + (-0.5 * ((h * (((D / d) * (M / 2.0)) ^ 2.0)) / l))) * sqrt(((d / h) * (d / l)));
	elseif (l <= 6.8e+58)
		tmp = d * (1.0 / sqrt((h * l)));
	elseif (l <= 4e+96)
		tmp = -0.125 * ((sqrt((h / (l ^ 3.0))) * (D * (D * (M * M)))) / d);
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -9e+119], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[l, -7.8e-131], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.8e-39], N[(N[(1.0 + N[(-0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.8e+58], N[(d * N[(1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4e+96], N[(-0.125 * N[(N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9 \cdot 10^{+119}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\

\mathbf{elif}\;\ell \leq -7.8 \cdot 10^{-131}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\

\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{-39}:\\
\;\;\;\;\left(1 + -0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\

\mathbf{elif}\;\ell \leq 6.8 \cdot 10^{+58}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\

\mathbf{elif}\;\ell \leq 4 \cdot 10^{+96}:\\
\;\;\;\;-0.125 \cdot \frac{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(D \cdot \left(D \cdot \left(M \cdot M\right)\right)\right)}{d}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if l < -9.00000000000000039e119

    1. Initial program 55.2%

      \[\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) \]
    2. Applied egg-rr28.7%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def46.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p50.5%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified50.5%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 64.0%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg64.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in64.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative64.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified64.0%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 41.7%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac38.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative38.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*38.9%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow238.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow238.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac47.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*47.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow247.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified47.3%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    11. Taylor expanded in D around 0 67.4%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    12. Step-by-step derivation
      1. associate-/l/67.4%

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}}\right) \]
      2. unpow-167.4%

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{\color{blue}{{h}^{-1}}}{\ell}}\right) \]
      3. associate-*r*67.4%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{{h}^{-1}}{\ell}}} \]
      4. *-commutative67.4%

        \[\leadsto \color{blue}{\sqrt{\frac{{h}^{-1}}{\ell}} \cdot \left(-1 \cdot d\right)} \]
      5. mul-1-neg67.4%

        \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot \color{blue}{\left(-d\right)} \]
      6. unpow-167.4%

        \[\leadsto \sqrt{\frac{\color{blue}{\frac{1}{h}}}{\ell}} \cdot \left(-d\right) \]
      7. associate-/l/67.4%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \cdot \left(-d\right) \]
      8. associate-/r*67.4%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot \left(-d\right) \]
    13. Simplified67.4%

      \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)} \]

    if -9.00000000000000039e119 < l < -7.80000000000000039e-131

    1. Initial program 71.0%

      \[\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) \]
    2. Applied egg-rr14.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def21.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p49.5%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified49.5%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 76.9%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg76.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in76.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative76.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified76.9%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 56.5%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac55.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative55.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*55.0%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow255.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow255.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac63.5%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*66.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow266.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified66.8%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    11. Taylor expanded in M around 0 63.5%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2} \cdot h}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    12. Step-by-step derivation
      1. unpow263.5%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. associate-*l*68.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot \left(M \cdot h\right)}}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    13. Simplified68.3%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{M \cdot \left(M \cdot h\right)}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]

    if -7.80000000000000039e-131 < l < 4.80000000000000031e-39

    1. Initial program 76.7%

      \[\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) \]
    2. Applied egg-rr24.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def29.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p68.6%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified68.6%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Step-by-step derivation
      1. associate-*l/72.4%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\frac{h \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}}{\ell}}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \]
      2. associate-*r/72.4%

        \[\leadsto \left(1 + -0.5 \cdot \frac{h \cdot {\color{blue}{\left(\frac{D \cdot M}{2 \cdot d}\right)}}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \]
      3. *-commutative72.4%

        \[\leadsto \left(1 + -0.5 \cdot \frac{h \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \]
      4. times-frac71.2%

        \[\leadsto \left(1 + -0.5 \cdot \frac{h \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \]
    6. Applied egg-rr71.2%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\frac{h \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}}{\ell}}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \]

    if 4.80000000000000031e-39 < l < 6.8000000000000001e58

    1. Initial program 70.5%

      \[\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) \]
    2. Taylor expanded in d around inf 62.6%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. sqrt-div62.8%

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}} \cdot d \]
      2. *-commutative62.8%

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\color{blue}{h \cdot \ell}}} \cdot d \]
      3. metadata-eval62.8%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \cdot d \]
    4. Applied egg-rr62.8%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{h \cdot \ell}}} \cdot d \]

    if 6.8000000000000001e58 < l < 4.0000000000000002e96

    1. Initial program 30.9%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval30.9%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/230.9%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/230.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac31.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval31.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified31.1%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr30.9%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. *-commutative30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      3. clear-num30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      4. *-commutative30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} \cdot \frac{h}{\ell}\right) \]
      5. metadata-eval30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. associate-*r/30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      7. metadata-eval30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      8. times-frac31.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    7. Applied egg-rr31.1%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    8. Step-by-step derivation
      1. frac-times30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
      2. associate-/r*30.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{\frac{M \cdot D}{2}}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    9. Applied egg-rr30.9%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{\frac{M \cdot D}{2}}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    10. Taylor expanded in d around 0 72.0%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    11. Step-by-step derivation
      1. associate-*l/72.2%

        \[\leadsto -0.125 \cdot \color{blue}{\frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d}} \]
      2. unpow272.2%

        \[\leadsto -0.125 \cdot \frac{\left(\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d} \]
      3. unpow272.2%

        \[\leadsto -0.125 \cdot \frac{\left(\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d} \]
      4. associate-*l*72.6%

        \[\leadsto -0.125 \cdot \frac{\color{blue}{\left(D \cdot \left(D \cdot \left(M \cdot M\right)\right)\right)} \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d} \]
    12. Simplified72.6%

      \[\leadsto \color{blue}{-0.125 \cdot \frac{\left(D \cdot \left(D \cdot \left(M \cdot M\right)\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d}} \]

    if 4.0000000000000002e96 < l

    1. Initial program 61.4%

      \[\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) \]
    2. Taylor expanded in d around inf 60.7%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative60.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative60.7%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*60.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified60.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div75.5%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow75.5%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr75.5%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow75.6%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square75.6%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval75.6%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow75.4%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr75.4%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow75.6%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified75.6%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification70.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -9 \cdot 10^{+119}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\ \mathbf{elif}\;\ell \leq -7.8 \cdot 10^{-131}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;\ell \leq 4.8 \cdot 10^{-39}:\\ \;\;\;\;\left(1 + -0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq 6.8 \cdot 10^{+58}:\\ \;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\ \mathbf{elif}\;\ell \leq 4 \cdot 10^{+96}:\\ \;\;\;\;-0.125 \cdot \frac{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(D \cdot \left(D \cdot \left(M \cdot M\right)\right)\right)}{d}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 13: 64.0% accurate, 1.5× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\ t_1 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\ \mathbf{if}\;d \leq -5.2 \cdot 10^{-238}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;t_0 \cdot \left(0.125 \cdot t_1\right)\\ \mathbf{elif}\;d \leq 1.3 \cdot 10^{-111}:\\ \;\;\;\;t_0 \cdot \left(t_1 \cdot -0.125\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ h (pow l 3.0)))) (t_1 (* M (/ (* D M) (/ d D)))))
   (if (<= d -5.2e-238)
     (*
      (* d (sqrt (/ 1.0 (* h l))))
      (- -1.0 (* -0.5 (* (/ h l) (pow (* D (/ M (* 2.0 d))) 2.0)))))
     (if (<= d -2e-310)
       (* t_0 (* 0.125 t_1))
       (if (<= d 1.3e-111)
         (* t_0 (* t_1 -0.125))
         (* d (/ (pow h -0.5) (sqrt l))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((h / pow(l, 3.0)));
	double t_1 = M * ((D * M) / (d / D));
	double tmp;
	if (d <= -5.2e-238) {
		tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * pow((D * (M / (2.0 * d))), 2.0))));
	} else if (d <= -2e-310) {
		tmp = t_0 * (0.125 * t_1);
	} else if (d <= 1.3e-111) {
		tmp = t_0 * (t_1 * -0.125);
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sqrt((h / (l ** 3.0d0)))
    t_1 = m * ((d_1 * m) / (d / d_1))
    if (d <= (-5.2d-238)) then
        tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((h / l) * ((d_1 * (m / (2.0d0 * d))) ** 2.0d0))))
    else if (d <= (-2d-310)) then
        tmp = t_0 * (0.125d0 * t_1)
    else if (d <= 1.3d-111) then
        tmp = t_0 * (t_1 * (-0.125d0))
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((h / Math.pow(l, 3.0)));
	double t_1 = M * ((D * M) / (d / D));
	double tmp;
	if (d <= -5.2e-238) {
		tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * Math.pow((D * (M / (2.0 * d))), 2.0))));
	} else if (d <= -2e-310) {
		tmp = t_0 * (0.125 * t_1);
	} else if (d <= 1.3e-111) {
		tmp = t_0 * (t_1 * -0.125);
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((h / math.pow(l, 3.0)))
	t_1 = M * ((D * M) / (d / D))
	tmp = 0
	if d <= -5.2e-238:
		tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * math.pow((D * (M / (2.0 * d))), 2.0))))
	elif d <= -2e-310:
		tmp = t_0 * (0.125 * t_1)
	elif d <= 1.3e-111:
		tmp = t_0 * (t_1 * -0.125)
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(h / (l ^ 3.0)))
	t_1 = Float64(M * Float64(Float64(D * M) / Float64(d / D)))
	tmp = 0.0
	if (d <= -5.2e-238)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0)))));
	elseif (d <= -2e-310)
		tmp = Float64(t_0 * Float64(0.125 * t_1));
	elseif (d <= 1.3e-111)
		tmp = Float64(t_0 * Float64(t_1 * -0.125));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((h / (l ^ 3.0)));
	t_1 = M * ((D * M) / (d / D));
	tmp = 0.0;
	if (d <= -5.2e-238)
		tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((h / l) * ((D * (M / (2.0 * d))) ^ 2.0))));
	elseif (d <= -2e-310)
		tmp = t_0 * (0.125 * t_1);
	elseif (d <= 1.3e-111)
		tmp = t_0 * (t_1 * -0.125);
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5.2e-238], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], N[(t$95$0 * N[(0.125 * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.3e-111], N[(t$95$0 * N[(t$95$1 * -0.125), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -5.2 \cdot 10^{-238}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\

\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(0.125 \cdot t_1\right)\\

\mathbf{elif}\;d \leq 1.3 \cdot 10^{-111}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot -0.125\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -5.2000000000000002e-238

    1. Initial program 75.2%

      \[\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) \]
    2. Applied egg-rr24.3%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def34.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p63.1%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified63.1%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 79.6%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg79.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in79.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative79.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified79.6%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]

    if -5.2000000000000002e-238 < d < -1.999999999999994e-310

    1. Initial program 29.9%

      \[\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) \]
    2. Applied egg-rr5.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def5.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p24.0%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified24.0%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative35.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified35.8%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around inf 65.3%

      \[\leadsto \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. *-commutative65.3%

        \[\leadsto 0.125 \cdot \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      2. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      3. unpow265.3%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      4. associate-*l/59.5%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      5. *-commutative59.5%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right) \cdot 0.125} \]
      6. associate-*l*59.5%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right) \cdot 0.125\right)} \]
      7. *-commutative59.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(0.125 \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right)} \]
      8. associate-*r*60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      9. *-commutative60.3%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      10. associate-/l*60.2%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      11. associate-*l/65.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified65.9%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if -1.999999999999994e-310 < d < 1.29999999999999991e-111

    1. Initial program 35.1%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval35.1%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/235.1%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/235.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified35.2%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr35.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. *-commutative35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      3. clear-num35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      4. *-commutative35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} \cdot \frac{h}{\ell}\right) \]
      5. metadata-eval35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. associate-*r/37.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      7. metadata-eval37.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      8. times-frac37.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    7. Applied egg-rr37.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    8. Taylor expanded in d around 0 40.1%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. associate-*r*40.1%

        \[\leadsto \color{blue}{\left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
      2. *-commutative40.1%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      3. unpow240.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      4. unpow240.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      5. associate-*l/39.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      6. associate-*r*42.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      7. *-commutative42.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      8. associate-/l*48.0%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      9. associate-*l/50.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified50.5%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if 1.29999999999999991e-111 < d

    1. Initial program 78.1%

      \[\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) \]
    2. Taylor expanded in d around inf 60.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative60.1%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*60.1%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified60.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div72.4%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow72.4%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr72.4%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow72.5%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square72.5%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval72.5%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow72.3%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr72.3%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow72.5%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified72.5%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification71.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -5.2 \cdot 10^{-238}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;d \leq 1.3 \cdot 10^{-111}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right) \cdot -0.125\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 14: 59.5% accurate, 1.5× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\ t_1 := \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{if}\;d \leq -2.85 \cdot 10^{+236}:\\ \;\;\;\;t_1 \cdot \left(-d\right)\\ \mathbf{elif}\;d \leq -1.9 \cdot 10^{-193}:\\ \;\;\;\;\left(d \cdot t_1\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq -3 \cdot 10^{-301}:\\ \;\;\;\;M \cdot \left(t_0 \cdot \frac{D \cdot D}{\frac{\frac{d}{M}}{0.125}}\right)\\ \mathbf{elif}\;d \leq 1.4 \cdot 10^{-112}:\\ \;\;\;\;-0.125 \cdot \frac{t_0 \cdot \left(D \cdot \left(D \cdot \left(M \cdot M\right)\right)\right)}{d}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ h (pow l 3.0)))) (t_1 (sqrt (/ 1.0 (* h l)))))
   (if (<= d -2.85e+236)
     (* t_1 (- d))
     (if (<= d -1.9e-193)
       (*
        (* d t_1)
        (- -1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M (* h M)) l)))))
       (if (<= d -3e-301)
         (* M (* t_0 (/ (* D D) (/ (/ d M) 0.125))))
         (if (<= d 1.4e-112)
           (* -0.125 (/ (* t_0 (* D (* D (* M M)))) d))
           (* d (/ (pow h -0.5) (sqrt l)))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((h / pow(l, 3.0)));
	double t_1 = sqrt((1.0 / (h * l)));
	double tmp;
	if (d <= -2.85e+236) {
		tmp = t_1 * -d;
	} else if (d <= -1.9e-193) {
		tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	} else if (d <= -3e-301) {
		tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125)));
	} else if (d <= 1.4e-112) {
		tmp = -0.125 * ((t_0 * (D * (D * (M * M)))) / d);
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sqrt((h / (l ** 3.0d0)))
    t_1 = sqrt((1.0d0 / (h * l)))
    if (d <= (-2.85d+236)) then
        tmp = t_1 * -d
    else if (d <= (-1.9d-193)) then
        tmp = (d * t_1) * ((-1.0d0) - ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * (h * m)) / l))))
    else if (d <= (-3d-301)) then
        tmp = m * (t_0 * ((d_1 * d_1) / ((d / m) / 0.125d0)))
    else if (d <= 1.4d-112) then
        tmp = (-0.125d0) * ((t_0 * (d_1 * (d_1 * (m * m)))) / d)
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((h / Math.pow(l, 3.0)));
	double t_1 = Math.sqrt((1.0 / (h * l)));
	double tmp;
	if (d <= -2.85e+236) {
		tmp = t_1 * -d;
	} else if (d <= -1.9e-193) {
		tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	} else if (d <= -3e-301) {
		tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125)));
	} else if (d <= 1.4e-112) {
		tmp = -0.125 * ((t_0 * (D * (D * (M * M)))) / d);
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((h / math.pow(l, 3.0)))
	t_1 = math.sqrt((1.0 / (h * l)))
	tmp = 0
	if d <= -2.85e+236:
		tmp = t_1 * -d
	elif d <= -1.9e-193:
		tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))))
	elif d <= -3e-301:
		tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125)))
	elif d <= 1.4e-112:
		tmp = -0.125 * ((t_0 * (D * (D * (M * M)))) / d)
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(h / (l ^ 3.0)))
	t_1 = sqrt(Float64(1.0 / Float64(h * l)))
	tmp = 0.0
	if (d <= -2.85e+236)
		tmp = Float64(t_1 * Float64(-d));
	elseif (d <= -1.9e-193)
		tmp = Float64(Float64(d * t_1) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * Float64(h * M)) / l)))));
	elseif (d <= -3e-301)
		tmp = Float64(M * Float64(t_0 * Float64(Float64(D * D) / Float64(Float64(d / M) / 0.125))));
	elseif (d <= 1.4e-112)
		tmp = Float64(-0.125 * Float64(Float64(t_0 * Float64(D * Float64(D * Float64(M * M)))) / d));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((h / (l ^ 3.0)));
	t_1 = sqrt((1.0 / (h * l)));
	tmp = 0.0;
	if (d <= -2.85e+236)
		tmp = t_1 * -d;
	elseif (d <= -1.9e-193)
		tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	elseif (d <= -3e-301)
		tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125)));
	elseif (d <= 1.4e-112)
		tmp = -0.125 * ((t_0 * (D * (D * (M * M)))) / d);
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2.85e+236], N[(t$95$1 * (-d)), $MachinePrecision], If[LessEqual[d, -1.9e-193], N[(N[(d * t$95$1), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3e-301], N[(M * N[(t$95$0 * N[(N[(D * D), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] / 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.4e-112], N[(-0.125 * N[(N[(t$95$0 * N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq -2.85 \cdot 10^{+236}:\\
\;\;\;\;t_1 \cdot \left(-d\right)\\

\mathbf{elif}\;d \leq -1.9 \cdot 10^{-193}:\\
\;\;\;\;\left(d \cdot t_1\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\

\mathbf{elif}\;d \leq -3 \cdot 10^{-301}:\\
\;\;\;\;M \cdot \left(t_0 \cdot \frac{D \cdot D}{\frac{\frac{d}{M}}{0.125}}\right)\\

\mathbf{elif}\;d \leq 1.4 \cdot 10^{-112}:\\
\;\;\;\;-0.125 \cdot \frac{t_0 \cdot \left(D \cdot \left(D \cdot \left(M \cdot M\right)\right)\right)}{d}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -2.8499999999999998e236

    1. Initial program 66.8%

      \[\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) \]
    2. Applied egg-rr48.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def48.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p66.8%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified66.8%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 88.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified88.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around 0 82.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    9. Step-by-step derivation
      1. associate-/l/82.2%

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}}\right) \]
      2. associate-*r*82.2%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
      3. *-commutative82.2%

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-1 \cdot d\right)} \]
      4. associate-/l/82.3%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \cdot \left(-1 \cdot d\right) \]
      5. *-commutative82.3%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
      6. mul-1-neg82.3%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(-d\right)} \]
    10. Simplified82.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]

    if -2.8499999999999998e236 < d < -1.90000000000000002e-193

    1. Initial program 79.1%

      \[\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) \]
    2. Applied egg-rr21.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def35.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p65.2%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified65.2%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 77.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg77.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in77.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative77.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified77.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 61.0%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac60.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative60.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*60.0%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow260.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow260.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac71.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*71.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow271.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified71.0%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    11. Taylor expanded in M around 0 71.1%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2} \cdot h}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    12. Step-by-step derivation
      1. unpow271.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. associate-*l*74.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot \left(M \cdot h\right)}}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    13. Simplified74.6%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{M \cdot \left(M \cdot h\right)}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]

    if -1.90000000000000002e-193 < d < -2.99999999999999999e-301

    1. Initial program 42.3%

      \[\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) \]
    2. Applied egg-rr8.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def8.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p34.7%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified34.7%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 59.7%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg59.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in59.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative59.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified59.7%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 44.6%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac44.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative44.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*44.6%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow244.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow244.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac48.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*48.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow248.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified48.3%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    11. Taylor expanded in D around inf 70.4%

      \[\leadsto \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    12. Step-by-step derivation
      1. associate-*r*70.4%

        \[\leadsto \color{blue}{\left(0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
      2. unpow270.4%

        \[\leadsto \left(0.125 \cdot \frac{{D}^{2} \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
      3. associate-/l*70.3%

        \[\leadsto \left(0.125 \cdot \color{blue}{\frac{{D}^{2}}{\frac{d}{M \cdot M}}}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
      4. associate-*r/70.3%

        \[\leadsto \color{blue}{\frac{0.125 \cdot {D}^{2}}{\frac{d}{M \cdot M}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
      5. unpow270.3%

        \[\leadsto \frac{0.125 \cdot \color{blue}{\left(D \cdot D\right)}}{\frac{d}{M \cdot M}} \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
      6. associate-/r*71.2%

        \[\leadsto \frac{0.125 \cdot \left(D \cdot D\right)}{\color{blue}{\frac{\frac{d}{M}}{M}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
      7. associate-/r/71.2%

        \[\leadsto \color{blue}{\left(\frac{0.125 \cdot \left(D \cdot D\right)}{\frac{d}{M}} \cdot M\right)} \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
      8. *-commutative71.2%

        \[\leadsto \color{blue}{\left(M \cdot \frac{0.125 \cdot \left(D \cdot D\right)}{\frac{d}{M}}\right)} \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
      9. associate-*l*71.2%

        \[\leadsto \color{blue}{M \cdot \left(\frac{0.125 \cdot \left(D \cdot D\right)}{\frac{d}{M}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
      10. *-commutative71.2%

        \[\leadsto M \cdot \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{0.125 \cdot \left(D \cdot D\right)}{\frac{d}{M}}\right)} \]
      11. unpow271.2%

        \[\leadsto M \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{0.125 \cdot \color{blue}{{D}^{2}}}{\frac{d}{M}}\right) \]
      12. *-commutative71.2%

        \[\leadsto M \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{{D}^{2} \cdot 0.125}}{\frac{d}{M}}\right) \]
      13. associate-/l*71.2%

        \[\leadsto M \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\frac{{D}^{2}}{\frac{\frac{d}{M}}{0.125}}}\right) \]
      14. unpow271.2%

        \[\leadsto M \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{D \cdot D}}{\frac{\frac{d}{M}}{0.125}}\right) \]
    13. Simplified71.2%

      \[\leadsto \color{blue}{M \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{D \cdot D}{\frac{\frac{d}{M}}{0.125}}\right)} \]

    if -2.99999999999999999e-301 < d < 1.40000000000000011e-112

    1. Initial program 35.8%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval35.8%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/235.8%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval35.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/235.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative35.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*35.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac35.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval35.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified35.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times35.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num35.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative35.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr35.9%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*35.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. *-commutative35.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      3. clear-num35.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      4. *-commutative35.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} \cdot \frac{h}{\ell}\right) \]
      5. metadata-eval35.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. associate-*r/38.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      7. metadata-eval38.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      8. times-frac38.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    7. Applied egg-rr38.1%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    8. Step-by-step derivation
      1. frac-times38.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
      2. associate-/r*38.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{\frac{M \cdot D}{2}}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    9. Applied egg-rr38.1%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{\frac{M \cdot D}{2}}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    10. Taylor expanded in d around 0 40.6%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    11. Step-by-step derivation
      1. associate-*l/42.9%

        \[\leadsto -0.125 \cdot \color{blue}{\frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d}} \]
      2. unpow242.9%

        \[\leadsto -0.125 \cdot \frac{\left(\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d} \]
      3. unpow242.9%

        \[\leadsto -0.125 \cdot \frac{\left(\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d} \]
      4. associate-*l*50.5%

        \[\leadsto -0.125 \cdot \frac{\color{blue}{\left(D \cdot \left(D \cdot \left(M \cdot M\right)\right)\right)} \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d} \]
    12. Simplified50.5%

      \[\leadsto \color{blue}{-0.125 \cdot \frac{\left(D \cdot \left(D \cdot \left(M \cdot M\right)\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d}} \]

    if 1.40000000000000011e-112 < d

    1. Initial program 78.1%

      \[\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) \]
    2. Taylor expanded in d around inf 60.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative60.1%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*60.1%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified60.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div72.4%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow72.4%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr72.4%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow72.5%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square72.5%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval72.5%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow72.3%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr72.3%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow72.5%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified72.5%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification70.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.85 \cdot 10^{+236}:\\ \;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\ \mathbf{elif}\;d \leq -1.9 \cdot 10^{-193}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq -3 \cdot 10^{-301}:\\ \;\;\;\;M \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{D \cdot D}{\frac{\frac{d}{M}}{0.125}}\right)\\ \mathbf{elif}\;d \leq 1.4 \cdot 10^{-112}:\\ \;\;\;\;-0.125 \cdot \frac{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(D \cdot \left(D \cdot \left(M \cdot M\right)\right)\right)}{d}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 15: 60.5% accurate, 1.5× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\ t_1 := \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{if}\;d \leq -1.45 \cdot 10^{+234}:\\ \;\;\;\;t_1 \cdot \left(-d\right)\\ \mathbf{elif}\;d \leq -1.6 \cdot 10^{-198}:\\ \;\;\;\;\left(d \cdot t_1\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq -3 \cdot 10^{-301}:\\ \;\;\;\;M \cdot \left(t_0 \cdot \frac{D \cdot D}{\frac{\frac{d}{M}}{0.125}}\right)\\ \mathbf{elif}\;d \leq 8 \cdot 10^{-113}:\\ \;\;\;\;t_0 \cdot \left(\left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right) \cdot -0.125\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ h (pow l 3.0)))) (t_1 (sqrt (/ 1.0 (* h l)))))
   (if (<= d -1.45e+234)
     (* t_1 (- d))
     (if (<= d -1.6e-198)
       (*
        (* d t_1)
        (- -1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M (* h M)) l)))))
       (if (<= d -3e-301)
         (* M (* t_0 (/ (* D D) (/ (/ d M) 0.125))))
         (if (<= d 8e-113)
           (* t_0 (* (* M (/ (* D M) (/ d D))) -0.125))
           (* d (/ (pow h -0.5) (sqrt l)))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((h / pow(l, 3.0)));
	double t_1 = sqrt((1.0 / (h * l)));
	double tmp;
	if (d <= -1.45e+234) {
		tmp = t_1 * -d;
	} else if (d <= -1.6e-198) {
		tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	} else if (d <= -3e-301) {
		tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125)));
	} else if (d <= 8e-113) {
		tmp = t_0 * ((M * ((D * M) / (d / D))) * -0.125);
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sqrt((h / (l ** 3.0d0)))
    t_1 = sqrt((1.0d0 / (h * l)))
    if (d <= (-1.45d+234)) then
        tmp = t_1 * -d
    else if (d <= (-1.6d-198)) then
        tmp = (d * t_1) * ((-1.0d0) - ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * (h * m)) / l))))
    else if (d <= (-3d-301)) then
        tmp = m * (t_0 * ((d_1 * d_1) / ((d / m) / 0.125d0)))
    else if (d <= 8d-113) then
        tmp = t_0 * ((m * ((d_1 * m) / (d / d_1))) * (-0.125d0))
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((h / Math.pow(l, 3.0)));
	double t_1 = Math.sqrt((1.0 / (h * l)));
	double tmp;
	if (d <= -1.45e+234) {
		tmp = t_1 * -d;
	} else if (d <= -1.6e-198) {
		tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	} else if (d <= -3e-301) {
		tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125)));
	} else if (d <= 8e-113) {
		tmp = t_0 * ((M * ((D * M) / (d / D))) * -0.125);
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((h / math.pow(l, 3.0)))
	t_1 = math.sqrt((1.0 / (h * l)))
	tmp = 0
	if d <= -1.45e+234:
		tmp = t_1 * -d
	elif d <= -1.6e-198:
		tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))))
	elif d <= -3e-301:
		tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125)))
	elif d <= 8e-113:
		tmp = t_0 * ((M * ((D * M) / (d / D))) * -0.125)
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(h / (l ^ 3.0)))
	t_1 = sqrt(Float64(1.0 / Float64(h * l)))
	tmp = 0.0
	if (d <= -1.45e+234)
		tmp = Float64(t_1 * Float64(-d));
	elseif (d <= -1.6e-198)
		tmp = Float64(Float64(d * t_1) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * Float64(h * M)) / l)))));
	elseif (d <= -3e-301)
		tmp = Float64(M * Float64(t_0 * Float64(Float64(D * D) / Float64(Float64(d / M) / 0.125))));
	elseif (d <= 8e-113)
		tmp = Float64(t_0 * Float64(Float64(M * Float64(Float64(D * M) / Float64(d / D))) * -0.125));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((h / (l ^ 3.0)));
	t_1 = sqrt((1.0 / (h * l)));
	tmp = 0.0;
	if (d <= -1.45e+234)
		tmp = t_1 * -d;
	elseif (d <= -1.6e-198)
		tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	elseif (d <= -3e-301)
		tmp = M * (t_0 * ((D * D) / ((d / M) / 0.125)));
	elseif (d <= 8e-113)
		tmp = t_0 * ((M * ((D * M) / (d / D))) * -0.125);
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.45e+234], N[(t$95$1 * (-d)), $MachinePrecision], If[LessEqual[d, -1.6e-198], N[(N[(d * t$95$1), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3e-301], N[(M * N[(t$95$0 * N[(N[(D * D), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] / 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8e-113], N[(t$95$0 * N[(N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq -1.45 \cdot 10^{+234}:\\
\;\;\;\;t_1 \cdot \left(-d\right)\\

\mathbf{elif}\;d \leq -1.6 \cdot 10^{-198}:\\
\;\;\;\;\left(d \cdot t_1\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\

\mathbf{elif}\;d \leq -3 \cdot 10^{-301}:\\
\;\;\;\;M \cdot \left(t_0 \cdot \frac{D \cdot D}{\frac{\frac{d}{M}}{0.125}}\right)\\

\mathbf{elif}\;d \leq 8 \cdot 10^{-113}:\\
\;\;\;\;t_0 \cdot \left(\left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right) \cdot -0.125\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -1.44999999999999993e234

    1. Initial program 66.8%

      \[\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) \]
    2. Applied egg-rr48.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def48.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p66.8%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified66.8%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 88.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified88.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around 0 82.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    9. Step-by-step derivation
      1. associate-/l/82.2%

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}}\right) \]
      2. associate-*r*82.2%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
      3. *-commutative82.2%

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-1 \cdot d\right)} \]
      4. associate-/l/82.3%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \cdot \left(-1 \cdot d\right) \]
      5. *-commutative82.3%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
      6. mul-1-neg82.3%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(-d\right)} \]
    10. Simplified82.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]

    if -1.44999999999999993e234 < d < -1.59999999999999997e-198

    1. Initial program 79.1%

      \[\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) \]
    2. Applied egg-rr21.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def35.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p65.2%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified65.2%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 77.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg77.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in77.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative77.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified77.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 61.0%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac60.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative60.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*60.0%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow260.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow260.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac71.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*71.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow271.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified71.0%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    11. Taylor expanded in M around 0 71.1%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2} \cdot h}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    12. Step-by-step derivation
      1. unpow271.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. associate-*l*74.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot \left(M \cdot h\right)}}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    13. Simplified74.6%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{M \cdot \left(M \cdot h\right)}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]

    if -1.59999999999999997e-198 < d < -2.99999999999999999e-301

    1. Initial program 42.3%

      \[\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) \]
    2. Applied egg-rr8.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def8.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p34.7%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified34.7%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 59.7%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg59.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in59.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative59.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified59.7%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 44.6%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac44.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative44.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*44.6%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow244.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow244.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac48.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*48.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow248.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified48.3%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    11. Taylor expanded in D around inf 70.4%

      \[\leadsto \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    12. Step-by-step derivation
      1. associate-*r*70.4%

        \[\leadsto \color{blue}{\left(0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
      2. unpow270.4%

        \[\leadsto \left(0.125 \cdot \frac{{D}^{2} \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
      3. associate-/l*70.3%

        \[\leadsto \left(0.125 \cdot \color{blue}{\frac{{D}^{2}}{\frac{d}{M \cdot M}}}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
      4. associate-*r/70.3%

        \[\leadsto \color{blue}{\frac{0.125 \cdot {D}^{2}}{\frac{d}{M \cdot M}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
      5. unpow270.3%

        \[\leadsto \frac{0.125 \cdot \color{blue}{\left(D \cdot D\right)}}{\frac{d}{M \cdot M}} \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
      6. associate-/r*71.2%

        \[\leadsto \frac{0.125 \cdot \left(D \cdot D\right)}{\color{blue}{\frac{\frac{d}{M}}{M}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
      7. associate-/r/71.2%

        \[\leadsto \color{blue}{\left(\frac{0.125 \cdot \left(D \cdot D\right)}{\frac{d}{M}} \cdot M\right)} \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
      8. *-commutative71.2%

        \[\leadsto \color{blue}{\left(M \cdot \frac{0.125 \cdot \left(D \cdot D\right)}{\frac{d}{M}}\right)} \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
      9. associate-*l*71.2%

        \[\leadsto \color{blue}{M \cdot \left(\frac{0.125 \cdot \left(D \cdot D\right)}{\frac{d}{M}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
      10. *-commutative71.2%

        \[\leadsto M \cdot \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{0.125 \cdot \left(D \cdot D\right)}{\frac{d}{M}}\right)} \]
      11. unpow271.2%

        \[\leadsto M \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{0.125 \cdot \color{blue}{{D}^{2}}}{\frac{d}{M}}\right) \]
      12. *-commutative71.2%

        \[\leadsto M \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{{D}^{2} \cdot 0.125}}{\frac{d}{M}}\right) \]
      13. associate-/l*71.2%

        \[\leadsto M \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\frac{{D}^{2}}{\frac{\frac{d}{M}}{0.125}}}\right) \]
      14. unpow271.2%

        \[\leadsto M \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{D \cdot D}}{\frac{\frac{d}{M}}{0.125}}\right) \]
    13. Simplified71.2%

      \[\leadsto \color{blue}{M \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{D \cdot D}{\frac{\frac{d}{M}}{0.125}}\right)} \]

    if -2.99999999999999999e-301 < d < 7.99999999999999983e-113

    1. Initial program 35.8%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval35.8%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/235.8%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval35.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/235.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative35.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*35.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac35.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval35.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified35.9%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times35.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num35.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative35.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr35.9%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*35.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. *-commutative35.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      3. clear-num35.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      4. *-commutative35.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} \cdot \frac{h}{\ell}\right) \]
      5. metadata-eval35.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. associate-*r/38.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      7. metadata-eval38.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      8. times-frac38.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    7. Applied egg-rr38.1%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    8. Taylor expanded in d around 0 40.6%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. associate-*r*40.6%

        \[\leadsto \color{blue}{\left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
      2. *-commutative40.6%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      3. unpow240.6%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      4. unpow240.6%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      5. associate-*l/40.4%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      6. associate-*r*43.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      7. *-commutative43.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      8. associate-/l*48.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      9. associate-*l/50.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified50.5%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if 7.99999999999999983e-113 < d

    1. Initial program 78.1%

      \[\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) \]
    2. Taylor expanded in d around inf 60.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative60.1%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*60.1%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified60.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div72.4%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow72.4%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr72.4%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow72.5%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square72.5%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval72.5%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow72.3%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr72.3%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow72.5%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified72.5%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification70.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.45 \cdot 10^{+234}:\\ \;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\ \mathbf{elif}\;d \leq -1.6 \cdot 10^{-198}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq -3 \cdot 10^{-301}:\\ \;\;\;\;M \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{D \cdot D}{\frac{\frac{d}{M}}{0.125}}\right)\\ \mathbf{elif}\;d \leq 8 \cdot 10^{-113}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right) \cdot -0.125\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 16: 61.2% accurate, 1.5× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\ t_1 := \sqrt{\frac{1}{h \cdot \ell}}\\ t_2 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\ \mathbf{if}\;d \leq -1.4 \cdot 10^{+236}:\\ \;\;\;\;t_1 \cdot \left(-d\right)\\ \mathbf{elif}\;d \leq -2.05 \cdot 10^{-188}:\\ \;\;\;\;\left(d \cdot t_1\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;t_0 \cdot \left(0.125 \cdot t_2\right)\\ \mathbf{elif}\;d \leq 1.5 \cdot 10^{-112}:\\ \;\;\;\;t_0 \cdot \left(t_2 \cdot -0.125\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ h (pow l 3.0))))
        (t_1 (sqrt (/ 1.0 (* h l))))
        (t_2 (* M (/ (* D M) (/ d D)))))
   (if (<= d -1.4e+236)
     (* t_1 (- d))
     (if (<= d -2.05e-188)
       (*
        (* d t_1)
        (- -1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M (* h M)) l)))))
       (if (<= d -2e-310)
         (* t_0 (* 0.125 t_2))
         (if (<= d 1.5e-112)
           (* t_0 (* t_2 -0.125))
           (* d (/ (pow h -0.5) (sqrt l)))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((h / pow(l, 3.0)));
	double t_1 = sqrt((1.0 / (h * l)));
	double t_2 = M * ((D * M) / (d / D));
	double tmp;
	if (d <= -1.4e+236) {
		tmp = t_1 * -d;
	} else if (d <= -2.05e-188) {
		tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	} else if (d <= -2e-310) {
		tmp = t_0 * (0.125 * t_2);
	} else if (d <= 1.5e-112) {
		tmp = t_0 * (t_2 * -0.125);
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = sqrt((h / (l ** 3.0d0)))
    t_1 = sqrt((1.0d0 / (h * l)))
    t_2 = m * ((d_1 * m) / (d / d_1))
    if (d <= (-1.4d+236)) then
        tmp = t_1 * -d
    else if (d <= (-2.05d-188)) then
        tmp = (d * t_1) * ((-1.0d0) - ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * (h * m)) / l))))
    else if (d <= (-2d-310)) then
        tmp = t_0 * (0.125d0 * t_2)
    else if (d <= 1.5d-112) then
        tmp = t_0 * (t_2 * (-0.125d0))
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((h / Math.pow(l, 3.0)));
	double t_1 = Math.sqrt((1.0 / (h * l)));
	double t_2 = M * ((D * M) / (d / D));
	double tmp;
	if (d <= -1.4e+236) {
		tmp = t_1 * -d;
	} else if (d <= -2.05e-188) {
		tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	} else if (d <= -2e-310) {
		tmp = t_0 * (0.125 * t_2);
	} else if (d <= 1.5e-112) {
		tmp = t_0 * (t_2 * -0.125);
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((h / math.pow(l, 3.0)))
	t_1 = math.sqrt((1.0 / (h * l)))
	t_2 = M * ((D * M) / (d / D))
	tmp = 0
	if d <= -1.4e+236:
		tmp = t_1 * -d
	elif d <= -2.05e-188:
		tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))))
	elif d <= -2e-310:
		tmp = t_0 * (0.125 * t_2)
	elif d <= 1.5e-112:
		tmp = t_0 * (t_2 * -0.125)
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(h / (l ^ 3.0)))
	t_1 = sqrt(Float64(1.0 / Float64(h * l)))
	t_2 = Float64(M * Float64(Float64(D * M) / Float64(d / D)))
	tmp = 0.0
	if (d <= -1.4e+236)
		tmp = Float64(t_1 * Float64(-d));
	elseif (d <= -2.05e-188)
		tmp = Float64(Float64(d * t_1) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * Float64(h * M)) / l)))));
	elseif (d <= -2e-310)
		tmp = Float64(t_0 * Float64(0.125 * t_2));
	elseif (d <= 1.5e-112)
		tmp = Float64(t_0 * Float64(t_2 * -0.125));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((h / (l ^ 3.0)));
	t_1 = sqrt((1.0 / (h * l)));
	t_2 = M * ((D * M) / (d / D));
	tmp = 0.0;
	if (d <= -1.4e+236)
		tmp = t_1 * -d;
	elseif (d <= -2.05e-188)
		tmp = (d * t_1) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	elseif (d <= -2e-310)
		tmp = t_0 * (0.125 * t_2);
	elseif (d <= 1.5e-112)
		tmp = t_0 * (t_2 * -0.125);
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(M * N[(N[(D * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.4e+236], N[(t$95$1 * (-d)), $MachinePrecision], If[LessEqual[d, -2.05e-188], N[(N[(d * t$95$1), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], N[(t$95$0 * N[(0.125 * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.5e-112], N[(t$95$0 * N[(t$95$2 * -0.125), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := \sqrt{\frac{1}{h \cdot \ell}}\\
t_2 := M \cdot \frac{D \cdot M}{\frac{d}{D}}\\
\mathbf{if}\;d \leq -1.4 \cdot 10^{+236}:\\
\;\;\;\;t_1 \cdot \left(-d\right)\\

\mathbf{elif}\;d \leq -2.05 \cdot 10^{-188}:\\
\;\;\;\;\left(d \cdot t_1\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\

\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(0.125 \cdot t_2\right)\\

\mathbf{elif}\;d \leq 1.5 \cdot 10^{-112}:\\
\;\;\;\;t_0 \cdot \left(t_2 \cdot -0.125\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -1.39999999999999996e236

    1. Initial program 66.8%

      \[\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) \]
    2. Applied egg-rr48.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def48.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p66.8%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified66.8%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 88.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified88.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around 0 82.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    9. Step-by-step derivation
      1. associate-/l/82.2%

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}}\right) \]
      2. associate-*r*82.2%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
      3. *-commutative82.2%

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-1 \cdot d\right)} \]
      4. associate-/l/82.3%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \cdot \left(-1 \cdot d\right) \]
      5. *-commutative82.3%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
      6. mul-1-neg82.3%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(-d\right)} \]
    10. Simplified82.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]

    if -1.39999999999999996e236 < d < -2.04999999999999991e-188

    1. Initial program 79.1%

      \[\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) \]
    2. Applied egg-rr21.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def35.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p65.2%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified65.2%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 77.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg77.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in77.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative77.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified77.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 61.0%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac60.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative60.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*60.0%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow260.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow260.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac71.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*71.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow271.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified71.0%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    11. Taylor expanded in M around 0 71.1%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2} \cdot h}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    12. Step-by-step derivation
      1. unpow271.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. associate-*l*74.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot \left(M \cdot h\right)}}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    13. Simplified74.6%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{M \cdot \left(M \cdot h\right)}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]

    if -2.04999999999999991e-188 < d < -1.999999999999994e-310

    1. Initial program 42.8%

      \[\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) \]
    2. Applied egg-rr7.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def7.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p32.3%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified32.3%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 55.6%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg55.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in55.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative55.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified55.6%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around inf 69.1%

      \[\leadsto \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. *-commutative69.1%

        \[\leadsto 0.125 \cdot \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      2. unpow269.1%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      3. unpow269.1%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      4. associate-*l/62.1%

        \[\leadsto 0.125 \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      5. *-commutative62.1%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right) \cdot 0.125} \]
      6. associate-*l*62.1%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right) \cdot 0.125\right)} \]
      7. *-commutative62.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\left(0.125 \cdot \left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)\right)} \]
      8. associate-*r*63.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      9. *-commutative63.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      10. associate-/l*63.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      11. associate-*l/66.6%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified66.6%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if -1.999999999999994e-310 < d < 1.5e-112

    1. Initial program 35.1%

      \[\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) \]
    2. Step-by-step derivation
      1. metadata-eval35.1%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \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) \]
      2. unpow1/235.1%

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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) \]
      3. metadata-eval35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\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) \]
      4. unpow1/235.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\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) \]
      5. *-commutative35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)} \cdot \frac{h}{\ell}\right) \]
      6. associate-*l*35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. metadata-eval35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{0.5} \cdot \frac{h}{\ell}\right)\right) \]
    3. Simplified35.2%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    4. Step-by-step derivation
      1. frac-times35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. clear-num35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{2 \cdot d}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. *-commutative35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{1}{\frac{\color{blue}{d \cdot 2}}{M \cdot D}}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr35.2%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\color{blue}{\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{1}{\frac{d \cdot 2}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. *-commutative35.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      3. clear-num35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \]
      4. *-commutative35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} \cdot \frac{h}{\ell}\right) \]
      5. metadata-eval35.1%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. associate-*r/37.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      7. metadata-eval37.4%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right) \]
      8. times-frac37.5%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(0.5 \cdot {\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2}\right) \cdot h}{\ell}\right) \]
    7. Applied egg-rr37.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    8. Taylor expanded in d around 0 40.1%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    9. Step-by-step derivation
      1. associate-*r*40.1%

        \[\leadsto \color{blue}{\left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
      2. *-commutative40.1%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right)} \]
      3. unpow240.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d}\right) \]
      4. unpow240.1%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d}\right) \]
      5. associate-*l/39.9%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right)}\right) \]
      6. associate-*r*42.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot M\right)}\right) \]
      7. *-commutative42.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \color{blue}{\left(M \cdot \left(\frac{D \cdot D}{d} \cdot M\right)\right)}\right) \]
      8. associate-/l*48.0%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \left(\color{blue}{\frac{D}{\frac{d}{D}}} \cdot M\right)\right)\right) \]
      9. associate-*l/50.5%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \color{blue}{\frac{D \cdot M}{\frac{d}{D}}}\right)\right) \]
    10. Simplified50.5%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)} \]

    if 1.5e-112 < d

    1. Initial program 78.1%

      \[\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) \]
    2. Taylor expanded in d around inf 60.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative60.1%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*60.1%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified60.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div72.4%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow72.4%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr72.4%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow72.5%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square72.5%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval72.5%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow72.3%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr72.3%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow72.5%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified72.5%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification69.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.4 \cdot 10^{+236}:\\ \;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\ \mathbf{elif}\;d \leq -2.05 \cdot 10^{-188}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(0.125 \cdot \left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;d \leq 1.5 \cdot 10^{-112}:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(M \cdot \frac{D \cdot M}{\frac{d}{D}}\right) \cdot -0.125\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 17: 60.4% accurate, 1.5× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{if}\;d \leq -5.5 \cdot 10^{+231}:\\ \;\;\;\;t_0 \cdot \left(-d\right)\\ \mathbf{elif}\;d \leq -5.4 \cdot 10^{-304}:\\ \;\;\;\;\left(d \cdot t_0\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq 7.2 \cdot 10^{-113}:\\ \;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ 1.0 (* h l)))))
   (if (<= d -5.5e+231)
     (* t_0 (- d))
     (if (<= d -5.4e-304)
       (*
        (* d t_0)
        (- -1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M (* h M)) l)))))
       (if (<= d 7.2e-113)
         (* -0.125 (* (/ (* D D) (/ d (* M M))) (/ (sqrt h) (pow l 1.5))))
         (* d (/ (pow h -0.5) (sqrt l))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((1.0 / (h * l)));
	double tmp;
	if (d <= -5.5e+231) {
		tmp = t_0 * -d;
	} else if (d <= -5.4e-304) {
		tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	} else if (d <= 7.2e-113) {
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / pow(l, 1.5)));
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt((1.0d0 / (h * l)))
    if (d <= (-5.5d+231)) then
        tmp = t_0 * -d
    else if (d <= (-5.4d-304)) then
        tmp = (d * t_0) * ((-1.0d0) - ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * (h * m)) / l))))
    else if (d <= 7.2d-113) then
        tmp = (-0.125d0) * (((d_1 * d_1) / (d / (m * m))) * (sqrt(h) / (l ** 1.5d0)))
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((1.0 / (h * l)));
	double tmp;
	if (d <= -5.5e+231) {
		tmp = t_0 * -d;
	} else if (d <= -5.4e-304) {
		tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	} else if (d <= 7.2e-113) {
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (Math.sqrt(h) / Math.pow(l, 1.5)));
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((1.0 / (h * l)))
	tmp = 0
	if d <= -5.5e+231:
		tmp = t_0 * -d
	elif d <= -5.4e-304:
		tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))))
	elif d <= 7.2e-113:
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (math.sqrt(h) / math.pow(l, 1.5)))
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(1.0 / Float64(h * l)))
	tmp = 0.0
	if (d <= -5.5e+231)
		tmp = Float64(t_0 * Float64(-d));
	elseif (d <= -5.4e-304)
		tmp = Float64(Float64(d * t_0) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * Float64(h * M)) / l)))));
	elseif (d <= 7.2e-113)
		tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d / Float64(M * M))) * Float64(sqrt(h) / (l ^ 1.5))));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((1.0 / (h * l)));
	tmp = 0.0;
	if (d <= -5.5e+231)
		tmp = t_0 * -d;
	elseif (d <= -5.4e-304)
		tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	elseif (d <= 7.2e-113)
		tmp = -0.125 * (((D * D) / (d / (M * M))) * (sqrt(h) / (l ^ 1.5)));
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -5.5e+231], N[(t$95$0 * (-d)), $MachinePrecision], If[LessEqual[d, -5.4e-304], N[(N[(d * t$95$0), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.2e-113], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq -5.5 \cdot 10^{+231}:\\
\;\;\;\;t_0 \cdot \left(-d\right)\\

\mathbf{elif}\;d \leq -5.4 \cdot 10^{-304}:\\
\;\;\;\;\left(d \cdot t_0\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\

\mathbf{elif}\;d \leq 7.2 \cdot 10^{-113}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -5.5e231

    1. Initial program 66.8%

      \[\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) \]
    2. Applied egg-rr48.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def48.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p66.8%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified66.8%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 88.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified88.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around 0 82.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    9. Step-by-step derivation
      1. associate-/l/82.2%

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}}\right) \]
      2. associate-*r*82.2%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
      3. *-commutative82.2%

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-1 \cdot d\right)} \]
      4. associate-/l/82.3%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \cdot \left(-1 \cdot d\right) \]
      5. *-commutative82.3%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
      6. mul-1-neg82.3%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(-d\right)} \]
    10. Simplified82.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]

    if -5.5e231 < d < -5.40000000000000021e-304

    1. Initial program 70.2%

      \[\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) \]
    2. Applied egg-rr17.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def28.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p57.1%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified57.1%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 72.1%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg72.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in72.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative72.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified72.1%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 56.4%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac55.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative55.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*55.6%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow255.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow255.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac65.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*65.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow265.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified65.6%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    11. Taylor expanded in M around 0 65.7%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2} \cdot h}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    12. Step-by-step derivation
      1. unpow265.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. associate-*l*68.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot \left(M \cdot h\right)}}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    13. Simplified68.3%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{M \cdot \left(M \cdot h\right)}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]

    if -5.40000000000000021e-304 < d < 7.1999999999999995e-113

    1. Initial program 34.2%

      \[\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) \]
    2. Taylor expanded in d around 0 39.1%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    3. Step-by-step derivation
      1. associate-/l*36.6%

        \[\leadsto -0.125 \cdot \left(\color{blue}{\frac{{D}^{2}}{\frac{d}{{M}^{2}}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      2. unpow236.6%

        \[\leadsto -0.125 \cdot \left(\frac{\color{blue}{D \cdot D}}{\frac{d}{{M}^{2}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      3. unpow236.6%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
    4. Simplified36.6%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    5. Step-by-step derivation
      1. sqrt-div36.6%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \color{blue}{\frac{\sqrt{h}}{\sqrt{{\ell}^{3}}}}\right) \]
    6. Applied egg-rr36.6%

      \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \color{blue}{\frac{\sqrt{h}}{\sqrt{{\ell}^{3}}}}\right) \]
    7. Step-by-step derivation
      1. sqr-pow36.6%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\sqrt{\color{blue}{{\ell}^{\left(\frac{3}{2}\right)} \cdot {\ell}^{\left(\frac{3}{2}\right)}}}}\right) \]
      2. rem-sqrt-square44.1%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\color{blue}{\left|{\ell}^{\left(\frac{3}{2}\right)}\right|}}\right) \]
      3. sqr-pow44.1%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\left|\color{blue}{{\ell}^{\left(\frac{\frac{3}{2}}{2}\right)} \cdot {\ell}^{\left(\frac{\frac{3}{2}}{2}\right)}}\right|}\right) \]
      4. fabs-sqr44.1%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\color{blue}{{\ell}^{\left(\frac{\frac{3}{2}}{2}\right)} \cdot {\ell}^{\left(\frac{\frac{3}{2}}{2}\right)}}}\right) \]
      5. sqr-pow44.1%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{\color{blue}{{\ell}^{\left(\frac{3}{2}\right)}}}\right) \]
      6. metadata-eval44.1%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{\color{blue}{1.5}}}\right) \]
    8. Simplified44.1%

      \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \color{blue}{\frac{\sqrt{h}}{{\ell}^{1.5}}}\right) \]

    if 7.1999999999999995e-113 < d

    1. Initial program 78.1%

      \[\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) \]
    2. Taylor expanded in d around inf 60.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative60.1%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*60.1%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified60.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div72.4%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow72.4%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr72.4%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow72.5%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square72.5%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval72.5%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow72.3%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr72.3%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow72.5%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified72.5%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification67.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -5.5 \cdot 10^{+231}:\\ \;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\ \mathbf{elif}\;d \leq -5.4 \cdot 10^{-304}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq 7.2 \cdot 10^{-113}:\\ \;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 18: 57.0% accurate, 1.5× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;h \leq 7.2 \cdot 10^{+266}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot \left(D \cdot \frac{D \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{\frac{d}{M \cdot M}}\right)\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= h -2e-310)
   (*
    (* d (sqrt (/ 1.0 (* h l))))
    (- -1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M (* h M)) l)))))
   (if (<= h 7.2e+266)
     (* d (/ (pow h -0.5) (sqrt l)))
     (* -0.125 (* D (/ (* D (sqrt (/ h (pow l 3.0)))) (/ d (* M M))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= -2e-310) {
		tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	} else if (h <= 7.2e+266) {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	} else {
		tmp = -0.125 * (D * ((D * sqrt((h / pow(l, 3.0)))) / (d / (M * M))));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (h <= (-2d-310)) then
        tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * (h * m)) / l))))
    else if (h <= 7.2d+266) then
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    else
        tmp = (-0.125d0) * (d_1 * ((d_1 * sqrt((h / (l ** 3.0d0)))) / (d / (m * m))))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (h <= -2e-310) {
		tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	} else if (h <= 7.2e+266) {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	} else {
		tmp = -0.125 * (D * ((D * Math.sqrt((h / Math.pow(l, 3.0)))) / (d / (M * M))));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if h <= -2e-310:
		tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))))
	elif h <= 7.2e+266:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	else:
		tmp = -0.125 * (D * ((D * math.sqrt((h / math.pow(l, 3.0)))) / (d / (M * M))))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (h <= -2e-310)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * Float64(h * M)) / l)))));
	elseif (h <= 7.2e+266)
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	else
		tmp = Float64(-0.125 * Float64(D * Float64(Float64(D * sqrt(Float64(h / (l ^ 3.0)))) / Float64(d / Float64(M * M)))));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (h <= -2e-310)
		tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	elseif (h <= 7.2e+266)
		tmp = d * ((h ^ -0.5) / sqrt(l));
	else
		tmp = -0.125 * (D * ((D * sqrt((h / (l ^ 3.0)))) / (d / (M * M))));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[h, -2e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 7.2e+266], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.125 * N[(D * N[(N[(D * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\

\mathbf{elif}\;h \leq 7.2 \cdot 10^{+266}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\

\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(D \cdot \frac{D \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{\frac{d}{M \cdot M}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if h < -1.999999999999994e-310

    1. Initial program 69.2%

      \[\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) \]
    2. Applied egg-rr21.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def30.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p57.9%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified57.9%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 73.7%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg73.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in73.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative73.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified73.7%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 53.9%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac51.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative51.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*51.6%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow251.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow251.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac64.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*64.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow264.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified64.2%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    11. Taylor expanded in M around 0 64.3%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2} \cdot h}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    12. Step-by-step derivation
      1. unpow264.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. associate-*l*67.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot \left(M \cdot h\right)}}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    13. Simplified67.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{M \cdot \left(M \cdot h\right)}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]

    if -1.999999999999994e-310 < h < 7.19999999999999976e266

    1. Initial program 67.0%

      \[\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) \]
    2. Taylor expanded in d around inf 54.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative54.1%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative54.1%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*54.1%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified54.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div63.4%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow63.4%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr63.4%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow63.5%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square63.5%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval63.5%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow63.3%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr63.3%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow63.5%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified63.5%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]

    if 7.19999999999999976e266 < h

    1. Initial program 44.3%

      \[\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) \]
    2. Taylor expanded in d around 0 57.2%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    3. Step-by-step derivation
      1. associate-/l*57.2%

        \[\leadsto -0.125 \cdot \left(\color{blue}{\frac{{D}^{2}}{\frac{d}{{M}^{2}}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      2. unpow257.2%

        \[\leadsto -0.125 \cdot \left(\frac{\color{blue}{D \cdot D}}{\frac{d}{{M}^{2}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      3. unpow257.2%

        \[\leadsto -0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
    4. Simplified57.2%

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    5. Taylor expanded in D around 0 57.2%

      \[\leadsto -0.125 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    6. Step-by-step derivation
      1. unpow257.2%

        \[\leadsto -0.125 \cdot \left(\frac{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      2. unpow257.2%

        \[\leadsto -0.125 \cdot \left(\frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      3. associate-/l*57.2%

        \[\leadsto -0.125 \cdot \left(\color{blue}{\frac{D \cdot D}{\frac{d}{M \cdot M}}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \]
      4. associate-*l/57.2%

        \[\leadsto -0.125 \cdot \color{blue}{\frac{\left(D \cdot D\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{\frac{d}{M \cdot M}}} \]
      5. *-lft-identity57.2%

        \[\leadsto -0.125 \cdot \frac{\left(D \cdot D\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{\color{blue}{1 \cdot \frac{d}{M \cdot M}}} \]
      6. associate-*l*57.2%

        \[\leadsto -0.125 \cdot \frac{\color{blue}{D \cdot \left(D \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)}}{1 \cdot \frac{d}{M \cdot M}} \]
      7. times-frac57.2%

        \[\leadsto -0.125 \cdot \color{blue}{\left(\frac{D}{1} \cdot \frac{D \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{\frac{d}{M \cdot M}}\right)} \]
      8. /-rgt-identity57.2%

        \[\leadsto -0.125 \cdot \left(\color{blue}{D} \cdot \frac{D \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{\frac{d}{M \cdot M}}\right) \]
    7. Simplified57.2%

      \[\leadsto -0.125 \cdot \color{blue}{\left(D \cdot \frac{D \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{\frac{d}{M \cdot M}}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification65.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;h \leq 7.2 \cdot 10^{+266}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot \left(D \cdot \frac{D \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{\frac{d}{M \cdot M}}\right)\\ \end{array} \]

Alternative 19: 56.3% accurate, 1.6× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{if}\;d \leq -4.7 \cdot 10^{+236}:\\ \;\;\;\;t_0 \cdot \left(-d\right)\\ \mathbf{elif}\;d \leq -5.4 \cdot 10^{-304}:\\ \;\;\;\;\left(d \cdot t_0\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ 1.0 (* h l)))))
   (if (<= d -4.7e+236)
     (* t_0 (- d))
     (if (<= d -5.4e-304)
       (*
        (* d t_0)
        (- -1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M (* h M)) l)))))
       (* d (/ (pow h -0.5) (sqrt l)))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((1.0 / (h * l)));
	double tmp;
	if (d <= -4.7e+236) {
		tmp = t_0 * -d;
	} else if (d <= -5.4e-304) {
		tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	} else {
		tmp = d * (pow(h, -0.5) / sqrt(l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt((1.0d0 / (h * l)))
    if (d <= (-4.7d+236)) then
        tmp = t_0 * -d
    else if (d <= (-5.4d-304)) then
        tmp = (d * t_0) * ((-1.0d0) - ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * (h * m)) / l))))
    else
        tmp = d * ((h ** (-0.5d0)) / sqrt(l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((1.0 / (h * l)));
	double tmp;
	if (d <= -4.7e+236) {
		tmp = t_0 * -d;
	} else if (d <= -5.4e-304) {
		tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	} else {
		tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((1.0 / (h * l)))
	tmp = 0
	if d <= -4.7e+236:
		tmp = t_0 * -d
	elif d <= -5.4e-304:
		tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))))
	else:
		tmp = d * (math.pow(h, -0.5) / math.sqrt(l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(1.0 / Float64(h * l)))
	tmp = 0.0
	if (d <= -4.7e+236)
		tmp = Float64(t_0 * Float64(-d));
	elseif (d <= -5.4e-304)
		tmp = Float64(Float64(d * t_0) * Float64(-1.0 - Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * Float64(h * M)) / l)))));
	else
		tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((1.0 / (h * l)));
	tmp = 0.0;
	if (d <= -4.7e+236)
		tmp = t_0 * -d;
	elseif (d <= -5.4e-304)
		tmp = (d * t_0) * (-1.0 - (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * (h * M)) / l))));
	else
		tmp = d * ((h ^ -0.5) / sqrt(l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -4.7e+236], N[(t$95$0 * (-d)), $MachinePrecision], If[LessEqual[d, -5.4e-304], N[(N[(d * t$95$0), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq -4.7 \cdot 10^{+236}:\\
\;\;\;\;t_0 \cdot \left(-d\right)\\

\mathbf{elif}\;d \leq -5.4 \cdot 10^{-304}:\\
\;\;\;\;\left(d \cdot t_0\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -4.69999999999999963e236

    1. Initial program 66.8%

      \[\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) \]
    2. Applied egg-rr48.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def48.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p66.8%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified66.8%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 88.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative88.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified88.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around 0 82.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    9. Step-by-step derivation
      1. associate-/l/82.2%

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}}\right) \]
      2. associate-*r*82.2%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
      3. *-commutative82.2%

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-1 \cdot d\right)} \]
      4. associate-/l/82.3%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \cdot \left(-1 \cdot d\right) \]
      5. *-commutative82.3%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
      6. mul-1-neg82.3%

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(-d\right)} \]
    10. Simplified82.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]

    if -4.69999999999999963e236 < d < -5.40000000000000021e-304

    1. Initial program 70.2%

      \[\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) \]
    2. Applied egg-rr17.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def28.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p57.1%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified57.1%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 72.1%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg72.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in72.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative72.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified72.1%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 56.4%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac55.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative55.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*55.6%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow255.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow255.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac65.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*65.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow265.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified65.6%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    11. Taylor expanded in M around 0 65.7%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2} \cdot h}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    12. Step-by-step derivation
      1. unpow265.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. associate-*l*68.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot \left(M \cdot h\right)}}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    13. Simplified68.3%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{M \cdot \left(M \cdot h\right)}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]

    if -5.40000000000000021e-304 < d

    1. Initial program 65.0%

      \[\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) \]
    2. Taylor expanded in d around inf 50.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative50.1%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative50.1%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. associate-/r*50.1%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    4. Simplified50.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
    5. Step-by-step derivation
      1. sqrt-div59.4%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}} \]
      2. inv-pow59.4%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{-1}}}}{\sqrt{\ell}} \]
    6. Applied egg-rr59.4%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{{h}^{-1}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. sqr-pow59.5%

        \[\leadsto d \cdot \frac{\sqrt{\color{blue}{{h}^{\left(\frac{-1}{2}\right)} \cdot {h}^{\left(\frac{-1}{2}\right)}}}}{\sqrt{\ell}} \]
      2. rem-sqrt-square59.5%

        \[\leadsto d \cdot \frac{\color{blue}{\left|{h}^{\left(\frac{-1}{2}\right)}\right|}}{\sqrt{\ell}} \]
      3. metadata-eval59.5%

        \[\leadsto d \cdot \frac{\left|{h}^{\color{blue}{-0.5}}\right|}{\sqrt{\ell}} \]
      4. sqr-pow59.4%

        \[\leadsto d \cdot \frac{\left|\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}\right|}{\sqrt{\ell}} \]
      5. fabs-sqr59.4%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{\left(\frac{-0.5}{2}\right)} \cdot {h}^{\left(\frac{-0.5}{2}\right)}}}{\sqrt{\ell}} \]
      6. sqr-pow59.5%

        \[\leadsto d \cdot \frac{\color{blue}{{h}^{-0.5}}}{\sqrt{\ell}} \]
    8. Simplified59.5%

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification64.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4.7 \cdot 10^{+236}:\\ \;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\ \mathbf{elif}\;d \leq -5.4 \cdot 10^{-304}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]

Alternative 20: 52.8% accurate, 2.5× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\\ \mathbf{if}\;\ell \leq -2.8 \cdot 10^{+119}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\ \mathbf{elif}\;\ell \leq -3.2 \cdot 10^{-134}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - t_0\right)\\ \mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-166}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + t_0\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M M) (/ l h))))))
   (if (<= l -2.8e+119)
     (* (sqrt (/ (/ 1.0 l) h)) (- d))
     (if (<= l -3.2e-134)
       (* (* d (sqrt (/ 1.0 (* h l)))) (- -1.0 t_0))
       (if (<= l 1.5e-166)
         (* (sqrt (* (/ d h) (/ d l))) (+ 1.0 t_0))
         (* d (/ 1.0 (sqrt (* h l)))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = -0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h)));
	double tmp;
	if (l <= -2.8e+119) {
		tmp = sqrt(((1.0 / l) / h)) * -d;
	} else if (l <= -3.2e-134) {
		tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - t_0);
	} else if (l <= 1.5e-166) {
		tmp = sqrt(((d / h) * (d / l))) * (1.0 + t_0);
	} else {
		tmp = d * (1.0 / sqrt((h * l)));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * m) / (l / h)))
    if (l <= (-2.8d+119)) then
        tmp = sqrt(((1.0d0 / l) / h)) * -d
    else if (l <= (-3.2d-134)) then
        tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - t_0)
    else if (l <= 1.5d-166) then
        tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + t_0)
    else
        tmp = d * (1.0d0 / sqrt((h * l)))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = -0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h)));
	double tmp;
	if (l <= -2.8e+119) {
		tmp = Math.sqrt(((1.0 / l) / h)) * -d;
	} else if (l <= -3.2e-134) {
		tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - t_0);
	} else if (l <= 1.5e-166) {
		tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + t_0);
	} else {
		tmp = d * (1.0 / Math.sqrt((h * l)));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = -0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h)))
	tmp = 0
	if l <= -2.8e+119:
		tmp = math.sqrt(((1.0 / l) / h)) * -d
	elif l <= -3.2e-134:
		tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - t_0)
	elif l <= 1.5e-166:
		tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + t_0)
	else:
		tmp = d * (1.0 / math.sqrt((h * l)))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * M) / Float64(l / h))))
	tmp = 0.0
	if (l <= -2.8e+119)
		tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * Float64(-d));
	elseif (l <= -3.2e-134)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - t_0));
	elseif (l <= 1.5e-166)
		tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + t_0));
	else
		tmp = Float64(d * Float64(1.0 / sqrt(Float64(h * l))));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = -0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h)));
	tmp = 0.0;
	if (l <= -2.8e+119)
		tmp = sqrt(((1.0 / l) / h)) * -d;
	elseif (l <= -3.2e-134)
		tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - t_0);
	elseif (l <= 1.5e-166)
		tmp = sqrt(((d / h) * (d / l))) * (1.0 + t_0);
	else
		tmp = d * (1.0 / sqrt((h * l)));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.8e+119], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[l, -3.2e-134], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e-166], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\\
\mathbf{if}\;\ell \leq -2.8 \cdot 10^{+119}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\

\mathbf{elif}\;\ell \leq -3.2 \cdot 10^{-134}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - t_0\right)\\

\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-166}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + t_0\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -2.80000000000000013e119

    1. Initial program 55.2%

      \[\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) \]
    2. Applied egg-rr28.7%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def46.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p50.5%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified50.5%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 64.0%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg64.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in64.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative64.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified64.0%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 41.7%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac38.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative38.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*38.9%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow238.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow238.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac47.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*47.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow247.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified47.3%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    11. Taylor expanded in D around 0 67.4%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    12. Step-by-step derivation
      1. associate-/l/67.4%

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}}\right) \]
      2. unpow-167.4%

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{\color{blue}{{h}^{-1}}}{\ell}}\right) \]
      3. associate-*r*67.4%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{{h}^{-1}}{\ell}}} \]
      4. *-commutative67.4%

        \[\leadsto \color{blue}{\sqrt{\frac{{h}^{-1}}{\ell}} \cdot \left(-1 \cdot d\right)} \]
      5. mul-1-neg67.4%

        \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot \color{blue}{\left(-d\right)} \]
      6. unpow-167.4%

        \[\leadsto \sqrt{\frac{\color{blue}{\frac{1}{h}}}{\ell}} \cdot \left(-d\right) \]
      7. associate-/l/67.4%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \cdot \left(-d\right) \]
      8. associate-/r*67.4%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot \left(-d\right) \]
    13. Simplified67.4%

      \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)} \]

    if -2.80000000000000013e119 < l < -3.2000000000000001e-134

    1. Initial program 71.0%

      \[\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) \]
    2. Applied egg-rr14.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def21.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p49.5%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified49.5%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 76.9%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg76.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in76.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative76.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified76.9%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 56.5%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac55.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative55.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*55.0%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow255.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow255.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac63.5%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*66.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow266.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified66.8%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]

    if -3.2000000000000001e-134 < l < 1.5000000000000001e-166

    1. Initial program 76.3%

      \[\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) \]
    2. Applied egg-rr23.7%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def26.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p71.9%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified71.9%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in h around 0 46.7%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \]
    6. Step-by-step derivation
      1. times-frac30.5%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative30.5%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*30.5%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow230.5%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow230.5%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac43.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*39.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow239.9%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    7. Simplified65.3%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \]

    if 1.5000000000000001e-166 < l

    1. Initial program 63.8%

      \[\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) \]
    2. Taylor expanded in d around inf 56.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. sqrt-div56.0%

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}} \cdot d \]
      2. *-commutative56.0%

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\color{blue}{h \cdot \ell}}} \cdot d \]
      3. metadata-eval56.0%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \cdot d \]
    4. Applied egg-rr56.0%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{h \cdot \ell}}} \cdot d \]
  3. Recombined 4 regimes into one program.
  4. Final simplification62.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.8 \cdot 10^{+119}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\ \mathbf{elif}\;\ell \leq -3.2 \cdot 10^{-134}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-166}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\ \end{array} \]

Alternative 21: 49.0% accurate, 2.5× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2.4 \cdot 10^{+67}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\ \mathbf{elif}\;\ell \leq 2.7 \cdot 10^{-167}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -2.4e+67)
   (* (sqrt (/ (/ 1.0 l) h)) (- d))
   (if (<= l 2.7e-167)
     (*
      (sqrt (* (/ d h) (/ d l)))
      (+ 1.0 (* -0.5 (* (* 0.25 (* (/ D d) (/ D d))) (/ (* M M) (/ l h))))))
     (* d (/ 1.0 (sqrt (* h l)))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -2.4e+67) {
		tmp = sqrt(((1.0 / l) / h)) * -d;
	} else if (l <= 2.7e-167) {
		tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h)))));
	} else {
		tmp = d * (1.0 / sqrt((h * l)));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= (-2.4d+67)) then
        tmp = sqrt(((1.0d0 / l) / h)) * -d
    else if (l <= 2.7d-167) then
        tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((0.25d0 * ((d_1 / d) * (d_1 / d))) * ((m * m) / (l / h)))))
    else
        tmp = d * (1.0d0 / sqrt((h * l)))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -2.4e+67) {
		tmp = Math.sqrt(((1.0 / l) / h)) * -d;
	} else if (l <= 2.7e-167) {
		tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h)))));
	} else {
		tmp = d * (1.0 / Math.sqrt((h * l)));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if l <= -2.4e+67:
		tmp = math.sqrt(((1.0 / l) / h)) * -d
	elif l <= 2.7e-167:
		tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h)))))
	else:
		tmp = d * (1.0 / math.sqrt((h * l)))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -2.4e+67)
		tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * Float64(-d));
	elseif (l <= 2.7e-167)
		tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(0.25 * Float64(Float64(D / d) * Float64(D / d))) * Float64(Float64(M * M) / Float64(l / h))))));
	else
		tmp = Float64(d * Float64(1.0 / sqrt(Float64(h * l))));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -2.4e+67)
		tmp = sqrt(((1.0 / l) / h)) * -d;
	elseif (l <= 2.7e-167)
		tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((0.25 * ((D / d) * (D / d))) * ((M * M) / (l / h)))));
	else
		tmp = d * (1.0 / sqrt((h * l)));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.4e+67], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[l, 2.7e-167], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{+67}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\

\mathbf{elif}\;\ell \leq 2.7 \cdot 10^{-167}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -2.40000000000000002e67

    1. Initial program 59.5%

      \[\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) \]
    2. Applied egg-rr25.7%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def38.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p44.0%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified44.0%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 67.4%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg67.4%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in67.4%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative67.4%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified67.4%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 47.1%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac45.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative45.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*45.1%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow245.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow245.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac53.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*55.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow255.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified55.2%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    11. Taylor expanded in D around 0 63.9%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    12. Step-by-step derivation
      1. associate-/l/63.9%

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}}\right) \]
      2. unpow-163.9%

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{\color{blue}{{h}^{-1}}}{\ell}}\right) \]
      3. associate-*r*63.9%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{{h}^{-1}}{\ell}}} \]
      4. *-commutative63.9%

        \[\leadsto \color{blue}{\sqrt{\frac{{h}^{-1}}{\ell}} \cdot \left(-1 \cdot d\right)} \]
      5. mul-1-neg63.9%

        \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot \color{blue}{\left(-d\right)} \]
      6. unpow-163.9%

        \[\leadsto \sqrt{\frac{\color{blue}{\frac{1}{h}}}{\ell}} \cdot \left(-d\right) \]
      7. associate-/l/63.9%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \cdot \left(-d\right) \]
      8. associate-/r*63.9%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot \left(-d\right) \]
    13. Simplified63.9%

      \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)} \]

    if -2.40000000000000002e67 < l < 2.7000000000000001e-167

    1. Initial program 74.0%

      \[\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) \]
    2. Applied egg-rr19.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def24.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p65.3%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified65.3%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in h around 0 43.0%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \]
    6. Step-by-step derivation
      1. times-frac40.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative40.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*40.0%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow240.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow240.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac51.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*50.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow250.0%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    7. Simplified58.4%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \]

    if 2.7000000000000001e-167 < l

    1. Initial program 63.8%

      \[\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) \]
    2. Taylor expanded in d around inf 56.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. sqrt-div56.0%

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}} \cdot d \]
      2. *-commutative56.0%

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\color{blue}{h \cdot \ell}}} \cdot d \]
      3. metadata-eval56.0%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \cdot d \]
    4. Applied egg-rr56.0%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{h \cdot \ell}}} \cdot d \]
  3. Recombined 3 regimes into one program.
  4. Final simplification58.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.4 \cdot 10^{+67}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\ \mathbf{elif}\;\ell \leq 2.7 \cdot 10^{-167}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\ \end{array} \]

Alternative 22: 53.8% accurate, 2.5× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := 0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\\ \mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(t_0 \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;h \leq 3.6 \cdot 10^{+196}:\\ \;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(t_0 \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* 0.25 (* (/ D d) (/ D d)))))
   (if (<= h -2e-310)
     (*
      (* d (sqrt (/ 1.0 (* h l))))
      (- -1.0 (* -0.5 (* t_0 (/ (* M (* h M)) l)))))
     (if (<= h 3.6e+196)
       (* d (/ 1.0 (sqrt (* h l))))
       (*
        (sqrt (* (/ d h) (/ d l)))
        (+ 1.0 (* -0.5 (* t_0 (/ (* M M) (/ l h))))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = 0.25 * ((D / d) * (D / d));
	double tmp;
	if (h <= -2e-310) {
		tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * (t_0 * ((M * (h * M)) / l))));
	} else if (h <= 3.6e+196) {
		tmp = d * (1.0 / sqrt((h * l)));
	} else {
		tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (t_0 * ((M * M) / (l / h)))));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 0.25d0 * ((d_1 / d) * (d_1 / d))
    if (h <= (-2d-310)) then
        tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) - ((-0.5d0) * (t_0 * ((m * (h * m)) / l))))
    else if (h <= 3.6d+196) then
        tmp = d * (1.0d0 / sqrt((h * l)))
    else
        tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * (t_0 * ((m * m) / (l / h)))))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = 0.25 * ((D / d) * (D / d));
	double tmp;
	if (h <= -2e-310) {
		tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * (t_0 * ((M * (h * M)) / l))));
	} else if (h <= 3.6e+196) {
		tmp = d * (1.0 / Math.sqrt((h * l)));
	} else {
		tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (t_0 * ((M * M) / (l / h)))));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = 0.25 * ((D / d) * (D / d))
	tmp = 0
	if h <= -2e-310:
		tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * (t_0 * ((M * (h * M)) / l))))
	elif h <= 3.6e+196:
		tmp = d * (1.0 / math.sqrt((h * l)))
	else:
		tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (t_0 * ((M * M) / (l / h)))))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(0.25 * Float64(Float64(D / d) * Float64(D / d)))
	tmp = 0.0
	if (h <= -2e-310)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 - Float64(-0.5 * Float64(t_0 * Float64(Float64(M * Float64(h * M)) / l)))));
	elseif (h <= 3.6e+196)
		tmp = Float64(d * Float64(1.0 / sqrt(Float64(h * l))));
	else
		tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(t_0 * Float64(Float64(M * M) / Float64(l / h))))));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = 0.25 * ((D / d) * (D / d));
	tmp = 0.0;
	if (h <= -2e-310)
		tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 - (-0.5 * (t_0 * ((M * (h * M)) / l))));
	elseif (h <= 3.6e+196)
		tmp = d * (1.0 / sqrt((h * l)));
	else
		tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (t_0 * ((M * M) / (l / h)))));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(0.25 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(t$95$0 * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 3.6e+196], N[(d * N[(1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(t$95$0 * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\\
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(t_0 \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\

\mathbf{elif}\;h \leq 3.6 \cdot 10^{+196}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(t_0 \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if h < -1.999999999999994e-310

    1. Initial program 69.2%

      \[\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) \]
    2. Applied egg-rr21.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def30.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p57.9%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified57.9%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 73.7%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg73.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in73.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative73.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified73.7%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in h around 0 53.9%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    9. Step-by-step derivation
      1. times-frac51.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative51.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*51.6%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow251.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow251.6%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac64.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*64.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow264.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    10. Simplified64.2%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    11. Taylor expanded in M around 0 64.3%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2} \cdot h}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    12. Step-by-step derivation
      1. unpow264.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. associate-*l*67.2%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot \left(M \cdot h\right)}}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    13. Simplified67.2%

      \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{M \cdot \left(M \cdot h\right)}{\ell}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]

    if -1.999999999999994e-310 < h < 3.60000000000000007e196

    1. Initial program 66.2%

      \[\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) \]
    2. Taylor expanded in d around inf 60.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. sqrt-div60.3%

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}} \cdot d \]
      2. *-commutative60.3%

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\color{blue}{h \cdot \ell}}} \cdot d \]
      3. metadata-eval60.3%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \cdot d \]
    4. Applied egg-rr60.3%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{h \cdot \ell}}} \cdot d \]

    if 3.60000000000000007e196 < h

    1. Initial program 62.7%

      \[\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) \]
    2. Applied egg-rr18.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def32.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p52.2%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified52.2%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in h around 0 22.9%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}\right)}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \]
    6. Step-by-step derivation
      1. times-frac0.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{h \cdot {M}^{2}}{\ell}\right)}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      2. *-commutative0.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2}}{{d}^{2}} \cdot \frac{\color{blue}{{M}^{2} \cdot h}}{\ell}\right)\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      3. associate-*r*0.8%

        \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \frac{{D}^{2}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      4. unpow20.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      5. unpow20.8%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      6. times-frac1.1%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \cdot \frac{{M}^{2} \cdot h}{\ell}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      7. associate-/l*1.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \color{blue}{\frac{{M}^{2}}{\frac{\ell}{h}}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
      8. unpow21.3%

        \[\leadsto \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{\color{blue}{M \cdot M}}{\frac{\ell}{h}}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right) \]
    7. Simplified30.4%

      \[\leadsto \left(1 + -0.5 \cdot \color{blue}{\left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification60.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 - -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{\ell}\right)\right)\\ \mathbf{elif}\;h \leq 3.6 \cdot 10^{+196}:\\ \;\;\;\;d \cdot \frac{1}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\left(0.25 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \end{array} \]

Alternative 23: 42.6% accurate, 3.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -3.2 \cdot 10^{-212}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= d -3.2e-212)
   (* d (- (pow (* h l) -0.5)))
   (* d (sqrt (/ (/ 1.0 l) h)))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -3.2e-212) {
		tmp = d * -pow((h * l), -0.5);
	} else {
		tmp = d * sqrt(((1.0 / l) / h));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d <= (-3.2d-212)) then
        tmp = d * -((h * l) ** (-0.5d0))
    else
        tmp = d * sqrt(((1.0d0 / l) / h))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -3.2e-212) {
		tmp = d * -Math.pow((h * l), -0.5);
	} else {
		tmp = d * Math.sqrt(((1.0 / l) / h));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if d <= -3.2e-212:
		tmp = d * -math.pow((h * l), -0.5)
	else:
		tmp = d * math.sqrt(((1.0 / l) / h))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= -3.2e-212)
		tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5)));
	else
		tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (d <= -3.2e-212)
		tmp = d * -((h * l) ^ -0.5);
	else
		tmp = d * sqrt(((1.0 / l) / h));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -3.2e-212], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3.2 \cdot 10^{-212}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -3.1999999999999999e-212

    1. Initial program 75.0%

      \[\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) \]
    2. Applied egg-rr25.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)} - 1} \]
    3. Step-by-step derivation
      1. expm1-def36.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p63.8%

        \[\leadsto \color{blue}{\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    4. Simplified63.8%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    5. Taylor expanded in d around -inf 78.7%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg78.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
      2. distribute-rgt-neg-in78.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      3. *-commutative78.7%

        \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right)\right) \]
    7. Simplified78.7%

      \[\leadsto \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}\right)\right) \cdot \color{blue}{\left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \]
    8. Taylor expanded in D around 0 52.0%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    9. Step-by-step derivation
      1. associate-/l/52.0%

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}}\right) \]
      2. associate-*r*52.0%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
      3. *-commutative52.0%

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-1 \cdot d\right)} \]
      4. mul-1-neg52.0%

        \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \color{blue}{\left(-d\right)} \]
      5. associate-/l/52.0%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \cdot \left(-d\right) \]
      6. *-commutative52.0%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \cdot \left(-d\right) \]
      7. unpow-152.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot \left(-d\right) \]
      8. sqr-pow52.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}} \cdot \left(-d\right) \]
      9. rem-sqrt-square52.3%

        \[\leadsto \color{blue}{\left|{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}\right|} \cdot \left(-d\right) \]
      10. metadata-eval52.3%

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot \left(-d\right) \]
      11. sqr-pow52.3%

        \[\leadsto \left|\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)}}\right| \cdot \left(-d\right) \]
      12. fabs-sqr52.3%

        \[\leadsto \color{blue}{\left({\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)}\right)} \cdot \left(-d\right) \]
      13. sqr-pow52.3%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \left(-d\right) \]
    10. Simplified52.3%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot \left(-d\right)} \]

    if -3.1999999999999999e-212 < d

    1. Initial program 62.3%

      \[\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) \]
    2. Taylor expanded in d around inf 45.5%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. associate-/l/45.5%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot d \]
      2. add-cbrt-cube34.9%

        \[\leadsto \sqrt{\color{blue}{\sqrt[3]{\left(\frac{\frac{1}{h}}{\ell} \cdot \frac{\frac{1}{h}}{\ell}\right) \cdot \frac{\frac{1}{h}}{\ell}}}} \cdot d \]
    4. Applied egg-rr34.9%

      \[\leadsto \sqrt{\color{blue}{\sqrt[3]{\left(\frac{\frac{1}{h}}{\ell} \cdot \frac{\frac{1}{h}}{\ell}\right) \cdot \frac{\frac{1}{h}}{\ell}}}} \cdot d \]
    5. Taylor expanded in h around 0 45.5%

      \[\leadsto \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \cdot d \]
    6. Step-by-step derivation
      1. associate-/r*45.6%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot d \]
    7. Simplified45.6%

      \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot d \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -3.2 \cdot 10^{-212}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \]

Alternative 24: 25.9% accurate, 3.1× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D) :precision binary64 (* d (sqrt (/ (/ 1.0 h) l))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	return d * sqrt(((1.0 / h) / l));
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = d * sqrt(((1.0d0 / h) / l))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	return d * Math.sqrt(((1.0 / h) / l));
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	return d * math.sqrt(((1.0 / h) / l))
M, D = sort([M, D])
function code(d, h, l, M, D)
	return Float64(d * sqrt(Float64(Float64(1.0 / h) / l)))
end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
	tmp = d * sqrt(((1.0 / h) / l));
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}
\end{array}
Derivation
  1. Initial program 67.3%

    \[\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) \]
  2. Taylor expanded in d around inf 30.8%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  3. Step-by-step derivation
    1. *-commutative30.8%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    2. *-commutative30.8%

      \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
    3. associate-/r*30.8%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
  4. Simplified30.8%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}} \]
  5. Final simplification30.8%

    \[\leadsto d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}} \]

Alternative 25: 25.9% accurate, 3.1× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D) :precision binary64 (* d (sqrt (/ (/ 1.0 l) h))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	return d * sqrt(((1.0 / l) / h));
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = d * sqrt(((1.0d0 / l) / h))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	return d * Math.sqrt(((1.0 / l) / h));
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	return d * math.sqrt(((1.0 / l) / h))
M, D = sort([M, D])
function code(d, h, l, M, D)
	return Float64(d * sqrt(Float64(Float64(1.0 / l) / h)))
end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
	tmp = d * sqrt(((1.0 / l) / h));
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}
\end{array}
Derivation
  1. Initial program 67.3%

    \[\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) \]
  2. Taylor expanded in d around inf 30.8%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  3. Step-by-step derivation
    1. associate-/l/30.8%

      \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot d \]
    2. add-cbrt-cube26.6%

      \[\leadsto \sqrt{\color{blue}{\sqrt[3]{\left(\frac{\frac{1}{h}}{\ell} \cdot \frac{\frac{1}{h}}{\ell}\right) \cdot \frac{\frac{1}{h}}{\ell}}}} \cdot d \]
  4. Applied egg-rr26.6%

    \[\leadsto \sqrt{\color{blue}{\sqrt[3]{\left(\frac{\frac{1}{h}}{\ell} \cdot \frac{\frac{1}{h}}{\ell}\right) \cdot \frac{\frac{1}{h}}{\ell}}}} \cdot d \]
  5. Taylor expanded in h around 0 30.8%

    \[\leadsto \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \cdot d \]
  6. Step-by-step derivation
    1. associate-/r*30.8%

      \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot d \]
  7. Simplified30.8%

    \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot d \]
  8. Final simplification30.8%

    \[\leadsto d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}} \]

Alternative 26: 25.7% accurate, 3.1× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ d \cdot {\left(h \cdot \ell\right)}^{-0.5} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D) :precision binary64 (* d (pow (* h l) -0.5)))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	return d * pow((h * l), -0.5);
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = d * ((h * l) ** (-0.5d0))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	return d * Math.pow((h * l), -0.5);
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	return d * math.pow((h * l), -0.5)
M, D = sort([M, D])
function code(d, h, l, M, D)
	return Float64(d * (Float64(h * l) ^ -0.5))
end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
	tmp = d * ((h * l) ^ -0.5);
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 67.3%

    \[\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) \]
  2. Taylor expanded in d around inf 30.8%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  3. Step-by-step derivation
    1. associate-/l/30.8%

      \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot d \]
    2. *-un-lft-identity30.8%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\right)} \cdot d \]
  4. Applied egg-rr30.8%

    \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\right)} \cdot d \]
  5. Step-by-step derivation
    1. *-lft-identity30.8%

      \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{h}}{\ell}}} \cdot d \]
    2. associate-/l/30.8%

      \[\leadsto \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \cdot d \]
    3. *-commutative30.8%

      \[\leadsto \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \cdot d \]
    4. unpow-130.8%

      \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
    5. sqr-pow30.8%

      \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}} \cdot d \]
    6. rem-sqrt-square30.0%

      \[\leadsto \color{blue}{\left|{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}\right|} \cdot d \]
    7. metadata-eval30.0%

      \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
    8. sqr-pow29.9%

      \[\leadsto \left|\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)}}\right| \cdot d \]
    9. fabs-sqr29.9%

      \[\leadsto \color{blue}{\left({\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-0.5}{2}\right)}\right)} \cdot d \]
    10. sqr-pow30.0%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
  6. Simplified30.0%

    \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
  7. Final simplification30.0%

    \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{-0.5} \]

Reproduce

?
herbie shell --seed 2023189 
(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)))))