Henrywood and Agarwal, Equation (12)

Percentage Accurate: 67.7% → 78.1%
Time: 32.9s
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.7% 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: 78.1% accurate, 0.8× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \sqrt{-d}\\ \mathbf{if}\;\ell \leq -8.4 \cdot 10^{+37}:\\ \;\;\;\;\frac{t_1}{\sqrt{-h}} \cdot \left(\frac{t_1}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 2.6 \cdot 10^{-266}:\\ \;\;\;\;\left(t_0 \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot t_0\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 l))) (t_1 (sqrt (- d))))
   (if (<= l -8.4e+37)
     (*
      (/ t_1 (sqrt (- h)))
      (*
       (/ t_1 (sqrt (- l)))
       (- 1.0 (* 0.5 (* 0.25 (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d))))))))
     (if (<= l 2.6e-266)
       (*
        (* t_0 (sqrt (/ d h)))
        (- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
       (if (<= l 4.6e+116)
         (*
          (/ (sqrt d) (sqrt h))
          (* (- 1.0 (* 0.5 (* (pow (/ (/ (* M D) 2.0) d) 2.0) (/ h l)))) t_0))
         (* d (* (pow l -0.5) (pow h -0.5))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double t_1 = sqrt(-d);
	double tmp;
	if (l <= -8.4e+37) {
		tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d)))))));
	} else if (l <= 2.6e-266) {
		tmp = (t_0 * sqrt((d / h))) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
	} else if (l <= 4.6e+116) {
		tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (0.5 * (pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * t_0);
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 / l))
    t_1 = sqrt(-d)
    if (l <= (-8.4d+37)) then
        tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * (1.0d0 - (0.5d0 * (0.25d0 * ((d_1 / (((d / m) / m) / d_1)) * (h / (l * d)))))))
    else if (l <= 2.6d-266) then
        tmp = (t_0 * sqrt((d / h))) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
    else if (l <= 4.6d+116) then
        tmp = (sqrt(d) / sqrt(h)) * ((1.0d0 - (0.5d0 * (((((m * d_1) / 2.0d0) / d) ** 2.0d0) * (h / l)))) * t_0)
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / l));
	double t_1 = Math.sqrt(-d);
	double tmp;
	if (l <= -8.4e+37) {
		tmp = (t_1 / Math.sqrt(-h)) * ((t_1 / Math.sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d)))))));
	} else if (l <= 2.6e-266) {
		tmp = (t_0 * Math.sqrt((d / h))) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
	} else if (l <= 4.6e+116) {
		tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((1.0 - (0.5 * (Math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * t_0);
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / l))
	t_1 = math.sqrt(-d)
	tmp = 0
	if l <= -8.4e+37:
		tmp = (t_1 / math.sqrt(-h)) * ((t_1 / math.sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d)))))))
	elif l <= 2.6e-266:
		tmp = (t_0 * math.sqrt((d / h))) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l))
	elif l <= 4.6e+116:
		tmp = (math.sqrt(d) / math.sqrt(h)) * ((1.0 - (0.5 * (math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * t_0)
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = sqrt(Float64(-d))
	tmp = 0.0
	if (l <= -8.4e+37)
		tmp = Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(Float64(t_1 / sqrt(Float64(-l))) * Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d))))))));
	elseif (l <= 2.6e-266)
		tmp = Float64(Float64(t_0 * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l)));
	elseif (l <= 4.6e+116)
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0) * Float64(h / l)))) * t_0));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / l));
	t_1 = sqrt(-d);
	tmp = 0.0;
	if (l <= -8.4e+37)
		tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d)))))));
	elseif (l <= 2.6e-266)
		tmp = (t_0 * sqrt((d / h))) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
	elseif (l <= 4.6e+116)
		tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (0.5 * (((((M * D) / 2.0) / d) ^ 2.0) * (h / l)))) * t_0);
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -8.4e+37], N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(0.25 * N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.6e-266], N[(N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -8.4 \cdot 10^{+37}:\\
\;\;\;\;\frac{t_1}{\sqrt{-h}} \cdot \left(\frac{t_1}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right)\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -8.4000000000000004e37

    1. Initial program 51.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*51.5%

        \[\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-eval51.5%

        \[\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/251.5%

        \[\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-eval51.5%

        \[\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/251.5%

        \[\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*51.5%

        \[\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-eval51.5%

        \[\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-frac51.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. Simplified51.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. Step-by-step derivation
      1. frac-2neg51.6%

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    6. Step-by-step derivation
      1. frac-times63.3%

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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. *-commutative33.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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/33.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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. associate-*r*33.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.4000000000000004e37 < l < 2.6e-266

    1. Initial program 81.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. Step-by-step derivation
      1. metadata-eval81.4%

        \[\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/281.4%

        \[\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-eval81.4%

        \[\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/281.4%

        \[\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. *-commutative81.4%

        \[\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*81.4%

        \[\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-frac78.4%

        \[\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-eval78.4%

        \[\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. Simplified78.4%

      \[\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. associate-*r*78.4%

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

        \[\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) \]
      3. *-commutative81.4%

        \[\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) \]
      4. metadata-eval81.4%

        \[\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) \]
      5. associate-*r/85.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) \]
      6. metadata-eval85.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) \]
      7. *-commutative85.1%

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

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

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

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

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

    if 2.6e-266 < l < 4.5999999999999999e116

    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. Step-by-step derivation
      1. associate-*l*75.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-eval75.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/275.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-eval75.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/275.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*75.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-eval75.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-frac72.9%

        \[\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. Simplified72.9%

      \[\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. frac-times0.0%

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

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

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

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

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

    if 4.5999999999999999e116 < l

    1. Initial program 53.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 60.0%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 4 regimes into one program.
  4. Final simplification78.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -8.4 \cdot 10^{+37}:\\ \;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 2.6 \cdot 10^{-266}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 2: 70.3% accurate, 0.3× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\ \mathbf{if}\;t_0 \leq -1 \cdot 10^{-107}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{-273}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+234}:\\ \;\;\;\;\left(\left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 h) 0.5) (pow (/ d l) 0.5))
          (- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0)))))))
   (if (<= t_0 -1e-107)
     t_0
     (if (<= t_0 5e-273)
       (*
        (- 1.0 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l))))
        (* d (pow (* l h) -0.5)))
       (if (<= t_0 2e+234)
         (*
          (*
           (- 1.0 (* 0.5 (* (pow (/ (/ (* M D) 2.0) d) 2.0) (/ h l))))
           (sqrt (/ d l)))
          (sqrt (/ d h)))
         (* d (* (pow l -0.5) (pow h -0.5))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
	double tmp;
	if (t_0 <= -1e-107) {
		tmp = t_0;
	} else if (t_0 <= 5e-273) {
		tmp = (1.0 - (pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * pow((l * h), -0.5));
	} else if (t_0 <= 2e+234) {
		tmp = ((1.0 - (0.5 * (pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * sqrt((d / l))) * sqrt((d / h));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))
    if (t_0 <= (-1d-107)) then
        tmp = t_0
    else if (t_0 <= 5d-273) then
        tmp = (1.0d0 - ((((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l)))) * (d * ((l * h) ** (-0.5d0)))
    else if (t_0 <= 2d+234) then
        tmp = ((1.0d0 - (0.5d0 * (((((m * d_1) / 2.0d0) / d) ** 2.0d0) * (h / l)))) * sqrt((d / l))) * sqrt((d / h))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
	double tmp;
	if (t_0 <= -1e-107) {
		tmp = t_0;
	} else if (t_0 <= 5e-273) {
		tmp = (1.0 - (Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * Math.pow((l * h), -0.5));
	} else if (t_0 <= 2e+234) {
		tmp = ((1.0 - (0.5 * (Math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * Math.sqrt((d / l))) * Math.sqrt((d / h));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0))))
	tmp = 0
	if t_0 <= -1e-107:
		tmp = t_0
	elif t_0 <= 5e-273:
		tmp = (1.0 - (math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * math.pow((l * h), -0.5))
	elif t_0 <= 2e+234:
		tmp = ((1.0 - (0.5 * (math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * math.sqrt((d / l))) * math.sqrt((d / h))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))))
	tmp = 0.0
	if (t_0 <= -1e-107)
		tmp = t_0;
	elseif (t_0 <= 5e-273)
		tmp = Float64(Float64(1.0 - Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l)))) * Float64(d * (Float64(l * h) ^ -0.5)));
	elseif (t_0 <= 2e+234)
		tmp = Float64(Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0) * Float64(h / l)))) * sqrt(Float64(d / l))) * sqrt(Float64(d / h)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0))));
	tmp = 0.0;
	if (t_0 <= -1e-107)
		tmp = t_0;
	elseif (t_0 <= 5e-273)
		tmp = (1.0 - ((((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l)))) * (d * ((l * h) ^ -0.5));
	elseif (t_0 <= 2e+234)
		tmp = ((1.0 - (0.5 * (((((M * D) / 2.0) / d) ^ 2.0) * (h / l)))) * sqrt((d / l))) * sqrt((d / h));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-107], t$95$0, If[LessEqual[t$95$0, 5e-273], N[(N[(1.0 - N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+234], N[(N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{-107}:\\
\;\;\;\;t_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -1e-107

    1. Initial program 87.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) \]

    if -1e-107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 4.99999999999999965e-273

    1. Initial program 28.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. expm1-log1p-u28.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef25.7%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr25.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot \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|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      8. fabs-sqr58.1%

        \[\leadsto \left(d \cdot \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)}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      9. sqr-pow58.2%

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

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

    if 4.99999999999999965e-273 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 2.00000000000000004e234

    1. Initial program 99.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. associate-*l*99.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-eval99.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/299.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-eval99.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/299.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*99.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-eval99.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-frac98.0%

        \[\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. Simplified98.0%

      \[\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. frac-times46.3%

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

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

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

    if 2.00000000000000004e234 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l))))

    1. Initial program 18.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 37.5%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative37.5%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr37.5%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity37.5%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-137.5%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow37.5%

        \[\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 \]
      4. rem-sqrt-square37.5%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow37.4%

        \[\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 \]
      7. fabs-sqr37.4%

        \[\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 \]
      8. sqr-pow37.5%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified37.5%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative37.5%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down39.4%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr39.4%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 4 regimes into one program.
  4. Final simplification76.7%

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

Alternative 3: 80.3% accurate, 0.6× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := 1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\\ t_1 := \sqrt{-d}\\ \mathbf{if}\;\ell \leq -1.2 \cdot 10^{-301}:\\ \;\;\;\;\frac{t_1}{\sqrt{-h}} \cdot \left(\frac{t_1}{\sqrt{-\ell}} \cdot t_0\right)\\ \mathbf{elif}\;\ell \leq 4.2 \cdot 10^{+116}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_0 \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (- 1.0 (* 0.5 (* (pow (/ (/ (* M D) 2.0) d) 2.0) (/ h l)))))
        (t_1 (sqrt (- d))))
   (if (<= l -1.2e-301)
     (* (/ t_1 (sqrt (- h))) (* (/ t_1 (sqrt (- l))) t_0))
     (if (<= l 4.2e+116)
       (* (/ (sqrt d) (sqrt h)) (* t_0 (sqrt (/ d l))))
       (* d (* (pow l -0.5) (pow h -0.5)))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = 1.0 - (0.5 * (pow((((M * D) / 2.0) / d), 2.0) * (h / l)));
	double t_1 = sqrt(-d);
	double tmp;
	if (l <= -1.2e-301) {
		tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * t_0);
	} else if (l <= 4.2e+116) {
		tmp = (sqrt(d) / sqrt(h)) * (t_0 * sqrt((d / l)));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 1.0d0 - (0.5d0 * (((((m * d_1) / 2.0d0) / d) ** 2.0d0) * (h / l)))
    t_1 = sqrt(-d)
    if (l <= (-1.2d-301)) then
        tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * t_0)
    else if (l <= 4.2d+116) then
        tmp = (sqrt(d) / sqrt(h)) * (t_0 * sqrt((d / l)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = 1.0 - (0.5 * (Math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)));
	double t_1 = Math.sqrt(-d);
	double tmp;
	if (l <= -1.2e-301) {
		tmp = (t_1 / Math.sqrt(-h)) * ((t_1 / Math.sqrt(-l)) * t_0);
	} else if (l <= 4.2e+116) {
		tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * Math.sqrt((d / l)));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = 1.0 - (0.5 * (math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))
	t_1 = math.sqrt(-d)
	tmp = 0
	if l <= -1.2e-301:
		tmp = (t_1 / math.sqrt(-h)) * ((t_1 / math.sqrt(-l)) * t_0)
	elif l <= 4.2e+116:
		tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * math.sqrt((d / l)))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0) * Float64(h / l))))
	t_1 = sqrt(Float64(-d))
	tmp = 0.0
	if (l <= -1.2e-301)
		tmp = Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(Float64(t_1 / sqrt(Float64(-l))) * t_0));
	elseif (l <= 4.2e+116)
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * sqrt(Float64(d / l))));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = 1.0 - (0.5 * (((((M * D) / 2.0) / d) ^ 2.0) * (h / l)));
	t_1 = sqrt(-d);
	tmp = 0.0;
	if (l <= -1.2e-301)
		tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * t_0);
	elseif (l <= 4.2e+116)
		tmp = (sqrt(d) / sqrt(h)) * (t_0 * sqrt((d / l)));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(1.0 - N[(0.5 * N[(N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -1.2e-301], N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.2e+116], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{-301}:\\
\;\;\;\;\frac{t_1}{\sqrt{-h}} \cdot \left(\frac{t_1}{\sqrt{-\ell}} \cdot t_0\right)\\

\mathbf{elif}\;\ell \leq 4.2 \cdot 10^{+116}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_0 \cdot \sqrt{\frac{d}{\ell}}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -1.19999999999999996e-301

    1. Initial program 72.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. associate-*l*71.3%

        \[\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-eval71.3%

        \[\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/271.3%

        \[\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-eval71.3%

        \[\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/271.3%

        \[\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*70.5%

        \[\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-eval70.5%

        \[\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-frac68.5%

        \[\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. Simplified68.5%

      \[\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. frac-2neg68.5%

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

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

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

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

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

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

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

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

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

    if -1.19999999999999996e-301 < l < 4.2000000000000002e116

    1. Initial program 72.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. associate-*l*72.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-eval72.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/272.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-eval72.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/272.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*72.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-eval72.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-frac70.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. Simplified70.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. frac-times0.0%

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

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

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

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

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

    if 4.2000000000000002e116 < l

    1. Initial program 53.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 60.0%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

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

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

Alternative 4: 73.6% accurate, 0.8× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := 1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\\ t_1 := \frac{\sqrt[3]{h}}{\ell}\\ t_2 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;d \leq -4 \cdot 10^{-311}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t_0\right) \cdot t_2\\ \mathbf{elif}\;d \leq 3.9 \cdot 10^{-224}:\\ \;\;\;\;\left(\left|t_1\right| \cdot \sqrt{t_1}\right) \cdot \frac{-0.125}{\frac{d}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}}\\ \mathbf{elif}\;d \leq 1.15 \cdot 10^{+95}:\\ \;\;\;\;t_2 \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\ \mathbf{elif}\;d \leq 1.7 \cdot 10^{+147} \lor \neg \left(d \leq 5.2 \cdot 10^{+202}\right):\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;t_2 \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot {\left(\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (- 1.0 (* 0.5 (* (pow (/ (/ (* M D) 2.0) d) 2.0) (/ h l)))))
        (t_1 (/ (cbrt h) l))
        (t_2 (sqrt (/ d h))))
   (if (<= d -4e-311)
     (* (* (/ (sqrt (- d)) (sqrt (- l))) t_0) t_2)
     (if (<= d 3.9e-224)
       (* (* (fabs t_1) (sqrt t_1)) (/ -0.125 (/ d (* (* M D) (* M D)))))
       (if (<= d 1.15e+95)
         (* t_2 (* t_0 (/ (sqrt d) (sqrt l))))
         (if (or (<= d 1.7e+147) (not (<= d 5.2e+202)))
           (* d (* (pow l -0.5) (pow h -0.5)))
           (*
            t_2
            (*
             (sqrt (/ d l))
             (-
              1.0
              (*
               0.5
               (pow (* (* (* 0.5 M) (/ D d)) (sqrt (/ h l))) 2.0)))))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = 1.0 - (0.5 * (pow((((M * D) / 2.0) / d), 2.0) * (h / l)));
	double t_1 = cbrt(h) / l;
	double t_2 = sqrt((d / h));
	double tmp;
	if (d <= -4e-311) {
		tmp = ((sqrt(-d) / sqrt(-l)) * t_0) * t_2;
	} else if (d <= 3.9e-224) {
		tmp = (fabs(t_1) * sqrt(t_1)) * (-0.125 / (d / ((M * D) * (M * D))));
	} else if (d <= 1.15e+95) {
		tmp = t_2 * (t_0 * (sqrt(d) / sqrt(l)));
	} else if ((d <= 1.7e+147) || !(d <= 5.2e+202)) {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	} else {
		tmp = t_2 * (sqrt((d / l)) * (1.0 - (0.5 * pow((((0.5 * M) * (D / d)) * sqrt((h / l))), 2.0))));
	}
	return tmp;
}
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = 1.0 - (0.5 * (Math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)));
	double t_1 = Math.cbrt(h) / l;
	double t_2 = Math.sqrt((d / h));
	double tmp;
	if (d <= -4e-311) {
		tmp = ((Math.sqrt(-d) / Math.sqrt(-l)) * t_0) * t_2;
	} else if (d <= 3.9e-224) {
		tmp = (Math.abs(t_1) * Math.sqrt(t_1)) * (-0.125 / (d / ((M * D) * (M * D))));
	} else if (d <= 1.15e+95) {
		tmp = t_2 * (t_0 * (Math.sqrt(d) / Math.sqrt(l)));
	} else if ((d <= 1.7e+147) || !(d <= 5.2e+202)) {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	} else {
		tmp = t_2 * (Math.sqrt((d / l)) * (1.0 - (0.5 * Math.pow((((0.5 * M) * (D / d)) * Math.sqrt((h / l))), 2.0))));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0) * Float64(h / l))))
	t_1 = Float64(cbrt(h) / l)
	t_2 = sqrt(Float64(d / h))
	tmp = 0.0
	if (d <= -4e-311)
		tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * t_0) * t_2);
	elseif (d <= 3.9e-224)
		tmp = Float64(Float64(abs(t_1) * sqrt(t_1)) * Float64(-0.125 / Float64(d / Float64(Float64(M * D) * Float64(M * D)))));
	elseif (d <= 1.15e+95)
		tmp = Float64(t_2 * Float64(t_0 * Float64(sqrt(d) / sqrt(l))));
	elseif ((d <= 1.7e+147) || !(d <= 5.2e+202))
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	else
		tmp = Float64(t_2 * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(0.5 * M) * Float64(D / d)) * sqrt(Float64(h / l))) ^ 2.0)))));
	end
	return tmp
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(1.0 - N[(0.5 * N[(N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[h, 1/3], $MachinePrecision] / l), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -4e-311], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[d, 3.9e-224], N[(N[(N[Abs[t$95$1], $MachinePrecision] * N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision] * N[(-0.125 / N[(d / N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e+95], N[(t$95$2 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 1.7e+147], N[Not[LessEqual[d, 5.2e+202]], $MachinePrecision]], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{\sqrt[3]{h}}{\ell}\\
t_2 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;d \leq -4 \cdot 10^{-311}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t_0\right) \cdot t_2\\

\mathbf{elif}\;d \leq 3.9 \cdot 10^{-224}:\\
\;\;\;\;\left(\left|t_1\right| \cdot \sqrt{t_1}\right) \cdot \frac{-0.125}{\frac{d}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}}\\

\mathbf{elif}\;d \leq 1.15 \cdot 10^{+95}:\\
\;\;\;\;t_2 \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\

\mathbf{elif}\;d \leq 1.7 \cdot 10^{+147} \lor \neg \left(d \leq 5.2 \cdot 10^{+202}\right):\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -3.99999999999979e-311

    1. Initial program 71.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. associate-*l*70.7%

        \[\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-eval70.7%

        \[\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/270.7%

        \[\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-eval70.7%

        \[\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/270.7%

        \[\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*70.0%

        \[\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-eval70.0%

        \[\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-frac67.9%

        \[\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. Simplified67.9%

      \[\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. frac-2neg67.9%

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    6. Step-by-step derivation
      1. frac-times74.8%

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

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

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

    if -3.99999999999979e-311 < d < 3.8999999999999998e-224

    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. Step-by-step derivation
      1. metadata-eval29.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/229.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-eval29.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/229.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. *-commutative29.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*29.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-frac29.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-eval29.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. Simplified29.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. associate-*r*29.9%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. frac-times29.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) \]
      3. *-commutative29.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) \]
      4. metadata-eval29.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) \]
      5. add-sqr-sqrt29.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.25 \cdot \frac{\color{blue}{\sqrt{0.5} \cdot \sqrt{0.5}}}{\frac{d}{{D}^{2} \cdot {M}^{2}}}\right) \]
      5. rem-square-sqrt36.4%

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

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\frac{-0.25 \cdot 0.5}{\frac{d}{{D}^{2} \cdot {M}^{2}}}} \]
      7. metadata-eval36.4%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{-0.125}}{\frac{d}{{D}^{2} \cdot {M}^{2}}} \]
      8. unpow236.4%

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

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

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

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

        \[\leadsto \color{blue}{{\left(\frac{h}{{\ell}^{3}}\right)}^{0.5}} \cdot \frac{-0.125}{\frac{d}{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}} \]
      2. add-cube-cbrt47.0%

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

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

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

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

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

        \[\leadsto \left({\left({\left(\frac{\sqrt[3]{h}}{\sqrt[3]{\color{blue}{\left(\ell \cdot \ell\right) \cdot \ell}}}\right)}^{2}\right)}^{\left(\sqrt{0.25}\right)} \cdot {\left(\sqrt[3]{\frac{h}{{\ell}^{3}}}\right)}^{\left(\sqrt{0.25}\right)}\right) \cdot \frac{-0.125}{\frac{d}{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}} \]
      8. add-cbrt-cube47.0%

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

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

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

        \[\leadsto \left({\left({\left(\frac{\sqrt[3]{h}}{\ell}\right)}^{2}\right)}^{0.5} \cdot {\left(\frac{\sqrt[3]{h}}{\sqrt[3]{\color{blue}{\left(\ell \cdot \ell\right) \cdot \ell}}}\right)}^{\left(\sqrt{0.25}\right)}\right) \cdot \frac{-0.125}{\frac{d}{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}} \]
      12. add-cbrt-cube57.7%

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

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

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

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

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

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

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

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

    if 3.8999999999999998e-224 < d < 1.14999999999999999e95

    1. Initial program 80.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. associate-*l*80.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-eval80.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/280.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-eval80.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/280.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*80.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-eval80.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-frac76.1%

        \[\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. Simplified76.1%

      \[\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. frac-times0.0%

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

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

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

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

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

    if 1.14999999999999999e95 < d < 1.7e147 or 5.2000000000000004e202 < d

    1. Initial program 57.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 87.5%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative87.5%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr87.5%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity87.5%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-187.5%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow87.5%

        \[\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 \]
      4. rem-sqrt-square87.5%

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

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

        \[\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 \]
      7. fabs-sqr87.2%

        \[\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 \]
      8. sqr-pow87.5%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified87.5%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative87.5%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down96.4%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr96.4%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]

    if 1.7e147 < d < 5.2000000000000004e202

    1. Initial program 91.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. Step-by-step derivation
      1. associate-*l*91.7%

        \[\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.7%

        \[\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.7%

        \[\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.7%

        \[\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.7%

        \[\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.7%

        \[\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.7%

        \[\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.7%

        \[\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.7%

      \[\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. add-sqr-sqrt91.7%

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

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

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

        \[\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)}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right) \]
      5. metadata-eval100.0%

        \[\leadsto \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)}^{\color{blue}{1}} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right) \]
      6. pow1100.0%

        \[\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)} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right) \]
      7. div-inv100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4 \cdot 10^{-311}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;d \leq 3.9 \cdot 10^{-224}:\\ \;\;\;\;\left(\left|\frac{\sqrt[3]{h}}{\ell}\right| \cdot \sqrt{\frac{\sqrt[3]{h}}{\ell}}\right) \cdot \frac{-0.125}{\frac{d}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}}\\ \mathbf{elif}\;d \leq 1.15 \cdot 10^{+95}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\ \mathbf{elif}\;d \leq 1.7 \cdot 10^{+147} \lor \neg \left(d \leq 5.2 \cdot 10^{+202}\right):\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot {\left(\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\ \end{array} \]

Alternative 5: 74.2% accurate, 0.8× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}}\\ t_3 := \frac{\sqrt{-d}}{\sqrt{-\ell}}\\ \mathbf{if}\;\ell \leq -2.6 \cdot 10^{+270}:\\ \;\;\;\;\left(t_3 \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(t_2 \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right) \cdot t_0\\ \mathbf{elif}\;\ell \leq -9.5 \cdot 10^{+172}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left({\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\ \mathbf{elif}\;\ell \leq -6.5 \cdot 10^{+38}:\\ \;\;\;\;t_0 \cdot \left(t_3 \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(t_2 \cdot \frac{\frac{h}{\ell}}{d}\right)\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 2.7 \cdot 10^{-265}:\\ \;\;\;\;\left(t_1 \cdot t_0\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot t_1\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 (/ (/ (/ d M) M) D)))
        (t_3 (/ (sqrt (- d)) (sqrt (- l)))))
   (if (<= l -2.6e+270)
     (* (* t_3 (- 1.0 (* 0.5 (* 0.25 (* t_2 (/ h (* l d))))))) t_0)
     (if (<= l -9.5e+172)
       (*
        (* d (sqrt (/ (/ 1.0 l) h)))
        (+ (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l))) -1.0))
       (if (<= l -6.5e+38)
         (* t_0 (* t_3 (- 1.0 (* 0.5 (* 0.25 (* t_2 (/ (/ h l) d)))))))
         (if (<= l 2.7e-265)
           (*
            (* t_1 t_0)
            (- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
           (if (<= l 4.6e+116)
             (*
              (/ (sqrt d) (sqrt h))
              (*
               (- 1.0 (* 0.5 (* (pow (/ (/ (* M D) 2.0) d) 2.0) (/ h l))))
               t_1))
             (* d (* (pow l -0.5) (pow h -0.5))))))))))
M = abs(M);
D = abs(D);
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 / (((d / M) / M) / D);
	double t_3 = sqrt(-d) / sqrt(-l);
	double tmp;
	if (l <= -2.6e+270) {
		tmp = (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * (h / (l * d))))))) * t_0;
	} else if (l <= -9.5e+172) {
		tmp = (d * sqrt(((1.0 / l) / h))) * ((pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l))) + -1.0);
	} else if (l <= -6.5e+38) {
		tmp = t_0 * (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * ((h / l) / d))))));
	} else if (l <= 2.7e-265) {
		tmp = (t_1 * t_0) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
	} else if (l <= 4.6e+116) {
		tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (0.5 * (pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * t_1);
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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_1 / (((d / m) / m) / d_1)
    t_3 = sqrt(-d) / sqrt(-l)
    if (l <= (-2.6d+270)) then
        tmp = (t_3 * (1.0d0 - (0.5d0 * (0.25d0 * (t_2 * (h / (l * d))))))) * t_0
    else if (l <= (-9.5d+172)) then
        tmp = (d * sqrt(((1.0d0 / l) / h))) * (((((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l))) + (-1.0d0))
    else if (l <= (-6.5d+38)) then
        tmp = t_0 * (t_3 * (1.0d0 - (0.5d0 * (0.25d0 * (t_2 * ((h / l) / d))))))
    else if (l <= 2.7d-265) then
        tmp = (t_1 * t_0) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
    else if (l <= 4.6d+116) then
        tmp = (sqrt(d) / sqrt(h)) * ((1.0d0 - (0.5d0 * (((((m * d_1) / 2.0d0) / d) ** 2.0d0) * (h / l)))) * t_1)
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
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 / (((d / M) / M) / D);
	double t_3 = Math.sqrt(-d) / Math.sqrt(-l);
	double tmp;
	if (l <= -2.6e+270) {
		tmp = (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * (h / (l * d))))))) * t_0;
	} else if (l <= -9.5e+172) {
		tmp = (d * Math.sqrt(((1.0 / l) / h))) * ((Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l))) + -1.0);
	} else if (l <= -6.5e+38) {
		tmp = t_0 * (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * ((h / l) / d))))));
	} else if (l <= 2.7e-265) {
		tmp = (t_1 * t_0) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
	} else if (l <= 4.6e+116) {
		tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((1.0 - (0.5 * (Math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * t_1);
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[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 / (((d / M) / M) / D)
	t_3 = math.sqrt(-d) / math.sqrt(-l)
	tmp = 0
	if l <= -2.6e+270:
		tmp = (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * (h / (l * d))))))) * t_0
	elif l <= -9.5e+172:
		tmp = (d * math.sqrt(((1.0 / l) / h))) * ((math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l))) + -1.0)
	elif l <= -6.5e+38:
		tmp = t_0 * (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * ((h / l) / d))))))
	elif l <= 2.7e-265:
		tmp = (t_1 * t_0) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l))
	elif l <= 4.6e+116:
		tmp = (math.sqrt(d) / math.sqrt(h)) * ((1.0 - (0.5 * (math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * t_1)
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
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(Float64(Float64(d / M) / M) / D))
	t_3 = Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))
	tmp = 0.0
	if (l <= -2.6e+270)
		tmp = Float64(Float64(t_3 * Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(t_2 * Float64(h / Float64(l * d))))))) * t_0);
	elseif (l <= -9.5e+172)
		tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l))) + -1.0));
	elseif (l <= -6.5e+38)
		tmp = Float64(t_0 * Float64(t_3 * Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(t_2 * Float64(Float64(h / l) / d)))))));
	elseif (l <= 2.7e-265)
		tmp = Float64(Float64(t_1 * t_0) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l)));
	elseif (l <= 4.6e+116)
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0) * Float64(h / l)))) * t_1));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
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 / (((d / M) / M) / D);
	t_3 = sqrt(-d) / sqrt(-l);
	tmp = 0.0;
	if (l <= -2.6e+270)
		tmp = (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * (h / (l * d))))))) * t_0;
	elseif (l <= -9.5e+172)
		tmp = (d * sqrt(((1.0 / l) / h))) * (((((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l))) + -1.0);
	elseif (l <= -6.5e+38)
		tmp = t_0 * (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * ((h / l) / d))))));
	elseif (l <= 2.7e-265)
		tmp = (t_1 * t_0) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
	elseif (l <= 4.6e+116)
		tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (0.5 * (((((M * D) / 2.0) / d) ^ 2.0) * (h / l)))) * t_1);
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.6e+270], N[(N[(t$95$3 * N[(1.0 - N[(0.5 * N[(0.25 * N[(t$95$2 * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, -9.5e+172], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -6.5e+38], N[(t$95$0 * N[(t$95$3 * N[(1.0 - N[(0.5 * N[(0.25 * N[(t$95$2 * N[(N[(h / l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.7e-265], N[(N[(t$95$1 * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}}\\
t_3 := \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{if}\;\ell \leq -2.6 \cdot 10^{+270}:\\
\;\;\;\;\left(t_3 \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(t_2 \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right) \cdot t_0\\

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

\mathbf{elif}\;\ell \leq -6.5 \cdot 10^{+38}:\\
\;\;\;\;t_0 \cdot \left(t_3 \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(t_2 \cdot \frac{\frac{h}{\ell}}{d}\right)\right)\right)\right)\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if l < -2.60000000000000012e270

    1. Initial program 38.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. associate-*l*38.0%

        \[\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-eval38.0%

        \[\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/238.0%

        \[\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-eval38.0%

        \[\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/238.0%

        \[\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*38.0%

        \[\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-eval38.0%

        \[\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-frac38.0%

        \[\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. Simplified38.0%

      \[\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. frac-2neg38.0%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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. *-commutative26.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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/26.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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. associate-*r*26.6%

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

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

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

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

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

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

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

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

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

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

    if -2.60000000000000012e270 < l < -9.50000000000000027e172

    1. Initial program 40.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. expm1-log1p-u33.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef28.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr28.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.50000000000000027e172 < l < -6.5e38

    1. Initial program 67.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. associate-*l*67.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-eval67.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/267.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-eval67.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/267.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*67.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-eval67.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-frac67.7%

        \[\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. Simplified67.7%

      \[\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. frac-2neg67.7%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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. *-commutative38.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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/38.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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. associate-*r*38.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{d \cdot \ell}\right)\right)}\right)\right) \]
    11. Taylor expanded in l around 0 71.0%

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

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

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

    if -6.5e38 < l < 2.7000000000000002e-265

    1. Initial program 81.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. Step-by-step derivation
      1. metadata-eval81.4%

        \[\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/281.4%

        \[\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-eval81.4%

        \[\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/281.4%

        \[\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. *-commutative81.4%

        \[\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*81.4%

        \[\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-frac78.4%

        \[\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-eval78.4%

        \[\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. Simplified78.4%

      \[\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. associate-*r*78.4%

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

        \[\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) \]
      3. *-commutative81.4%

        \[\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) \]
      4. metadata-eval81.4%

        \[\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) \]
      5. associate-*r/85.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) \]
      6. metadata-eval85.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) \]
      7. *-commutative85.1%

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

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

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

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

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

    if 2.7000000000000002e-265 < l < 4.5999999999999999e116

    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. Step-by-step derivation
      1. associate-*l*75.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-eval75.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/275.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-eval75.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/275.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*75.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-eval75.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-frac72.9%

        \[\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. Simplified72.9%

      \[\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. frac-times0.0%

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

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

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

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

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

    if 4.5999999999999999e116 < l

    1. Initial program 53.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 60.0%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.6 \cdot 10^{+270}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -9.5 \cdot 10^{+172}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left({\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\ \mathbf{elif}\;\ell \leq -6.5 \cdot 10^{+38}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{\frac{h}{\ell}}{d}\right)\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 2.7 \cdot 10^{-265}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 6: 72.6% accurate, 1.0× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right) \cdot t_0\\ t_2 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;\ell \leq -6.3 \cdot 10^{+268}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\ell \leq -3.2 \cdot 10^{+172}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_2 + -1\right)\\ \mathbf{elif}\;\ell \leq -5.5 \cdot 10^{+37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\ell \leq 1.65 \cdot 10^{-125}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t_0\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 2.7 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - t_2\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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)) (sqrt (- l)))
           (-
            1.0
            (* 0.5 (* 0.25 (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d)))))))
          t_0))
        (t_2 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l)))))
   (if (<= l -6.3e+268)
     t_1
     (if (<= l -3.2e+172)
       (* (* d (sqrt (/ (/ 1.0 l) h))) (+ t_2 -1.0))
       (if (<= l -5.5e+37)
         t_1
         (if (<= l 1.65e-125)
           (*
            (* (sqrt (/ d l)) t_0)
            (- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
           (if (<= l 2.7e+116)
             (* (- 1.0 t_2) (* d (pow (* l h) -0.5)))
             (* d (* (pow l -0.5) (pow h -0.5))))))))))
M = abs(M);
D = abs(D);
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) / sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d))))))) * t_0;
	double t_2 = pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
	double tmp;
	if (l <= -6.3e+268) {
		tmp = t_1;
	} else if (l <= -3.2e+172) {
		tmp = (d * sqrt(((1.0 / l) / h))) * (t_2 + -1.0);
	} else if (l <= -5.5e+37) {
		tmp = t_1;
	} else if (l <= 1.65e-125) {
		tmp = (sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
	} else if (l <= 2.7e+116) {
		tmp = (1.0 - t_2) * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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((d / h))
    t_1 = ((sqrt(-d) / sqrt(-l)) * (1.0d0 - (0.5d0 * (0.25d0 * ((d_1 / (((d / m) / m) / d_1)) * (h / (l * d))))))) * t_0
    t_2 = (((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l))
    if (l <= (-6.3d+268)) then
        tmp = t_1
    else if (l <= (-3.2d+172)) then
        tmp = (d * sqrt(((1.0d0 / l) / h))) * (t_2 + (-1.0d0))
    else if (l <= (-5.5d+37)) then
        tmp = t_1
    else if (l <= 1.65d-125) then
        tmp = (sqrt((d / l)) * t_0) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
    else if (l <= 2.7d+116) then
        tmp = (1.0d0 - t_2) * (d * ((l * h) ** (-0.5d0)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
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) / Math.sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d))))))) * t_0;
	double t_2 = Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
	double tmp;
	if (l <= -6.3e+268) {
		tmp = t_1;
	} else if (l <= -3.2e+172) {
		tmp = (d * Math.sqrt(((1.0 / l) / h))) * (t_2 + -1.0);
	} else if (l <= -5.5e+37) {
		tmp = t_1;
	} else if (l <= 1.65e-125) {
		tmp = (Math.sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
	} else if (l <= 2.7e+116) {
		tmp = (1.0 - t_2) * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / h))
	t_1 = ((math.sqrt(-d) / math.sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d))))))) * t_0
	t_2 = math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l))
	tmp = 0
	if l <= -6.3e+268:
		tmp = t_1
	elif l <= -3.2e+172:
		tmp = (d * math.sqrt(((1.0 / l) / h))) * (t_2 + -1.0)
	elif l <= -5.5e+37:
		tmp = t_1
	elif l <= 1.65e-125:
		tmp = (math.sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l))
	elif l <= 2.7e+116:
		tmp = (1.0 - t_2) * (d * math.pow((l * h), -0.5))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / h))
	t_1 = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d))))))) * t_0)
	t_2 = Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l)))
	tmp = 0.0
	if (l <= -6.3e+268)
		tmp = t_1;
	elseif (l <= -3.2e+172)
		tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(t_2 + -1.0));
	elseif (l <= -5.5e+37)
		tmp = t_1;
	elseif (l <= 1.65e-125)
		tmp = Float64(Float64(sqrt(Float64(d / l)) * t_0) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l)));
	elseif (l <= 2.7e+116)
		tmp = Float64(Float64(1.0 - t_2) * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / h));
	t_1 = ((sqrt(-d) / sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d))))))) * t_0;
	t_2 = (((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l));
	tmp = 0.0;
	if (l <= -6.3e+268)
		tmp = t_1;
	elseif (l <= -3.2e+172)
		tmp = (d * sqrt(((1.0 / l) / h))) * (t_2 + -1.0);
	elseif (l <= -5.5e+37)
		tmp = t_1;
	elseif (l <= 1.65e-125)
		tmp = (sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
	elseif (l <= 2.7e+116)
		tmp = (1.0 - t_2) * (d * ((l * h) ^ -0.5));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(0.25 * N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6.3e+268], t$95$1, If[LessEqual[l, -3.2e+172], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5.5e+37], t$95$1, If[LessEqual[l, 1.65e-125], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.7e+116], N[(N[(1.0 - t$95$2), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right) \cdot t_0\\
t_2 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;\ell \leq -6.3 \cdot 10^{+268}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;\ell \leq -3.2 \cdot 10^{+172}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_2 + -1\right)\\

\mathbf{elif}\;\ell \leq -5.5 \cdot 10^{+37}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;\ell \leq 2.7 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - t_2\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if l < -6.2999999999999996e268 or -3.19999999999999985e172 < l < -5.50000000000000016e37

    1. Initial program 59.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*59.5%

        \[\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-eval59.5%

        \[\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/259.5%

        \[\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-eval59.5%

        \[\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/259.5%

        \[\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*59.5%

        \[\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-eval59.5%

        \[\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-frac59.5%

        \[\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. Simplified59.5%

      \[\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. frac-2neg59.5%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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. *-commutative35.0%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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/35.0%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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. associate-*r*35.2%

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

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

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

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

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

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

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

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

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

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

    if -6.2999999999999996e268 < l < -3.19999999999999985e172

    1. Initial program 40.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. expm1-log1p-u33.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef28.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr28.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.50000000000000016e37 < l < 1.65e-125

    1. Initial program 79.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-eval79.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/279.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-eval79.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/279.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. *-commutative79.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*79.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-frac77.0%

        \[\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-eval77.0%

        \[\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. Simplified77.0%

      \[\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. associate-*r*77.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. frac-times79.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) \]
      3. *-commutative79.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) \]
      4. metadata-eval79.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) \]
      5. associate-*r/83.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) \]
      6. metadata-eval83.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) \]
      7. *-commutative83.6%

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

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

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

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

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

    if 1.65e-125 < l < 2.7e116

    1. Initial program 74.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. expm1-log1p-u43.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef26.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr17.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot \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|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      8. fabs-sqr85.1%

        \[\leadsto \left(d \cdot \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)}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      9. sqr-pow85.4%

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

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

    if 2.7e116 < l

    1. Initial program 53.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 60.0%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 5 regimes into one program.
  4. Final simplification78.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -6.3 \cdot 10^{+268}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -3.2 \cdot 10^{+172}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left({\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\ \mathbf{elif}\;\ell \leq -5.5 \cdot 10^{+37}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq 1.65 \cdot 10^{-125}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 2.7 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 7: 72.5% accurate, 1.0× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}}\\ t_2 := \frac{\sqrt{-d}}{\sqrt{-\ell}}\\ t_3 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;\ell \leq -6.3 \cdot 10^{+268}:\\ \;\;\;\;\left(t_2 \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(t_1 \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right) \cdot t_0\\ \mathbf{elif}\;\ell \leq -2.75 \cdot 10^{+172}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_3 + -1\right)\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{+38}:\\ \;\;\;\;t_0 \cdot \left(t_2 \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(t_1 \cdot \frac{\frac{h}{\ell}}{d}\right)\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 2.2 \cdot 10^{-129}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t_0\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - t_3\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 (/ D (/ (/ (/ d M) M) D)))
        (t_2 (/ (sqrt (- d)) (sqrt (- l))))
        (t_3 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l)))))
   (if (<= l -6.3e+268)
     (* (* t_2 (- 1.0 (* 0.5 (* 0.25 (* t_1 (/ h (* l d))))))) t_0)
     (if (<= l -2.75e+172)
       (* (* d (sqrt (/ (/ 1.0 l) h))) (+ t_3 -1.0))
       (if (<= l -2e+38)
         (* t_0 (* t_2 (- 1.0 (* 0.5 (* 0.25 (* t_1 (/ (/ h l) d)))))))
         (if (<= l 2.2e-129)
           (*
            (* (sqrt (/ d l)) t_0)
            (- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
           (if (<= l 4.6e+116)
             (* (- 1.0 t_3) (* d (pow (* l h) -0.5)))
             (* d (* (pow l -0.5) (pow h -0.5))))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / h));
	double t_1 = D / (((d / M) / M) / D);
	double t_2 = sqrt(-d) / sqrt(-l);
	double t_3 = pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
	double tmp;
	if (l <= -6.3e+268) {
		tmp = (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * (h / (l * d))))))) * t_0;
	} else if (l <= -2.75e+172) {
		tmp = (d * sqrt(((1.0 / l) / h))) * (t_3 + -1.0);
	} else if (l <= -2e+38) {
		tmp = t_0 * (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * ((h / l) / d))))));
	} else if (l <= 2.2e-129) {
		tmp = (sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
	} else if (l <= 4.6e+116) {
		tmp = (1.0 - t_3) * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 = d_1 / (((d / m) / m) / d_1)
    t_2 = sqrt(-d) / sqrt(-l)
    t_3 = (((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l))
    if (l <= (-6.3d+268)) then
        tmp = (t_2 * (1.0d0 - (0.5d0 * (0.25d0 * (t_1 * (h / (l * d))))))) * t_0
    else if (l <= (-2.75d+172)) then
        tmp = (d * sqrt(((1.0d0 / l) / h))) * (t_3 + (-1.0d0))
    else if (l <= (-2d+38)) then
        tmp = t_0 * (t_2 * (1.0d0 - (0.5d0 * (0.25d0 * (t_1 * ((h / l) / d))))))
    else if (l <= 2.2d-129) then
        tmp = (sqrt((d / l)) * t_0) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
    else if (l <= 4.6d+116) then
        tmp = (1.0d0 - t_3) * (d * ((l * h) ** (-0.5d0)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
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 = D / (((d / M) / M) / D);
	double t_2 = Math.sqrt(-d) / Math.sqrt(-l);
	double t_3 = Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
	double tmp;
	if (l <= -6.3e+268) {
		tmp = (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * (h / (l * d))))))) * t_0;
	} else if (l <= -2.75e+172) {
		tmp = (d * Math.sqrt(((1.0 / l) / h))) * (t_3 + -1.0);
	} else if (l <= -2e+38) {
		tmp = t_0 * (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * ((h / l) / d))))));
	} else if (l <= 2.2e-129) {
		tmp = (Math.sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
	} else if (l <= 4.6e+116) {
		tmp = (1.0 - t_3) * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / h))
	t_1 = D / (((d / M) / M) / D)
	t_2 = math.sqrt(-d) / math.sqrt(-l)
	t_3 = math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l))
	tmp = 0
	if l <= -6.3e+268:
		tmp = (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * (h / (l * d))))))) * t_0
	elif l <= -2.75e+172:
		tmp = (d * math.sqrt(((1.0 / l) / h))) * (t_3 + -1.0)
	elif l <= -2e+38:
		tmp = t_0 * (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * ((h / l) / d))))))
	elif l <= 2.2e-129:
		tmp = (math.sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l))
	elif l <= 4.6e+116:
		tmp = (1.0 - t_3) * (d * math.pow((l * h), -0.5))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / h))
	t_1 = Float64(D / Float64(Float64(Float64(d / M) / M) / D))
	t_2 = Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))
	t_3 = Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l)))
	tmp = 0.0
	if (l <= -6.3e+268)
		tmp = Float64(Float64(t_2 * Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(t_1 * Float64(h / Float64(l * d))))))) * t_0);
	elseif (l <= -2.75e+172)
		tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(t_3 + -1.0));
	elseif (l <= -2e+38)
		tmp = Float64(t_0 * Float64(t_2 * Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(t_1 * Float64(Float64(h / l) / d)))))));
	elseif (l <= 2.2e-129)
		tmp = Float64(Float64(sqrt(Float64(d / l)) * t_0) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l)));
	elseif (l <= 4.6e+116)
		tmp = Float64(Float64(1.0 - t_3) * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / h));
	t_1 = D / (((d / M) / M) / D);
	t_2 = sqrt(-d) / sqrt(-l);
	t_3 = (((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l));
	tmp = 0.0;
	if (l <= -6.3e+268)
		tmp = (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * (h / (l * d))))))) * t_0;
	elseif (l <= -2.75e+172)
		tmp = (d * sqrt(((1.0 / l) / h))) * (t_3 + -1.0);
	elseif (l <= -2e+38)
		tmp = t_0 * (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * ((h / l) / d))))));
	elseif (l <= 2.2e-129)
		tmp = (sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
	elseif (l <= 4.6e+116)
		tmp = (1.0 - t_3) * (d * ((l * h) ^ -0.5));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6.3e+268], N[(N[(t$95$2 * N[(1.0 - N[(0.5 * N[(0.25 * N[(t$95$1 * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, -2.75e+172], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$3 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e+38], N[(t$95$0 * N[(t$95$2 * N[(1.0 - N[(0.5 * N[(0.25 * N[(t$95$1 * N[(N[(h / l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.2e-129], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(1.0 - t$95$3), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}}\\
t_2 := \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
t_3 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;\ell \leq -6.3 \cdot 10^{+268}:\\
\;\;\;\;\left(t_2 \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(t_1 \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right) \cdot t_0\\

\mathbf{elif}\;\ell \leq -2.75 \cdot 10^{+172}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_3 + -1\right)\\

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

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

\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - t_3\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if l < -6.2999999999999996e268

    1. Initial program 38.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. associate-*l*38.0%

        \[\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-eval38.0%

        \[\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/238.0%

        \[\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-eval38.0%

        \[\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/238.0%

        \[\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*38.0%

        \[\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-eval38.0%

        \[\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-frac38.0%

        \[\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. Simplified38.0%

      \[\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. frac-2neg38.0%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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. *-commutative26.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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/26.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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. associate-*r*26.6%

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

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

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

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

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

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

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

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

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

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

    if -6.2999999999999996e268 < l < -2.75e172

    1. Initial program 40.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. expm1-log1p-u33.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef28.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr28.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.75e172 < l < -1.99999999999999995e38

    1. Initial program 67.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. associate-*l*67.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-eval67.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/267.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-eval67.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/267.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*67.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-eval67.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-frac67.7%

        \[\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. Simplified67.7%

      \[\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. frac-2neg67.7%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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. *-commutative38.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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/38.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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. associate-*r*38.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{d \cdot \ell}\right)\right)}\right)\right) \]
    11. Taylor expanded in l around 0 71.0%

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

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

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

    if -1.99999999999999995e38 < l < 2.20000000000000003e-129

    1. Initial program 79.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-eval79.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/279.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-eval79.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/279.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. *-commutative79.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*79.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-frac77.0%

        \[\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-eval77.0%

        \[\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. Simplified77.0%

      \[\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. associate-*r*77.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. frac-times79.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) \]
      3. *-commutative79.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) \]
      4. metadata-eval79.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) \]
      5. associate-*r/83.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) \]
      6. metadata-eval83.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) \]
      7. *-commutative83.6%

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

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

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

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

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

    if 2.20000000000000003e-129 < l < 4.5999999999999999e116

    1. Initial program 74.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. expm1-log1p-u43.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef26.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr17.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot \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|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      8. fabs-sqr85.1%

        \[\leadsto \left(d \cdot \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)}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      9. sqr-pow85.4%

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

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

    if 4.5999999999999999e116 < l

    1. Initial program 53.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 60.0%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -6.3 \cdot 10^{+268}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -2.75 \cdot 10^{+172}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left({\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{+38}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{\frac{h}{\ell}}{d}\right)\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 2.2 \cdot 10^{-129}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 8: 70.5% accurate, 1.0× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := 0.5 \cdot \frac{h}{\ell}\\ t_1 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot t_0\\ \mathbf{if}\;\ell \leq -2.55 \cdot 10^{-117}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_1 + -1\right)\\ \mathbf{elif}\;\ell \leq 6 \cdot 10^{-201}:\\ \;\;\;\;\left(1 - {\left(\sqrt{t_0} \cdot \frac{D}{\frac{d}{0.5 \cdot M}}\right)}^{2}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - t_1\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* 0.5 (/ h l))) (t_1 (* (pow (/ (* D (* 0.5 M)) d) 2.0) t_0)))
   (if (<= l -2.55e-117)
     (* (* d (sqrt (/ (/ 1.0 l) h))) (+ t_1 -1.0))
     (if (<= l 6e-201)
       (*
        (- 1.0 (pow (* (sqrt t_0) (/ D (/ d (* 0.5 M)))) 2.0))
        (sqrt (* (/ d l) (/ d h))))
       (if (<= l 4.6e+116)
         (* (- 1.0 t_1) (* d (pow (* l h) -0.5)))
         (* d (* (pow l -0.5) (pow h -0.5))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = 0.5 * (h / l);
	double t_1 = pow(((D * (0.5 * M)) / d), 2.0) * t_0;
	double tmp;
	if (l <= -2.55e-117) {
		tmp = (d * sqrt(((1.0 / l) / h))) * (t_1 + -1.0);
	} else if (l <= 6e-201) {
		tmp = (1.0 - pow((sqrt(t_0) * (D / (d / (0.5 * M)))), 2.0)) * sqrt(((d / l) * (d / h)));
	} else if (l <= 4.6e+116) {
		tmp = (1.0 - t_1) * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.5d0 * (h / l)
    t_1 = (((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * t_0
    if (l <= (-2.55d-117)) then
        tmp = (d * sqrt(((1.0d0 / l) / h))) * (t_1 + (-1.0d0))
    else if (l <= 6d-201) then
        tmp = (1.0d0 - ((sqrt(t_0) * (d_1 / (d / (0.5d0 * m)))) ** 2.0d0)) * sqrt(((d / l) * (d / h)))
    else if (l <= 4.6d+116) then
        tmp = (1.0d0 - t_1) * (d * ((l * h) ** (-0.5d0)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = 0.5 * (h / l);
	double t_1 = Math.pow(((D * (0.5 * M)) / d), 2.0) * t_0;
	double tmp;
	if (l <= -2.55e-117) {
		tmp = (d * Math.sqrt(((1.0 / l) / h))) * (t_1 + -1.0);
	} else if (l <= 6e-201) {
		tmp = (1.0 - Math.pow((Math.sqrt(t_0) * (D / (d / (0.5 * M)))), 2.0)) * Math.sqrt(((d / l) * (d / h)));
	} else if (l <= 4.6e+116) {
		tmp = (1.0 - t_1) * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = 0.5 * (h / l)
	t_1 = math.pow(((D * (0.5 * M)) / d), 2.0) * t_0
	tmp = 0
	if l <= -2.55e-117:
		tmp = (d * math.sqrt(((1.0 / l) / h))) * (t_1 + -1.0)
	elif l <= 6e-201:
		tmp = (1.0 - math.pow((math.sqrt(t_0) * (D / (d / (0.5 * M)))), 2.0)) * math.sqrt(((d / l) * (d / h)))
	elif l <= 4.6e+116:
		tmp = (1.0 - t_1) * (d * math.pow((l * h), -0.5))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(0.5 * Float64(h / l))
	t_1 = Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * t_0)
	tmp = 0.0
	if (l <= -2.55e-117)
		tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(t_1 + -1.0));
	elseif (l <= 6e-201)
		tmp = Float64(Float64(1.0 - (Float64(sqrt(t_0) * Float64(D / Float64(d / Float64(0.5 * M)))) ^ 2.0)) * sqrt(Float64(Float64(d / l) * Float64(d / h))));
	elseif (l <= 4.6e+116)
		tmp = Float64(Float64(1.0 - t_1) * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = 0.5 * (h / l);
	t_1 = (((D * (0.5 * M)) / d) ^ 2.0) * t_0;
	tmp = 0.0;
	if (l <= -2.55e-117)
		tmp = (d * sqrt(((1.0 / l) / h))) * (t_1 + -1.0);
	elseif (l <= 6e-201)
		tmp = (1.0 - ((sqrt(t_0) * (D / (d / (0.5 * M)))) ^ 2.0)) * sqrt(((d / l) * (d / h)));
	elseif (l <= 4.6e+116)
		tmp = (1.0 - t_1) * (d * ((l * h) ^ -0.5));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(h / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[l, -2.55e-117], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6e-201], N[(N[(1.0 - N[Power[N[(N[Sqrt[t$95$0], $MachinePrecision] * N[(D / N[(d / N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(1.0 - t$95$1), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{h}{\ell}\\
t_1 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot t_0\\
\mathbf{if}\;\ell \leq -2.55 \cdot 10^{-117}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_1 + -1\right)\\

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

\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - t_1\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -2.5500000000000001e-117

    1. Initial program 66.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. Step-by-step derivation
      1. expm1-log1p-u40.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef25.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr22.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5500000000000001e-117 < l < 6.00000000000000004e-201

    1. Initial program 75.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-eval75.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. unpow1/275.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. metadata-eval75.5%

        \[\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/275.5%

        \[\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. *-commutative75.5%

        \[\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*75.5%

        \[\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-frac72.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-eval72.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. Simplified72.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. associate-*r*72.6%

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

        \[\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) \]
      3. *-commutative75.5%

        \[\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) \]
      4. metadata-eval75.5%

        \[\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) \]
      5. add-sqr-sqrt75.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.00000000000000004e-201 < l < 4.5999999999999999e116

    1. Initial program 75.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. Step-by-step derivation
      1. expm1-log1p-u40.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef27.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr19.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      7. sqr-pow83.0%

        \[\leadsto \left(d \cdot \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|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      8. fabs-sqr83.0%

        \[\leadsto \left(d \cdot \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)}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      9. sqr-pow83.2%

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

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

    if 4.5999999999999999e116 < l

    1. Initial program 53.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 60.0%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 4 regimes into one program.
  4. Final simplification74.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.55 \cdot 10^{-117}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left({\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\ \mathbf{elif}\;\ell \leq 6 \cdot 10^{-201}:\\ \;\;\;\;\left(1 - {\left(\sqrt{0.5 \cdot \frac{h}{\ell}} \cdot \frac{D}{\frac{d}{0.5 \cdot M}}\right)}^{2}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 9: 71.9% accurate, 1.0× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;\ell \leq -3 \cdot 10^{-117}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_0 + -1\right)\\ \mathbf{elif}\;\ell \leq 8.5 \cdot 10^{-128}:\\ \;\;\;\;\left(\left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - t_0\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 (* 0.5 M)) d) 2.0) (* 0.5 (/ h l)))))
   (if (<= l -3e-117)
     (* (* d (sqrt (/ (/ 1.0 l) h))) (+ t_0 -1.0))
     (if (<= l 8.5e-128)
       (*
        (*
         (- 1.0 (* 0.5 (* (pow (/ (/ (* M D) 2.0) d) 2.0) (/ h l))))
         (sqrt (/ d l)))
        (sqrt (/ d h)))
       (if (<= l 4.6e+116)
         (* (- 1.0 t_0) (* d (pow (* l h) -0.5)))
         (* d (* (pow l -0.5) (pow h -0.5))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
	double tmp;
	if (l <= -3e-117) {
		tmp = (d * sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
	} else if (l <= 8.5e-128) {
		tmp = ((1.0 - (0.5 * (pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * sqrt((d / l))) * sqrt((d / h));
	} else if (l <= 4.6e+116) {
		tmp = (1.0 - t_0) * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l))
    if (l <= (-3d-117)) then
        tmp = (d * sqrt(((1.0d0 / l) / h))) * (t_0 + (-1.0d0))
    else if (l <= 8.5d-128) then
        tmp = ((1.0d0 - (0.5d0 * (((((m * d_1) / 2.0d0) / d) ** 2.0d0) * (h / l)))) * sqrt((d / l))) * sqrt((d / h))
    else if (l <= 4.6d+116) then
        tmp = (1.0d0 - t_0) * (d * ((l * h) ** (-0.5d0)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
	double tmp;
	if (l <= -3e-117) {
		tmp = (d * Math.sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
	} else if (l <= 8.5e-128) {
		tmp = ((1.0 - (0.5 * (Math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * Math.sqrt((d / l))) * Math.sqrt((d / h));
	} else if (l <= 4.6e+116) {
		tmp = (1.0 - t_0) * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l))
	tmp = 0
	if l <= -3e-117:
		tmp = (d * math.sqrt(((1.0 / l) / h))) * (t_0 + -1.0)
	elif l <= 8.5e-128:
		tmp = ((1.0 - (0.5 * (math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * math.sqrt((d / l))) * math.sqrt((d / h))
	elif l <= 4.6e+116:
		tmp = (1.0 - t_0) * (d * math.pow((l * h), -0.5))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l)))
	tmp = 0.0
	if (l <= -3e-117)
		tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(t_0 + -1.0));
	elseif (l <= 8.5e-128)
		tmp = Float64(Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0) * Float64(h / l)))) * sqrt(Float64(d / l))) * sqrt(Float64(d / h)));
	elseif (l <= 4.6e+116)
		tmp = Float64(Float64(1.0 - t_0) * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = (((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l));
	tmp = 0.0;
	if (l <= -3e-117)
		tmp = (d * sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
	elseif (l <= 8.5e-128)
		tmp = ((1.0 - (0.5 * (((((M * D) / 2.0) / d) ^ 2.0) * (h / l)))) * sqrt((d / l))) * sqrt((d / h));
	elseif (l <= 4.6e+116)
		tmp = (1.0 - t_0) * (d * ((l * h) ^ -0.5));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3e-117], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.5e-128], N[(N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;\ell \leq -3 \cdot 10^{-117}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_0 + -1\right)\\

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

\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - t_0\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -2.99999999999999991e-117

    1. Initial program 66.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. Step-by-step derivation
      1. expm1-log1p-u40.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef25.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr22.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.99999999999999991e-117 < l < 8.4999999999999996e-128

    1. Initial program 76.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*76.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-eval76.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/276.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-eval76.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/276.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*76.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-eval76.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-frac73.1%

        \[\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. Simplified73.1%

      \[\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. frac-times37.0%

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

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

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

    if 8.4999999999999996e-128 < l < 4.5999999999999999e116

    1. Initial program 74.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. expm1-log1p-u43.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef26.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr17.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot \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|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      8. fabs-sqr85.1%

        \[\leadsto \left(d \cdot \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)}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      9. sqr-pow85.4%

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

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

    if 4.5999999999999999e116 < l

    1. Initial program 53.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 60.0%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 4 regimes into one program.
  4. Final simplification76.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3 \cdot 10^{-117}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left({\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\ \mathbf{elif}\;\ell \leq 8.5 \cdot 10^{-128}:\\ \;\;\;\;\left(\left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 10: 73.2% accurate, 1.0× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;\ell \leq -5.1 \cdot 10^{-117}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_0 + -1\right)\\ \mathbf{elif}\;\ell \leq 6.8 \cdot 10^{-127}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 3.4 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - t_0\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 (* 0.5 M)) d) 2.0) (* 0.5 (/ h l)))))
   (if (<= l -5.1e-117)
     (* (* d (sqrt (/ (/ 1.0 l) h))) (+ t_0 -1.0))
     (if (<= l 6.8e-127)
       (*
        (* (sqrt (/ d l)) (sqrt (/ d h)))
        (- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
       (if (<= l 3.4e+116)
         (* (- 1.0 t_0) (* d (pow (* l h) -0.5)))
         (* d (* (pow l -0.5) (pow h -0.5))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
	double tmp;
	if (l <= -5.1e-117) {
		tmp = (d * sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
	} else if (l <= 6.8e-127) {
		tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
	} else if (l <= 3.4e+116) {
		tmp = (1.0 - t_0) * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l))
    if (l <= (-5.1d-117)) then
        tmp = (d * sqrt(((1.0d0 / l) / h))) * (t_0 + (-1.0d0))
    else if (l <= 6.8d-127) then
        tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
    else if (l <= 3.4d+116) then
        tmp = (1.0d0 - t_0) * (d * ((l * h) ** (-0.5d0)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
	double tmp;
	if (l <= -5.1e-117) {
		tmp = (d * Math.sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
	} else if (l <= 6.8e-127) {
		tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
	} else if (l <= 3.4e+116) {
		tmp = (1.0 - t_0) * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l))
	tmp = 0
	if l <= -5.1e-117:
		tmp = (d * math.sqrt(((1.0 / l) / h))) * (t_0 + -1.0)
	elif l <= 6.8e-127:
		tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l))
	elif l <= 3.4e+116:
		tmp = (1.0 - t_0) * (d * math.pow((l * h), -0.5))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l)))
	tmp = 0.0
	if (l <= -5.1e-117)
		tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(t_0 + -1.0));
	elseif (l <= 6.8e-127)
		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l)));
	elseif (l <= 3.4e+116)
		tmp = Float64(Float64(1.0 - t_0) * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = (((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l));
	tmp = 0.0;
	if (l <= -5.1e-117)
		tmp = (d * sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
	elseif (l <= 6.8e-127)
		tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
	elseif (l <= 3.4e+116)
		tmp = (1.0 - t_0) * (d * ((l * h) ^ -0.5));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.1e-117], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.8e-127], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.4e+116], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;\ell \leq -5.1 \cdot 10^{-117}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_0 + -1\right)\\

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

\mathbf{elif}\;\ell \leq 3.4 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - t_0\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -5.1000000000000002e-117

    1. Initial program 66.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. Step-by-step derivation
      1. expm1-log1p-u40.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef25.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr22.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.1000000000000002e-117 < l < 6.7999999999999997e-127

    1. Initial program 76.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-eval76.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/276.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-eval76.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/276.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. *-commutative76.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*76.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.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-eval73.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. Simplified73.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. associate-*r*73.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. frac-times76.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) \]
      3. *-commutative76.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) \]
      4. metadata-eval76.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) \]
      5. associate-*r/81.8%

        \[\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) \]
      6. metadata-eval81.8%

        \[\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) \]
      7. *-commutative81.8%

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

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

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

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

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

    if 6.7999999999999997e-127 < l < 3.40000000000000023e116

    1. Initial program 74.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. expm1-log1p-u43.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef26.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr17.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot \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|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      8. fabs-sqr85.1%

        \[\leadsto \left(d \cdot \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)}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      9. sqr-pow85.4%

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

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

    if 3.40000000000000023e116 < l

    1. Initial program 53.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 60.0%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 4 regimes into one program.
  4. Final simplification76.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -5.1 \cdot 10^{-117}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left({\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\ \mathbf{elif}\;\ell \leq 6.8 \cdot 10^{-127}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 3.4 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 11: 65.3% accurate, 1.4× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ t_1 := 0.5 \cdot \frac{h}{\ell}\\ \mathbf{if}\;\ell \leq -1.04 \cdot 10^{+68}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-104}:\\ \;\;\;\;t_0 \cdot \left(1 - \frac{h}{\frac{\ell}{0.5}} \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)\\ \mathbf{elif}\;\ell \leq 8.5 \cdot 10^{-197}:\\ \;\;\;\;t_0 \cdot \left(1 - t_1 \cdot {\left(0.5 \cdot \frac{D}{\frac{d}{M}}\right)}^{2}\right)\\ \mathbf{elif}\;\ell \leq 4 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot t_1\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 l) (/ d h)))) (t_1 (* 0.5 (/ h l))))
   (if (<= l -1.04e+68)
     (* (- d) (sqrt (/ 1.0 (* l h))))
     (if (<= l -1e-104)
       (* t_0 (- 1.0 (* (/ h (/ l 0.5)) (pow (* (* 0.5 M) (/ D d)) 2.0))))
       (if (<= l 8.5e-197)
         (* t_0 (- 1.0 (* t_1 (pow (* 0.5 (/ D (/ d M))) 2.0))))
         (if (<= l 4e+116)
           (*
            (- 1.0 (* (pow (/ (* D (* 0.5 M)) d) 2.0) t_1))
            (* d (pow (* l h) -0.5)))
           (* d (* (pow l -0.5) (pow h -0.5)))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt(((d / l) * (d / h)));
	double t_1 = 0.5 * (h / l);
	double tmp;
	if (l <= -1.04e+68) {
		tmp = -d * sqrt((1.0 / (l * h)));
	} else if (l <= -1e-104) {
		tmp = t_0 * (1.0 - ((h / (l / 0.5)) * pow(((0.5 * M) * (D / d)), 2.0)));
	} else if (l <= 8.5e-197) {
		tmp = t_0 * (1.0 - (t_1 * pow((0.5 * (D / (d / M))), 2.0)));
	} else if (l <= 4e+116) {
		tmp = (1.0 - (pow(((D * (0.5 * M)) / d), 2.0) * t_1)) * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 / l) * (d / h)))
    t_1 = 0.5d0 * (h / l)
    if (l <= (-1.04d+68)) then
        tmp = -d * sqrt((1.0d0 / (l * h)))
    else if (l <= (-1d-104)) then
        tmp = t_0 * (1.0d0 - ((h / (l / 0.5d0)) * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0)))
    else if (l <= 8.5d-197) then
        tmp = t_0 * (1.0d0 - (t_1 * ((0.5d0 * (d_1 / (d / m))) ** 2.0d0)))
    else if (l <= 4d+116) then
        tmp = (1.0d0 - ((((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * t_1)) * (d * ((l * h) ** (-0.5d0)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt(((d / l) * (d / h)));
	double t_1 = 0.5 * (h / l);
	double tmp;
	if (l <= -1.04e+68) {
		tmp = -d * Math.sqrt((1.0 / (l * h)));
	} else if (l <= -1e-104) {
		tmp = t_0 * (1.0 - ((h / (l / 0.5)) * Math.pow(((0.5 * M) * (D / d)), 2.0)));
	} else if (l <= 8.5e-197) {
		tmp = t_0 * (1.0 - (t_1 * Math.pow((0.5 * (D / (d / M))), 2.0)));
	} else if (l <= 4e+116) {
		tmp = (1.0 - (Math.pow(((D * (0.5 * M)) / d), 2.0) * t_1)) * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt(((d / l) * (d / h)))
	t_1 = 0.5 * (h / l)
	tmp = 0
	if l <= -1.04e+68:
		tmp = -d * math.sqrt((1.0 / (l * h)))
	elif l <= -1e-104:
		tmp = t_0 * (1.0 - ((h / (l / 0.5)) * math.pow(((0.5 * M) * (D / d)), 2.0)))
	elif l <= 8.5e-197:
		tmp = t_0 * (1.0 - (t_1 * math.pow((0.5 * (D / (d / M))), 2.0)))
	elif l <= 4e+116:
		tmp = (1.0 - (math.pow(((D * (0.5 * M)) / d), 2.0) * t_1)) * (d * math.pow((l * h), -0.5))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(Float64(d / l) * Float64(d / h)))
	t_1 = Float64(0.5 * Float64(h / l))
	tmp = 0.0
	if (l <= -1.04e+68)
		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h))));
	elseif (l <= -1e-104)
		tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(h / Float64(l / 0.5)) * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))));
	elseif (l <= 8.5e-197)
		tmp = Float64(t_0 * Float64(1.0 - Float64(t_1 * (Float64(0.5 * Float64(D / Float64(d / M))) ^ 2.0))));
	elseif (l <= 4e+116)
		tmp = Float64(Float64(1.0 - Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * t_1)) * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt(((d / l) * (d / h)));
	t_1 = 0.5 * (h / l);
	tmp = 0.0;
	if (l <= -1.04e+68)
		tmp = -d * sqrt((1.0 / (l * h)));
	elseif (l <= -1e-104)
		tmp = t_0 * (1.0 - ((h / (l / 0.5)) * (((0.5 * M) * (D / d)) ^ 2.0)));
	elseif (l <= 8.5e-197)
		tmp = t_0 * (1.0 - (t_1 * ((0.5 * (D / (d / M))) ^ 2.0)));
	elseif (l <= 4e+116)
		tmp = (1.0 - ((((D * (0.5 * M)) / d) ^ 2.0) * t_1)) * (d * ((l * h) ^ -0.5));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.04e+68], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-104], N[(t$95$0 * N[(1.0 - N[(N[(h / N[(l / 0.5), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.5e-197], N[(t$95$0 * N[(1.0 - N[(t$95$1 * N[Power[N[(0.5 * N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4e+116], N[(N[(1.0 - N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
t_1 := 0.5 \cdot \frac{h}{\ell}\\
\mathbf{if}\;\ell \leq -1.04 \cdot 10^{+68}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if l < -1.04e68

    1. Initial program 50.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*50.5%

        \[\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-eval50.5%

        \[\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/250.5%

        \[\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-eval50.5%

        \[\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/250.5%

        \[\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*50.5%

        \[\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-eval50.5%

        \[\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-frac50.5%

        \[\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. Simplified50.5%

      \[\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. frac-2neg50.5%

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    6. Taylor expanded in d around -inf 54.8%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg54.8%

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

        \[\leadsto -d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. distribute-rgt-neg-in54.8%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    8. Simplified54.8%

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

    if -1.04e68 < l < -9.99999999999999927e-105

    1. Initial program 82.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. Step-by-step derivation
      1. metadata-eval82.7%

        \[\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/282.7%

        \[\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-eval82.7%

        \[\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/282.7%

        \[\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. *-commutative82.7%

        \[\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*82.7%

        \[\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-frac81.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-eval81.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. Simplified81.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. associate-*r*81.1%

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

        \[\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) \]
      3. *-commutative82.7%

        \[\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) \]
      4. metadata-eval82.7%

        \[\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) \]
      5. add-sqr-sqrt82.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999927e-105 < l < 8.5e-197

    1. Initial program 76.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. expm1-log1p-u22.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef19.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr16.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.5e-197 < l < 4.00000000000000006e116

    1. Initial program 75.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. Step-by-step derivation
      1. expm1-log1p-u40.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef27.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr19.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      7. sqr-pow83.0%

        \[\leadsto \left(d \cdot \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|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      8. fabs-sqr83.0%

        \[\leadsto \left(d \cdot \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)}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      9. sqr-pow83.2%

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

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

    if 4.00000000000000006e116 < l

    1. Initial program 53.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 60.0%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 5 regimes into one program.
  4. Final simplification70.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.04 \cdot 10^{+68}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-104}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{h}{\frac{\ell}{0.5}} \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)\\ \mathbf{elif}\;\ell \leq 8.5 \cdot 10^{-197}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(0.5 \cdot \frac{D}{\frac{d}{M}}\right)}^{2}\right)\\ \mathbf{elif}\;\ell \leq 4 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 12: 63.8% accurate, 1.4× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -8.19999999999999959e67

    1. Initial program 50.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*50.5%

        \[\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-eval50.5%

        \[\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/250.5%

        \[\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-eval50.5%

        \[\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/250.5%

        \[\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*50.5%

        \[\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-eval50.5%

        \[\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-frac50.5%

        \[\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. Simplified50.5%

      \[\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. frac-2neg50.5%

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    6. Taylor expanded in d around -inf 54.8%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg54.8%

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

        \[\leadsto -d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. distribute-rgt-neg-in54.8%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    8. Simplified54.8%

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

    if -8.19999999999999959e67 < l < 3.4999999999999999e-296

    1. Initial program 82.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. Step-by-step derivation
      1. expm1-log1p-u31.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef22.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr19.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \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. *-commutative33.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \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/33.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\color{blue}{\frac{\frac{d}{M}}{M}}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
    8. Simplified56.9%

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

    if 3.4999999999999999e-296 < l < 4.5999999999999999e116

    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. expm1-log1p-u32.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef22.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr17.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      7. sqr-pow75.9%

        \[\leadsto \left(d \cdot \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|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      8. fabs-sqr75.9%

        \[\leadsto \left(d \cdot \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)}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      9. sqr-pow76.1%

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

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

    if 4.5999999999999999e116 < l

    1. Initial program 53.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 60.0%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 4 regimes into one program.
  4. Final simplification66.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -8.2 \cdot 10^{+67}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{elif}\;\ell \leq 3.5 \cdot 10^{-296}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 13: 66.1% accurate, 1.4× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -9 \cdot 10^{+67}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{elif}\;\ell \leq 1.52 \cdot 10^{-291}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{h}{\frac{\ell}{0.5}} \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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+67)
   (* (- d) (sqrt (/ 1.0 (* l h))))
   (if (<= l 1.52e-291)
     (*
      (sqrt (* (/ d l) (/ d h)))
      (- 1.0 (* (/ h (/ l 0.5)) (pow (* (* 0.5 M) (/ D d)) 2.0))))
     (if (<= l 4.6e+116)
       (*
        (- 1.0 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l))))
        (* d (pow (* l h) -0.5)))
       (* d (* (pow l -0.5) (pow h -0.5)))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -9e+67) {
		tmp = -d * sqrt((1.0 / (l * h)));
	} else if (l <= 1.52e-291) {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((h / (l / 0.5)) * pow(((0.5 * M) * (D / d)), 2.0)));
	} else if (l <= 4.6e+116) {
		tmp = (1.0 - (pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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+67)) then
        tmp = -d * sqrt((1.0d0 / (l * h)))
    else if (l <= 1.52d-291) then
        tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - ((h / (l / 0.5d0)) * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0)))
    else if (l <= 4.6d+116) then
        tmp = (1.0d0 - ((((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l)))) * (d * ((l * h) ** (-0.5d0)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -9e+67) {
		tmp = -d * Math.sqrt((1.0 / (l * h)));
	} else if (l <= 1.52e-291) {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - ((h / (l / 0.5)) * Math.pow(((0.5 * M) * (D / d)), 2.0)));
	} else if (l <= 4.6e+116) {
		tmp = (1.0 - (Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if l <= -9e+67:
		tmp = -d * math.sqrt((1.0 / (l * h)))
	elif l <= 1.52e-291:
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - ((h / (l / 0.5)) * math.pow(((0.5 * M) * (D / d)), 2.0)))
	elif l <= 4.6e+116:
		tmp = (1.0 - (math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * math.pow((l * h), -0.5))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -9e+67)
		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h))));
	elseif (l <= 1.52e-291)
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64(h / Float64(l / 0.5)) * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))));
	elseif (l <= 4.6e+116)
		tmp = Float64(Float64(1.0 - Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l)))) * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -9e+67)
		tmp = -d * sqrt((1.0 / (l * h)));
	elseif (l <= 1.52e-291)
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((h / (l / 0.5)) * (((0.5 * M) * (D / d)) ^ 2.0)));
	elseif (l <= 4.6e+116)
		tmp = (1.0 - ((((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l)))) * (d * ((l * h) ^ -0.5));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -9e+67], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.52e-291], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(h / N[(l / 0.5), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(1.0 - N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9 \cdot 10^{+67}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -8.9999999999999997e67

    1. Initial program 50.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*50.5%

        \[\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-eval50.5%

        \[\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/250.5%

        \[\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-eval50.5%

        \[\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/250.5%

        \[\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*50.5%

        \[\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-eval50.5%

        \[\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-frac50.5%

        \[\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. Simplified50.5%

      \[\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. frac-2neg50.5%

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    6. Taylor expanded in d around -inf 54.8%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg54.8%

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

        \[\leadsto -d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. distribute-rgt-neg-in54.8%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    8. Simplified54.8%

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

    if -8.9999999999999997e67 < l < 1.52000000000000008e-291

    1. Initial program 82.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-eval82.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/282.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-eval82.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/282.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. *-commutative82.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*82.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-frac79.8%

        \[\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-eval79.8%

        \[\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. Simplified79.8%

      \[\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. associate-*r*79.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. frac-times82.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) \]
      3. *-commutative82.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) \]
      4. metadata-eval82.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) \]
      5. add-sqr-sqrt82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.52000000000000008e-291 < l < 4.5999999999999999e116

    1. Initial program 73.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. Step-by-step derivation
      1. expm1-log1p-u33.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef22.7%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr17.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot \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|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      8. fabs-sqr76.7%

        \[\leadsto \left(d \cdot \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)}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      9. sqr-pow76.9%

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

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

    if 4.5999999999999999e116 < l

    1. Initial program 53.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 60.0%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 4 regimes into one program.
  4. Final simplification69.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -9 \cdot 10^{+67}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{elif}\;\ell \leq 1.52 \cdot 10^{-291}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{h}{\frac{\ell}{0.5}} \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 14: 70.3% accurate, 1.4× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ t_1 := 0.5 \cdot \frac{h}{\ell}\\ t_2 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot t_1\\ \mathbf{if}\;\ell \leq -2.55 \cdot 10^{-117}:\\ \;\;\;\;t_0 \cdot \left(t_2 + -1\right)\\ \mathbf{elif}\;\ell \leq 5.4 \cdot 10^{-205}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - t_1 \cdot {\left(0.5 \cdot \frac{D}{\frac{d}{M}}\right)}^{2}\right)\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - t_2\right) \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* d (pow (* l h) -0.5)))
        (t_1 (* 0.5 (/ h l)))
        (t_2 (* (pow (/ (* D (* 0.5 M)) d) 2.0) t_1)))
   (if (<= l -2.55e-117)
     (* t_0 (+ t_2 -1.0))
     (if (<= l 5.4e-205)
       (*
        (sqrt (* (/ d l) (/ d h)))
        (- 1.0 (* t_1 (pow (* 0.5 (/ D (/ d M))) 2.0))))
       (if (<= l 4.6e+116)
         (* (- 1.0 t_2) t_0)
         (* d (* (pow l -0.5) (pow h -0.5))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = d * pow((l * h), -0.5);
	double t_1 = 0.5 * (h / l);
	double t_2 = pow(((D * (0.5 * M)) / d), 2.0) * t_1;
	double tmp;
	if (l <= -2.55e-117) {
		tmp = t_0 * (t_2 + -1.0);
	} else if (l <= 5.4e-205) {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (t_1 * pow((0.5 * (D / (d / M))), 2.0)));
	} else if (l <= 4.6e+116) {
		tmp = (1.0 - t_2) * t_0;
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 = d * ((l * h) ** (-0.5d0))
    t_1 = 0.5d0 * (h / l)
    t_2 = (((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * t_1
    if (l <= (-2.55d-117)) then
        tmp = t_0 * (t_2 + (-1.0d0))
    else if (l <= 5.4d-205) then
        tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (t_1 * ((0.5d0 * (d_1 / (d / m))) ** 2.0d0)))
    else if (l <= 4.6d+116) then
        tmp = (1.0d0 - t_2) * t_0
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = d * Math.pow((l * h), -0.5);
	double t_1 = 0.5 * (h / l);
	double t_2 = Math.pow(((D * (0.5 * M)) / d), 2.0) * t_1;
	double tmp;
	if (l <= -2.55e-117) {
		tmp = t_0 * (t_2 + -1.0);
	} else if (l <= 5.4e-205) {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (t_1 * Math.pow((0.5 * (D / (d / M))), 2.0)));
	} else if (l <= 4.6e+116) {
		tmp = (1.0 - t_2) * t_0;
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = d * math.pow((l * h), -0.5)
	t_1 = 0.5 * (h / l)
	t_2 = math.pow(((D * (0.5 * M)) / d), 2.0) * t_1
	tmp = 0
	if l <= -2.55e-117:
		tmp = t_0 * (t_2 + -1.0)
	elif l <= 5.4e-205:
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (t_1 * math.pow((0.5 * (D / (d / M))), 2.0)))
	elif l <= 4.6e+116:
		tmp = (1.0 - t_2) * t_0
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(d * (Float64(l * h) ^ -0.5))
	t_1 = Float64(0.5 * Float64(h / l))
	t_2 = Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * t_1)
	tmp = 0.0
	if (l <= -2.55e-117)
		tmp = Float64(t_0 * Float64(t_2 + -1.0));
	elseif (l <= 5.4e-205)
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(t_1 * (Float64(0.5 * Float64(D / Float64(d / M))) ^ 2.0))));
	elseif (l <= 4.6e+116)
		tmp = Float64(Float64(1.0 - t_2) * t_0);
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = d * ((l * h) ^ -0.5);
	t_1 = 0.5 * (h / l);
	t_2 = (((D * (0.5 * M)) / d) ^ 2.0) * t_1;
	tmp = 0.0;
	if (l <= -2.55e-117)
		tmp = t_0 * (t_2 + -1.0);
	elseif (l <= 5.4e-205)
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (t_1 * ((0.5 * (D / (d / M))) ^ 2.0)));
	elseif (l <= 4.6e+116)
		tmp = (1.0 - t_2) * t_0;
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[l, -2.55e-117], N[(t$95$0 * N[(t$95$2 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.4e-205], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(t$95$1 * N[Power[N[(0.5 * N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(1.0 - t$95$2), $MachinePrecision] * t$95$0), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
t_1 := 0.5 \cdot \frac{h}{\ell}\\
t_2 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot t_1\\
\mathbf{if}\;\ell \leq -2.55 \cdot 10^{-117}:\\
\;\;\;\;t_0 \cdot \left(t_2 + -1\right)\\

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

\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - t_2\right) \cdot t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -2.5500000000000001e-117

    1. Initial program 66.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. Step-by-step derivation
      1. expm1-log1p-u40.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef25.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr22.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot \left(-\left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right|\right)\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      8. sqr-pow69.9%

        \[\leadsto \left(d \cdot \left(-\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|\right)\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      9. fabs-sqr69.9%

        \[\leadsto \left(d \cdot \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)\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      10. sqr-pow69.9%

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

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

    if -2.5500000000000001e-117 < l < 5.4000000000000002e-205

    1. Initial program 75.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. expm1-log1p-u19.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef17.7%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr15.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.4000000000000002e-205 < l < 4.5999999999999999e116

    1. Initial program 75.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. Step-by-step derivation
      1. expm1-log1p-u40.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef27.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr19.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      7. sqr-pow83.0%

        \[\leadsto \left(d \cdot \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|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      8. fabs-sqr83.0%

        \[\leadsto \left(d \cdot \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)}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      9. sqr-pow83.2%

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

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

    if 4.5999999999999999e116 < l

    1. Initial program 53.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 60.0%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 4 regimes into one program.
  4. Final simplification74.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.55 \cdot 10^{-117}:\\ \;\;\;\;\left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right) \cdot \left({\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\ \mathbf{elif}\;\ell \leq 5.4 \cdot 10^{-205}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(0.5 \cdot \frac{D}{\frac{d}{M}}\right)}^{2}\right)\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 15: 70.5% accurate, 1.4× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := 0.5 \cdot \frac{h}{\ell}\\ t_1 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot t_0\\ \mathbf{if}\;\ell \leq -2.7 \cdot 10^{-117}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_1 + -1\right)\\ \mathbf{elif}\;\ell \leq 5.2 \cdot 10^{-203}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - t_0 \cdot {\left(0.5 \cdot \frac{D}{\frac{d}{M}}\right)}^{2}\right)\\ \mathbf{elif}\;\ell \leq 5.4 \cdot 10^{+115}:\\ \;\;\;\;\left(1 - t_1\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* 0.5 (/ h l))) (t_1 (* (pow (/ (* D (* 0.5 M)) d) 2.0) t_0)))
   (if (<= l -2.7e-117)
     (* (* d (sqrt (/ (/ 1.0 l) h))) (+ t_1 -1.0))
     (if (<= l 5.2e-203)
       (*
        (sqrt (* (/ d l) (/ d h)))
        (- 1.0 (* t_0 (pow (* 0.5 (/ D (/ d M))) 2.0))))
       (if (<= l 5.4e+115)
         (* (- 1.0 t_1) (* d (pow (* l h) -0.5)))
         (* d (* (pow l -0.5) (pow h -0.5))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = 0.5 * (h / l);
	double t_1 = pow(((D * (0.5 * M)) / d), 2.0) * t_0;
	double tmp;
	if (l <= -2.7e-117) {
		tmp = (d * sqrt(((1.0 / l) / h))) * (t_1 + -1.0);
	} else if (l <= 5.2e-203) {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (t_0 * pow((0.5 * (D / (d / M))), 2.0)));
	} else if (l <= 5.4e+115) {
		tmp = (1.0 - t_1) * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.5d0 * (h / l)
    t_1 = (((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * t_0
    if (l <= (-2.7d-117)) then
        tmp = (d * sqrt(((1.0d0 / l) / h))) * (t_1 + (-1.0d0))
    else if (l <= 5.2d-203) then
        tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (t_0 * ((0.5d0 * (d_1 / (d / m))) ** 2.0d0)))
    else if (l <= 5.4d+115) then
        tmp = (1.0d0 - t_1) * (d * ((l * h) ** (-0.5d0)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = 0.5 * (h / l);
	double t_1 = Math.pow(((D * (0.5 * M)) / d), 2.0) * t_0;
	double tmp;
	if (l <= -2.7e-117) {
		tmp = (d * Math.sqrt(((1.0 / l) / h))) * (t_1 + -1.0);
	} else if (l <= 5.2e-203) {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (t_0 * Math.pow((0.5 * (D / (d / M))), 2.0)));
	} else if (l <= 5.4e+115) {
		tmp = (1.0 - t_1) * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = 0.5 * (h / l)
	t_1 = math.pow(((D * (0.5 * M)) / d), 2.0) * t_0
	tmp = 0
	if l <= -2.7e-117:
		tmp = (d * math.sqrt(((1.0 / l) / h))) * (t_1 + -1.0)
	elif l <= 5.2e-203:
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (t_0 * math.pow((0.5 * (D / (d / M))), 2.0)))
	elif l <= 5.4e+115:
		tmp = (1.0 - t_1) * (d * math.pow((l * h), -0.5))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(0.5 * Float64(h / l))
	t_1 = Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * t_0)
	tmp = 0.0
	if (l <= -2.7e-117)
		tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(t_1 + -1.0));
	elseif (l <= 5.2e-203)
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(t_0 * (Float64(0.5 * Float64(D / Float64(d / M))) ^ 2.0))));
	elseif (l <= 5.4e+115)
		tmp = Float64(Float64(1.0 - t_1) * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = 0.5 * (h / l);
	t_1 = (((D * (0.5 * M)) / d) ^ 2.0) * t_0;
	tmp = 0.0;
	if (l <= -2.7e-117)
		tmp = (d * sqrt(((1.0 / l) / h))) * (t_1 + -1.0);
	elseif (l <= 5.2e-203)
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (t_0 * ((0.5 * (D / (d / M))) ^ 2.0)));
	elseif (l <= 5.4e+115)
		tmp = (1.0 - t_1) * (d * ((l * h) ^ -0.5));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(h / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[l, -2.7e-117], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.2e-203], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(t$95$0 * N[Power[N[(0.5 * N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.4e+115], N[(N[(1.0 - t$95$1), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{h}{\ell}\\
t_1 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot t_0\\
\mathbf{if}\;\ell \leq -2.7 \cdot 10^{-117}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_1 + -1\right)\\

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

\mathbf{elif}\;\ell \leq 5.4 \cdot 10^{+115}:\\
\;\;\;\;\left(1 - t_1\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -2.70000000000000003e-117

    1. Initial program 66.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. Step-by-step derivation
      1. expm1-log1p-u40.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef25.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr22.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.70000000000000003e-117 < l < 5.19999999999999951e-203

    1. Initial program 75.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. expm1-log1p-u19.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef17.7%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr15.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.19999999999999951e-203 < l < 5.40000000000000008e115

    1. Initial program 75.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. Step-by-step derivation
      1. expm1-log1p-u40.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef27.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr19.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      7. sqr-pow83.0%

        \[\leadsto \left(d \cdot \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|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      8. fabs-sqr83.0%

        \[\leadsto \left(d \cdot \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)}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      9. sqr-pow83.2%

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

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

    if 5.40000000000000008e115 < l

    1. Initial program 53.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 60.0%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 4 regimes into one program.
  4. Final simplification74.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.7 \cdot 10^{-117}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left({\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\ \mathbf{elif}\;\ell \leq 5.2 \cdot 10^{-203}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(0.5 \cdot \frac{D}{\frac{d}{M}}\right)}^{2}\right)\\ \mathbf{elif}\;\ell \leq 5.4 \cdot 10^{+115}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 16: 64.4% accurate, 1.5× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := 1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;\ell \leq 7 \cdot 10^{-203}:\\ \;\;\;\;t_0 \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;\ell \leq 2.7 \cdot 10^{+116}:\\ \;\;\;\;t_0 \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (- 1.0 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l))))))
   (if (<= l 7e-203)
     (* t_0 (sqrt (* (/ d l) (/ d h))))
     (if (<= l 2.7e+116)
       (* t_0 (* d (pow (* l h) -0.5)))
       (* d (* (pow l -0.5) (pow h -0.5)))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = 1.0 - (pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)));
	double tmp;
	if (l <= 7e-203) {
		tmp = t_0 * sqrt(((d / l) * (d / h)));
	} else if (l <= 2.7e+116) {
		tmp = t_0 * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 = 1.0d0 - ((((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l)))
    if (l <= 7d-203) then
        tmp = t_0 * sqrt(((d / l) * (d / h)))
    else if (l <= 2.7d+116) then
        tmp = t_0 * (d * ((l * h) ** (-0.5d0)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = 1.0 - (Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)));
	double tmp;
	if (l <= 7e-203) {
		tmp = t_0 * Math.sqrt(((d / l) * (d / h)));
	} else if (l <= 2.7e+116) {
		tmp = t_0 * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = 1.0 - (math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))
	tmp = 0
	if l <= 7e-203:
		tmp = t_0 * math.sqrt(((d / l) * (d / h)))
	elif l <= 2.7e+116:
		tmp = t_0 * (d * math.pow((l * h), -0.5))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(1.0 - Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l))))
	tmp = 0.0
	if (l <= 7e-203)
		tmp = Float64(t_0 * sqrt(Float64(Float64(d / l) * Float64(d / h))));
	elseif (l <= 2.7e+116)
		tmp = Float64(t_0 * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = 1.0 - ((((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l)));
	tmp = 0.0;
	if (l <= 7e-203)
		tmp = t_0 * sqrt(((d / l) * (d / h)));
	elseif (l <= 2.7e+116)
		tmp = t_0 * (d * ((l * h) ^ -0.5));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(1.0 - N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 7e-203], N[(t$95$0 * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.7e+116], N[(t$95$0 * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;\ell \leq 7 \cdot 10^{-203}:\\
\;\;\;\;t_0 \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\

\mathbf{elif}\;\ell \leq 2.7 \cdot 10^{+116}:\\
\;\;\;\;t_0 \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < 7.0000000000000003e-203

    1. Initial program 70.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. Step-by-step derivation
      1. expm1-log1p-u31.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef22.3%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr19.4%

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

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

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

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

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

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

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

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

    if 7.0000000000000003e-203 < l < 2.7e116

    1. Initial program 75.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. Step-by-step derivation
      1. expm1-log1p-u40.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef27.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr19.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      7. sqr-pow83.0%

        \[\leadsto \left(d \cdot \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|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      8. fabs-sqr83.0%

        \[\leadsto \left(d \cdot \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)}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      9. sqr-pow83.2%

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

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

    if 2.7e116 < l

    1. Initial program 53.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 60.0%

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

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

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.5%

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

Alternative 17: 64.4% accurate, 1.5× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := 1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;\ell \leq 4 \cdot 10^{-205}:\\ \;\;\;\;t_0 \cdot \sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}}\\ \mathbf{elif}\;\ell \leq 5.8 \cdot 10^{+114}:\\ \;\;\;\;t_0 \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (- 1.0 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l))))))
   (if (<= l 4e-205)
     (* t_0 (sqrt (/ (/ d h) (/ l d))))
     (if (<= l 5.8e+114)
       (* t_0 (* d (pow (* l h) -0.5)))
       (* d (* (pow l -0.5) (pow h -0.5)))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = 1.0 - (pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)));
	double tmp;
	if (l <= 4e-205) {
		tmp = t_0 * sqrt(((d / h) / (l / d)));
	} else if (l <= 5.8e+114) {
		tmp = t_0 * (d * pow((l * h), -0.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 = 1.0d0 - ((((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l)))
    if (l <= 4d-205) then
        tmp = t_0 * sqrt(((d / h) / (l / d)))
    else if (l <= 5.8d+114) then
        tmp = t_0 * (d * ((l * h) ** (-0.5d0)))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = 1.0 - (Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)));
	double tmp;
	if (l <= 4e-205) {
		tmp = t_0 * Math.sqrt(((d / h) / (l / d)));
	} else if (l <= 5.8e+114) {
		tmp = t_0 * (d * Math.pow((l * h), -0.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = 1.0 - (math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))
	tmp = 0
	if l <= 4e-205:
		tmp = t_0 * math.sqrt(((d / h) / (l / d)))
	elif l <= 5.8e+114:
		tmp = t_0 * (d * math.pow((l * h), -0.5))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(1.0 - Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l))))
	tmp = 0.0
	if (l <= 4e-205)
		tmp = Float64(t_0 * sqrt(Float64(Float64(d / h) / Float64(l / d))));
	elseif (l <= 5.8e+114)
		tmp = Float64(t_0 * Float64(d * (Float64(l * h) ^ -0.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = 1.0 - ((((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l)));
	tmp = 0.0;
	if (l <= 4e-205)
		tmp = t_0 * sqrt(((d / h) / (l / d)));
	elseif (l <= 5.8e+114)
		tmp = t_0 * (d * ((l * h) ^ -0.5));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(1.0 - N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 4e-205], N[(t$95$0 * N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.8e+114], N[(t$95$0 * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;\ell \leq 4 \cdot 10^{-205}:\\
\;\;\;\;t_0 \cdot \sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}}\\

\mathbf{elif}\;\ell \leq 5.8 \cdot 10^{+114}:\\
\;\;\;\;t_0 \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < 4e-205

    1. Initial program 70.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. Step-by-step derivation
      1. expm1-log1p-u31.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef22.3%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr19.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4e-205 < l < 5.8000000000000001e114

    1. Initial program 75.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. Step-by-step derivation
      1. expm1-log1p-u40.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef27.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr19.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def28.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)\right)} \]
      2. expm1-log1p55.9%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)} \]
      3. *-commutative55.9%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      4. associate-*r/57.3%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\color{blue}{\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      5. *-commutative57.3%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{\color{blue}{D \cdot \left(M \cdot 0.5\right)}}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      6. *-commutative57.3%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \color{blue}{\left(0.5 \cdot \frac{h}{\ell}\right)}\right) \]
    5. Simplified57.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    6. Taylor expanded in d around 0 83.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    7. Step-by-step derivation
      1. *-commutative83.3%

        \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      2. *-commutative83.3%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      3. unpow-183.3%

        \[\leadsto \left(d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      4. sqr-pow83.2%

        \[\leadsto \left(d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      5. rem-sqrt-square83.2%

        \[\leadsto \left(d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}\right|}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      6. metadata-eval83.2%

        \[\leadsto \left(d \cdot \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      7. sqr-pow83.0%

        \[\leadsto \left(d \cdot \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|\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      8. fabs-sqr83.0%

        \[\leadsto \left(d \cdot \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)}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
      9. sqr-pow83.2%

        \[\leadsto \left(d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}}\right) \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]
    8. Simplified83.2%

      \[\leadsto \color{blue}{\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \]

    if 5.8000000000000001e114 < l

    1. Initial program 53.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 60.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity60.0%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative60.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr60.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity60.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-160.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow60.1%

        \[\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 \]
      4. rem-sqrt-square60.1%

        \[\leadsto \color{blue}{\left|{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}\right|} \cdot d \]
      5. metadata-eval60.1%

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow59.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 \]
      7. fabs-sqr59.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 \]
      8. sqr-pow60.1%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative60.1%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down75.1%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr75.1%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 4 \cdot 10^{-205}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}}\\ \mathbf{elif}\;\ell \leq 5.8 \cdot 10^{+114}:\\ \;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 18: 55.5% accurate, 1.5× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{if}\;d \leq 6.8 \cdot 10^{-304}:\\ \;\;\;\;t_0 \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\ \mathbf{elif}\;d \leq 3.8 \cdot 10^{-147}:\\ \;\;\;\;-0.125 \cdot \frac{M \cdot \left(D \cdot \left(M \cdot D\right)\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\ \mathbf{elif}\;d \leq 3.7 \cdot 10^{+82}:\\ \;\;\;\;t_0 \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 l) (/ d h)))))
   (if (<= d 6.8e-304)
     (* t_0 (- 1.0 (* (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d))) 0.125)))
     (if (<= d 3.8e-147)
       (* -0.125 (/ (* M (* D (* M D))) (/ d (sqrt (/ h (pow l 3.0))))))
       (if (<= d 3.7e+82)
         (* t_0 (- 1.0 (* 0.125 (* (/ D (/ l D)) (/ (* M M) (/ d (/ h d)))))))
         (* d (* (pow l -0.5) (pow h -0.5))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt(((d / l) * (d / h)));
	double tmp;
	if (d <= 6.8e-304) {
		tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	} else if (d <= 3.8e-147) {
		tmp = -0.125 * ((M * (D * (M * D))) / (d / sqrt((h / pow(l, 3.0)))));
	} else if (d <= 3.7e+82) {
		tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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(((d / l) * (d / h)))
    if (d <= 6.8d-304) then
        tmp = t_0 * (1.0d0 - (((d_1 / (((d / m) / m) / d_1)) * (h / (l * d))) * 0.125d0))
    else if (d <= 3.8d-147) then
        tmp = (-0.125d0) * ((m * (d_1 * (m * d_1))) / (d / sqrt((h / (l ** 3.0d0)))))
    else if (d <= 3.7d+82) then
        tmp = t_0 * (1.0d0 - (0.125d0 * ((d_1 / (l / d_1)) * ((m * m) / (d / (h / d))))))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt(((d / l) * (d / h)));
	double tmp;
	if (d <= 6.8e-304) {
		tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	} else if (d <= 3.8e-147) {
		tmp = -0.125 * ((M * (D * (M * D))) / (d / Math.sqrt((h / Math.pow(l, 3.0)))));
	} else if (d <= 3.7e+82) {
		tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt(((d / l) * (d / h)))
	tmp = 0
	if d <= 6.8e-304:
		tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125))
	elif d <= 3.8e-147:
		tmp = -0.125 * ((M * (D * (M * D))) / (d / math.sqrt((h / math.pow(l, 3.0)))))
	elif d <= 3.7e+82:
		tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(Float64(d / l) * Float64(d / h)))
	tmp = 0.0
	if (d <= 6.8e-304)
		tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d))) * 0.125)));
	elseif (d <= 3.8e-147)
		tmp = Float64(-0.125 * Float64(Float64(M * Float64(D * Float64(M * D))) / Float64(d / sqrt(Float64(h / (l ^ 3.0))))));
	elseif (d <= 3.7e+82)
		tmp = Float64(t_0 * Float64(1.0 - Float64(0.125 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M * M) / Float64(d / Float64(h / d)))))));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt(((d / l) * (d / h)));
	tmp = 0.0;
	if (d <= 6.8e-304)
		tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	elseif (d <= 3.8e-147)
		tmp = -0.125 * ((M * (D * (M * D))) / (d / sqrt((h / (l ^ 3.0)))));
	elseif (d <= 3.7e+82)
		tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, 6.8e-304], N[(t$95$0 * N[(1.0 - N[(N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.8e-147], N[(-0.125 * N[(N[(M * N[(D * N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d / N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.7e+82], N[(t$95$0 * N[(1.0 - N[(0.125 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(d / N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{if}\;d \leq 6.8 \cdot 10^{-304}:\\
\;\;\;\;t_0 \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\

\mathbf{elif}\;d \leq 3.8 \cdot 10^{-147}:\\
\;\;\;\;-0.125 \cdot \frac{M \cdot \left(D \cdot \left(M \cdot D\right)\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\

\mathbf{elif}\;d \leq 3.7 \cdot 10^{+82}:\\
\;\;\;\;t_0 \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < 6.7999999999999997e-304

    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. Step-by-step derivation
      1. expm1-log1p-u35.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef24.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr21.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def30.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)\right)} \]
      2. expm1-log1p58.7%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)} \]
      3. *-commutative58.7%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      4. associate-*r/60.8%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\color{blue}{\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      5. *-commutative60.8%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{\color{blue}{D \cdot \left(M \cdot 0.5\right)}}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      6. *-commutative60.8%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \color{blue}{\left(0.5 \cdot \frac{h}{\ell}\right)}\right) \]
    5. Simplified60.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    6. Taylor expanded in D around 0 29.1%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}}\right) \]
    7. Step-by-step derivation
      1. associate-*r/29.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \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. *-commutative29.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \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/29.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\right) \]
      4. *-commutative29.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.125}\right) \]
      5. associate-*r*31.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.125\right) \]
      6. unpow231.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{\color{blue}{\left(d \cdot d\right)} \cdot \ell} \cdot 0.125\right) \]
      7. associate-*l*33.5%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{\color{blue}{d \cdot \left(d \cdot \ell\right)}} \cdot 0.125\right) \]
      8. times-frac38.4%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \frac{h}{d \cdot \ell}\right)} \cdot 0.125\right) \]
      9. associate-/l*38.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{{D}^{2}}{\frac{d}{{M}^{2}}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      10. unpow238.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{\color{blue}{D \cdot D}}{\frac{d}{{M}^{2}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      11. associate-/l*44.2%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{D}{\frac{\frac{d}{{M}^{2}}}{D}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      12. unpow244.2%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{d}{\color{blue}{M \cdot M}}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      13. associate-/r*47.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\color{blue}{\frac{\frac{d}{M}}{M}}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
    8. Simplified47.6%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125}\right) \]

    if 6.7999999999999997e-304 < d < 3.80000000000000028e-147

    1. Initial program 38.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. Taylor expanded in d around 0 34.7%

      \[\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/37.3%

        \[\leadsto -0.125 \cdot \color{blue}{\frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d}} \]
      2. *-commutative37.3%

        \[\leadsto -0.125 \cdot \frac{\color{blue}{\left({M}^{2} \cdot {D}^{2}\right)} \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d} \]
      3. unpow237.3%

        \[\leadsto -0.125 \cdot \frac{\left(\color{blue}{\left(M \cdot M\right)} \cdot {D}^{2}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d} \]
      4. unpow237.3%

        \[\leadsto -0.125 \cdot \frac{\left(\left(M \cdot M\right) \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d} \]
      5. swap-sqr52.3%

        \[\leadsto -0.125 \cdot \frac{\color{blue}{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right)} \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d} \]
      6. associate-/l*48.6%

        \[\leadsto -0.125 \cdot \color{blue}{\frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}} \]
      7. associate-*l*48.6%

        \[\leadsto -0.125 \cdot \frac{\color{blue}{M \cdot \left(D \cdot \left(M \cdot D\right)\right)}}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}} \]
      8. *-commutative48.6%

        \[\leadsto -0.125 \cdot \frac{M \cdot \left(D \cdot \color{blue}{\left(D \cdot M\right)}\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}} \]
    4. Simplified48.6%

      \[\leadsto \color{blue}{-0.125 \cdot \frac{M \cdot \left(D \cdot \left(D \cdot M\right)\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}} \]

    if 3.80000000000000028e-147 < d < 3.7000000000000002e82

    1. Initial program 88.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. expm1-log1p-u41.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef17.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr17.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def36.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)\right)} \]
      2. expm1-log1p76.4%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)} \]
      3. *-commutative76.4%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      4. associate-*r/78.2%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\color{blue}{\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      5. *-commutative78.2%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{\color{blue}{D \cdot \left(M \cdot 0.5\right)}}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      6. *-commutative78.2%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \color{blue}{\left(0.5 \cdot \frac{h}{\ell}\right)}\right) \]
    5. Simplified78.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    6. Taylor expanded in D around 0 61.7%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}}\right) \]
    7. Step-by-step derivation
      1. *-commutative61.7%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}} \cdot 0.125}\right) \]
      2. times-frac67.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)} \cdot 0.125\right) \]
      3. unpow267.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right) \cdot 0.125\right) \]
      4. associate-/l*70.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{D}{\frac{\ell}{D}}} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right) \cdot 0.125\right) \]
      5. associate-/l*70.8%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \color{blue}{\frac{{M}^{2}}{\frac{{d}^{2}}{h}}}\right) \cdot 0.125\right) \]
      6. unpow270.8%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{\color{blue}{M \cdot M}}{\frac{{d}^{2}}{h}}\right) \cdot 0.125\right) \]
      7. unpow270.8%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{\color{blue}{d \cdot d}}{h}}\right) \cdot 0.125\right) \]
      8. associate-/l*70.8%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\color{blue}{\frac{d}{\frac{h}{d}}}}\right) \cdot 0.125\right) \]
    8. Simplified70.8%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right) \cdot 0.125}\right) \]

    if 3.7000000000000002e82 < d

    1. Initial program 66.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 72.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity72.0%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative72.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr72.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity72.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-172.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow72.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 d \]
      4. rem-sqrt-square72.0%

        \[\leadsto \color{blue}{\left|{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}\right|} \cdot d \]
      5. metadata-eval72.0%

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow71.7%

        \[\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 \]
      7. fabs-sqr71.7%

        \[\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 \]
      8. sqr-pow72.0%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified72.0%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative72.0%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down84.3%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr84.3%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 4 regimes into one program.
  4. Final simplification59.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 6.8 \cdot 10^{-304}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\ \mathbf{elif}\;d \leq 3.8 \cdot 10^{-147}:\\ \;\;\;\;-0.125 \cdot \frac{M \cdot \left(D \cdot \left(M \cdot D\right)\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\ \mathbf{elif}\;d \leq 3.7 \cdot 10^{+82}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 19: 55.5% accurate, 1.5× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{if}\;d \leq 6.8 \cdot 10^{-304}:\\ \;\;\;\;t_0 \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\ \mathbf{elif}\;d \leq 2.9 \cdot 10^{-147}:\\ \;\;\;\;\frac{-0.125}{\frac{d}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\\ \mathbf{elif}\;d \leq 3.2 \cdot 10^{+82}:\\ \;\;\;\;t_0 \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 l) (/ d h)))))
   (if (<= d 6.8e-304)
     (* t_0 (- 1.0 (* (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d))) 0.125)))
     (if (<= d 2.9e-147)
       (* (/ -0.125 (/ d (* (* M D) (* M D)))) (sqrt (/ h (pow l 3.0))))
       (if (<= d 3.2e+82)
         (* t_0 (- 1.0 (* 0.125 (* (/ D (/ l D)) (/ (* M M) (/ d (/ h d)))))))
         (* d (* (pow l -0.5) (pow h -0.5))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt(((d / l) * (d / h)));
	double tmp;
	if (d <= 6.8e-304) {
		tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	} else if (d <= 2.9e-147) {
		tmp = (-0.125 / (d / ((M * D) * (M * D)))) * sqrt((h / pow(l, 3.0)));
	} else if (d <= 3.2e+82) {
		tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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(((d / l) * (d / h)))
    if (d <= 6.8d-304) then
        tmp = t_0 * (1.0d0 - (((d_1 / (((d / m) / m) / d_1)) * (h / (l * d))) * 0.125d0))
    else if (d <= 2.9d-147) then
        tmp = ((-0.125d0) / (d / ((m * d_1) * (m * d_1)))) * sqrt((h / (l ** 3.0d0)))
    else if (d <= 3.2d+82) then
        tmp = t_0 * (1.0d0 - (0.125d0 * ((d_1 / (l / d_1)) * ((m * m) / (d / (h / d))))))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt(((d / l) * (d / h)));
	double tmp;
	if (d <= 6.8e-304) {
		tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	} else if (d <= 2.9e-147) {
		tmp = (-0.125 / (d / ((M * D) * (M * D)))) * Math.sqrt((h / Math.pow(l, 3.0)));
	} else if (d <= 3.2e+82) {
		tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt(((d / l) * (d / h)))
	tmp = 0
	if d <= 6.8e-304:
		tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125))
	elif d <= 2.9e-147:
		tmp = (-0.125 / (d / ((M * D) * (M * D)))) * math.sqrt((h / math.pow(l, 3.0)))
	elif d <= 3.2e+82:
		tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(Float64(d / l) * Float64(d / h)))
	tmp = 0.0
	if (d <= 6.8e-304)
		tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d))) * 0.125)));
	elseif (d <= 2.9e-147)
		tmp = Float64(Float64(-0.125 / Float64(d / Float64(Float64(M * D) * Float64(M * D)))) * sqrt(Float64(h / (l ^ 3.0))));
	elseif (d <= 3.2e+82)
		tmp = Float64(t_0 * Float64(1.0 - Float64(0.125 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M * M) / Float64(d / Float64(h / d)))))));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt(((d / l) * (d / h)));
	tmp = 0.0;
	if (d <= 6.8e-304)
		tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	elseif (d <= 2.9e-147)
		tmp = (-0.125 / (d / ((M * D) * (M * D)))) * sqrt((h / (l ^ 3.0)));
	elseif (d <= 3.2e+82)
		tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, 6.8e-304], N[(t$95$0 * N[(1.0 - N[(N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.9e-147], N[(N[(-0.125 / N[(d / N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.2e+82], N[(t$95$0 * N[(1.0 - N[(0.125 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(d / N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{if}\;d \leq 6.8 \cdot 10^{-304}:\\
\;\;\;\;t_0 \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\

\mathbf{elif}\;d \leq 2.9 \cdot 10^{-147}:\\
\;\;\;\;\frac{-0.125}{\frac{d}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\\

\mathbf{elif}\;d \leq 3.2 \cdot 10^{+82}:\\
\;\;\;\;t_0 \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < 6.7999999999999997e-304

    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. Step-by-step derivation
      1. expm1-log1p-u35.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef24.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr21.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def30.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)\right)} \]
      2. expm1-log1p58.7%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)} \]
      3. *-commutative58.7%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      4. associate-*r/60.8%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\color{blue}{\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      5. *-commutative60.8%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{\color{blue}{D \cdot \left(M \cdot 0.5\right)}}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      6. *-commutative60.8%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \color{blue}{\left(0.5 \cdot \frac{h}{\ell}\right)}\right) \]
    5. Simplified60.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    6. Taylor expanded in D around 0 29.1%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}}\right) \]
    7. Step-by-step derivation
      1. associate-*r/29.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \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. *-commutative29.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \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/29.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\right) \]
      4. *-commutative29.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.125}\right) \]
      5. associate-*r*31.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.125\right) \]
      6. unpow231.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{\color{blue}{\left(d \cdot d\right)} \cdot \ell} \cdot 0.125\right) \]
      7. associate-*l*33.5%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{\color{blue}{d \cdot \left(d \cdot \ell\right)}} \cdot 0.125\right) \]
      8. times-frac38.4%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \frac{h}{d \cdot \ell}\right)} \cdot 0.125\right) \]
      9. associate-/l*38.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{{D}^{2}}{\frac{d}{{M}^{2}}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      10. unpow238.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{\color{blue}{D \cdot D}}{\frac{d}{{M}^{2}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      11. associate-/l*44.2%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{D}{\frac{\frac{d}{{M}^{2}}}{D}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      12. unpow244.2%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{d}{\color{blue}{M \cdot M}}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      13. associate-/r*47.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\color{blue}{\frac{\frac{d}{M}}{M}}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
    8. Simplified47.6%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125}\right) \]

    if 6.7999999999999997e-304 < d < 2.9000000000000001e-147

    1. Initial program 38.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. Step-by-step derivation
      1. metadata-eval38.7%

        \[\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/238.7%

        \[\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-eval38.7%

        \[\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/238.7%

        \[\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. *-commutative38.7%

        \[\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*38.7%

        \[\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-frac36.0%

        \[\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-eval36.0%

        \[\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. Simplified36.0%

      \[\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. associate-*r*36.0%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot \frac{h}{\ell}}\right) \]
      2. frac-times38.7%

        \[\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) \]
      3. *-commutative38.7%

        \[\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) \]
      4. metadata-eval38.7%

        \[\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) \]
      5. add-sqr-sqrt38.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\sqrt{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}} \cdot \sqrt{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}}}\right) \]
      6. pow238.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}}\right)}^{2}}\right) \]
    5. Applied egg-rr39.5%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right) \cdot \sqrt{\frac{h}{\ell} \cdot 0.5}\right)}^{2}}\right) \]
    6. Step-by-step derivation
      1. pow139.5%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right) \cdot \sqrt{\frac{h}{\ell} \cdot 0.5}\right)}^{2}\right)\right)}^{1}} \]
      2. sqrt-unprod27.3%

        \[\leadsto {\left(\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - {\left(\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right) \cdot \sqrt{\frac{h}{\ell} \cdot 0.5}\right)}^{2}\right)\right)}^{1} \]
      3. *-commutative27.3%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\color{blue}{\left(\sqrt{\frac{h}{\ell} \cdot 0.5} \cdot \left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)\right)}}^{2}\right)\right)}^{1} \]
      4. metadata-eval27.3%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell} \cdot 0.5} \cdot \left(\left(M \cdot \color{blue}{\frac{1}{2}}\right) \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)}^{1} \]
      5. div-inv27.3%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell} \cdot 0.5} \cdot \left(\color{blue}{\frac{M}{2}} \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)}^{1} \]
      6. *-commutative27.3%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell} \cdot 0.5} \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{M}{2}\right)}\right)}^{2}\right)\right)}^{1} \]
      7. div-inv27.3%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell} \cdot 0.5} \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(M \cdot \frac{1}{2}\right)}\right)\right)}^{2}\right)\right)}^{1} \]
      8. metadata-eval27.3%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell} \cdot 0.5} \cdot \left(\frac{D}{d} \cdot \left(M \cdot \color{blue}{0.5}\right)\right)\right)}^{2}\right)\right)}^{1} \]
      9. *-commutative27.3%

        \[\leadsto {\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell} \cdot 0.5} \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(0.5 \cdot M\right)}\right)\right)}^{2}\right)\right)}^{1} \]
    7. Applied egg-rr27.3%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell} \cdot 0.5} \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)\right)}^{2}\right)\right)}^{1}} \]
    8. Step-by-step derivation
      1. unpow127.3%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell} \cdot 0.5} \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)\right)}^{2}\right)} \]
      2. *-commutative27.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\sqrt{\color{blue}{0.5 \cdot \frac{h}{\ell}}} \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)\right)}^{2}\right) \]
    9. Simplified27.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\sqrt{0.5 \cdot \frac{h}{\ell}} \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)\right)}^{2}\right)} \]
    10. Taylor expanded in d around 0 34.6%

      \[\leadsto \color{blue}{-0.25 \cdot \left(\frac{{\left(\sqrt{0.5}\right)}^{2} \cdot \left({D}^{2} \cdot {M}^{2}\right)}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    11. Step-by-step derivation
      1. associate-*r*34.6%

        \[\leadsto \color{blue}{\left(-0.25 \cdot \frac{{\left(\sqrt{0.5}\right)}^{2} \cdot \left({D}^{2} \cdot {M}^{2}\right)}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
      2. *-commutative34.6%

        \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.25 \cdot \frac{{\left(\sqrt{0.5}\right)}^{2} \cdot \left({D}^{2} \cdot {M}^{2}\right)}{d}\right)} \]
      3. associate-/l*34.6%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.25 \cdot \color{blue}{\frac{{\left(\sqrt{0.5}\right)}^{2}}{\frac{d}{{D}^{2} \cdot {M}^{2}}}}\right) \]
      4. unpow234.6%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.25 \cdot \frac{\color{blue}{\sqrt{0.5} \cdot \sqrt{0.5}}}{\frac{d}{{D}^{2} \cdot {M}^{2}}}\right) \]
      5. rem-square-sqrt34.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.25 \cdot \frac{\color{blue}{0.5}}{\frac{d}{{D}^{2} \cdot {M}^{2}}}\right) \]
      6. associate-*r/34.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\frac{-0.25 \cdot 0.5}{\frac{d}{{D}^{2} \cdot {M}^{2}}}} \]
      7. metadata-eval34.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{\color{blue}{-0.125}}{\frac{d}{{D}^{2} \cdot {M}^{2}}} \]
      8. unpow234.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{d}{\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}}} \]
      9. unpow234.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{d}{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}}} \]
      10. unswap-sqr49.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{d}{\color{blue}{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}}} \]
    12. Simplified49.7%

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{d}{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}}} \]

    if 2.9000000000000001e-147 < d < 3.19999999999999975e82

    1. Initial program 88.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. expm1-log1p-u41.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef17.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr17.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def36.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)\right)} \]
      2. expm1-log1p76.4%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)} \]
      3. *-commutative76.4%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      4. associate-*r/78.2%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\color{blue}{\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      5. *-commutative78.2%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{\color{blue}{D \cdot \left(M \cdot 0.5\right)}}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      6. *-commutative78.2%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \color{blue}{\left(0.5 \cdot \frac{h}{\ell}\right)}\right) \]
    5. Simplified78.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    6. Taylor expanded in D around 0 61.7%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}}\right) \]
    7. Step-by-step derivation
      1. *-commutative61.7%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}} \cdot 0.125}\right) \]
      2. times-frac67.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)} \cdot 0.125\right) \]
      3. unpow267.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right) \cdot 0.125\right) \]
      4. associate-/l*70.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{D}{\frac{\ell}{D}}} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right) \cdot 0.125\right) \]
      5. associate-/l*70.8%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \color{blue}{\frac{{M}^{2}}{\frac{{d}^{2}}{h}}}\right) \cdot 0.125\right) \]
      6. unpow270.8%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{\color{blue}{M \cdot M}}{\frac{{d}^{2}}{h}}\right) \cdot 0.125\right) \]
      7. unpow270.8%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{\color{blue}{d \cdot d}}{h}}\right) \cdot 0.125\right) \]
      8. associate-/l*70.8%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\color{blue}{\frac{d}{\frac{h}{d}}}}\right) \cdot 0.125\right) \]
    8. Simplified70.8%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right) \cdot 0.125}\right) \]

    if 3.19999999999999975e82 < d

    1. Initial program 66.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 72.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity72.0%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative72.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr72.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity72.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-172.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow72.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 d \]
      4. rem-sqrt-square72.0%

        \[\leadsto \color{blue}{\left|{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}\right|} \cdot d \]
      5. metadata-eval72.0%

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow71.7%

        \[\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 \]
      7. fabs-sqr71.7%

        \[\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 \]
      8. sqr-pow72.0%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified72.0%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative72.0%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down84.3%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr84.3%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 4 regimes into one program.
  4. Final simplification59.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 6.8 \cdot 10^{-304}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\ \mathbf{elif}\;d \leq 2.9 \cdot 10^{-147}:\\ \;\;\;\;\frac{-0.125}{\frac{d}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\\ \mathbf{elif}\;d \leq 3.2 \cdot 10^{+82}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 20: 51.7% accurate, 1.6× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;M \leq 6.4 \cdot 10^{-88}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;M \leq 1.8 \cdot 10^{-62}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= M 6.4e-88)
   (* (sqrt (/ d l)) (sqrt (/ d h)))
   (if (<= M 1.8e-62)
     (* d (* (pow l -0.5) (pow h -0.5)))
     (*
      (sqrt (* (/ d l) (/ d h)))
      (- 1.0 (* 0.125 (* (/ D (/ l D)) (/ (* M M) (/ d (/ h d))))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (M <= 6.4e-88) {
		tmp = sqrt((d / l)) * sqrt((d / h));
	} else if (M <= 1.8e-62) {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	} else {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 (m <= 6.4d-88) then
        tmp = sqrt((d / l)) * sqrt((d / h))
    else if (m <= 1.8d-62) then
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    else
        tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (0.125d0 * ((d_1 / (l / d_1)) * ((m * m) / (d / (h / d))))))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (M <= 6.4e-88) {
		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
	} else if (M <= 1.8e-62) {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	} else {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if M <= 6.4e-88:
		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
	elif M <= 1.8e-62:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	else:
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (M <= 6.4e-88)
		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
	elseif (M <= 1.8e-62)
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	else
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(0.125 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M * M) / Float64(d / Float64(h / d)))))));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (M <= 6.4e-88)
		tmp = sqrt((d / l)) * sqrt((d / h));
	elseif (M <= 1.8e-62)
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	else
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[M, 6.4e-88], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 1.8e-62], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(d / N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 6.4 \cdot 10^{-88}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

\mathbf{elif}\;M \leq 1.8 \cdot 10^{-62}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 6.40000000000000025e-88

    1. Initial program 67.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. associate-*l*67.8%

        \[\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-eval67.8%

        \[\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/267.8%

        \[\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-eval67.8%

        \[\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/267.8%

        \[\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. sub-neg67.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(1 + \left(-\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right)}\right) \]
      7. +-commutative67.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\left(-\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) + 1\right)}\right) \]
      8. *-commutative67.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(-\color{blue}{\frac{h}{\ell} \cdot \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)}\right) + 1\right)\right) \]
      9. distribute-rgt-neg-in67.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\color{blue}{\frac{h}{\ell} \cdot \left(-\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)} + 1\right)\right) \]
      10. fma-def67.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\mathsf{fma}\left(\frac{h}{\ell}, -\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}, 1\right)}\right) \]
    3. Simplified66.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2} \cdot -0.5, 1\right)\right)} \]
    4. Taylor expanded in h around 0 44.6%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]

    if 6.40000000000000025e-88 < M < 1.8e-62

    1. Initial program 40.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 79.7%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity79.7%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative79.7%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr79.7%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity79.7%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-179.7%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow79.7%

        \[\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 \]
      4. rem-sqrt-square79.7%

        \[\leadsto \color{blue}{\left|{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}\right|} \cdot d \]
      5. metadata-eval79.7%

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow79.4%

        \[\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 \]
      7. fabs-sqr79.4%

        \[\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 \]
      8. sqr-pow79.7%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified79.7%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative79.7%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down80.0%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr80.0%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]

    if 1.8e-62 < M

    1. Initial program 75.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. expm1-log1p-u19.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef12.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr10.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def17.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)\right)} \]
      2. expm1-log1p62.8%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)} \]
      3. *-commutative62.8%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      4. associate-*r/62.7%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\color{blue}{\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      5. *-commutative62.7%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{\color{blue}{D \cdot \left(M \cdot 0.5\right)}}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      6. *-commutative62.7%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \color{blue}{\left(0.5 \cdot \frac{h}{\ell}\right)}\right) \]
    5. Simplified62.7%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    6. Taylor expanded in D around 0 31.5%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}}\right) \]
    7. Step-by-step derivation
      1. *-commutative31.5%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}} \cdot 0.125}\right) \]
      2. times-frac34.4%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)} \cdot 0.125\right) \]
      3. unpow234.4%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right) \cdot 0.125\right) \]
      4. associate-/l*37.4%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{D}{\frac{\ell}{D}}} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right) \cdot 0.125\right) \]
      5. associate-/l*40.2%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \color{blue}{\frac{{M}^{2}}{\frac{{d}^{2}}{h}}}\right) \cdot 0.125\right) \]
      6. unpow240.2%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{\color{blue}{M \cdot M}}{\frac{{d}^{2}}{h}}\right) \cdot 0.125\right) \]
      7. unpow240.2%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{\color{blue}{d \cdot d}}{h}}\right) \cdot 0.125\right) \]
      8. associate-/l*49.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\color{blue}{\frac{d}{\frac{h}{d}}}}\right) \cdot 0.125\right) \]
    8. Simplified49.0%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right) \cdot 0.125}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification46.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 6.4 \cdot 10^{-88}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;M \leq 1.8 \cdot 10^{-62}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\ \end{array} \]

Alternative 21: 53.1% accurate, 1.6× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq 4.5 \cdot 10^{+84}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= d 4.5e+84)
   (*
    (sqrt (* (/ d l) (/ d h)))
    (- 1.0 (* (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d))) 0.125)))
   (* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= 4.5e+84) {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	} else {
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 <= 4.5d+84) then
        tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (((d_1 / (((d / m) / m) / d_1)) * (h / (l * d))) * 0.125d0))
    else
        tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= 4.5e+84) {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	} else {
		tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if d <= 4.5e+84:
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125))
	else:
		tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= 4.5e+84)
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d))) * 0.125)));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (d <= 4.5e+84)
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	else
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[d, 4.5e+84], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 4.5 \cdot 10^{+84}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 4.4999999999999997e84

    1. Initial program 70.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. expm1-log1p-u33.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef19.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr17.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def27.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)\right)} \]
      2. expm1-log1p57.3%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)} \]
      3. *-commutative57.3%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      4. associate-*r/59.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\color{blue}{\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      5. *-commutative59.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{\color{blue}{D \cdot \left(M \cdot 0.5\right)}}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      6. *-commutative59.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \color{blue}{\left(0.5 \cdot \frac{h}{\ell}\right)}\right) \]
    5. Simplified59.0%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    6. Taylor expanded in D around 0 33.9%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}}\right) \]
    7. Step-by-step derivation
      1. associate-*r/33.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \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. *-commutative33.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \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/33.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\right) \]
      4. *-commutative33.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.125}\right) \]
      5. associate-*r*35.4%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.125\right) \]
      6. unpow235.4%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{\color{blue}{\left(d \cdot d\right)} \cdot \ell} \cdot 0.125\right) \]
      7. associate-*l*37.5%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{\color{blue}{d \cdot \left(d \cdot \ell\right)}} \cdot 0.125\right) \]
      8. times-frac42.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \frac{h}{d \cdot \ell}\right)} \cdot 0.125\right) \]
      9. associate-/l*41.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{{D}^{2}}{\frac{d}{{M}^{2}}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      10. unpow241.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{\color{blue}{D \cdot D}}{\frac{d}{{M}^{2}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      11. associate-/l*45.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{D}{\frac{\frac{d}{{M}^{2}}}{D}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      12. unpow245.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{d}{\color{blue}{M \cdot M}}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      13. associate-/r*48.4%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\color{blue}{\frac{\frac{d}{M}}{M}}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
    8. Simplified48.4%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125}\right) \]

    if 4.4999999999999997e84 < d

    1. Initial program 66.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 72.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative72.0%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/r*71.8%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    4. Simplified71.8%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    5. Step-by-step derivation
      1. sqrt-div84.0%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
    6. Applied egg-rr84.0%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 4.5 \cdot 10^{+84}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 22: 53.1% accurate, 1.6× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq 5.1 \cdot 10^{+84}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= d 5.1e+84)
   (*
    (sqrt (* (/ d l) (/ d h)))
    (- 1.0 (* (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d))) 0.125)))
   (* d (* (pow l -0.5) (pow h -0.5)))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= 5.1e+84) {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 <= 5.1d+84) then
        tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (((d_1 / (((d / m) / m) / d_1)) * (h / (l * d))) * 0.125d0))
    else
        tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= 5.1e+84) {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if d <= 5.1e+84:
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125))
	else:
		tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= 5.1e+84)
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d))) * 0.125)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (d <= 5.1e+84)
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	else
		tmp = d * ((l ^ -0.5) * (h ^ -0.5));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[d, 5.1e+84], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 5.1 \cdot 10^{+84}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 5.1000000000000001e84

    1. Initial program 70.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. expm1-log1p-u33.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef19.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr17.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def27.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)\right)} \]
      2. expm1-log1p57.3%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)} \]
      3. *-commutative57.3%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      4. associate-*r/59.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\color{blue}{\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      5. *-commutative59.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{\color{blue}{D \cdot \left(M \cdot 0.5\right)}}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      6. *-commutative59.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \color{blue}{\left(0.5 \cdot \frac{h}{\ell}\right)}\right) \]
    5. Simplified59.0%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    6. Taylor expanded in D around 0 33.9%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}}\right) \]
    7. Step-by-step derivation
      1. associate-*r/33.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \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. *-commutative33.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \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/33.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\right) \]
      4. *-commutative33.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.125}\right) \]
      5. associate-*r*35.4%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.125\right) \]
      6. unpow235.4%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{\color{blue}{\left(d \cdot d\right)} \cdot \ell} \cdot 0.125\right) \]
      7. associate-*l*37.5%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{\color{blue}{d \cdot \left(d \cdot \ell\right)}} \cdot 0.125\right) \]
      8. times-frac42.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \frac{h}{d \cdot \ell}\right)} \cdot 0.125\right) \]
      9. associate-/l*41.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{{D}^{2}}{\frac{d}{{M}^{2}}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      10. unpow241.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{\color{blue}{D \cdot D}}{\frac{d}{{M}^{2}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      11. associate-/l*45.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{D}{\frac{\frac{d}{{M}^{2}}}{D}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      12. unpow245.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{d}{\color{blue}{M \cdot M}}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      13. associate-/r*48.4%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\color{blue}{\frac{\frac{d}{M}}{M}}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
    8. Simplified48.4%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125}\right) \]

    if 5.1000000000000001e84 < d

    1. Initial program 66.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 72.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity72.0%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative72.0%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr72.0%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity72.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-172.0%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow72.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 d \]
      4. rem-sqrt-square72.0%

        \[\leadsto \color{blue}{\left|{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}\right|} \cdot d \]
      5. metadata-eval72.0%

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow71.7%

        \[\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 \]
      7. fabs-sqr71.7%

        \[\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 \]
      8. sqr-pow72.0%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified72.0%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    7. Step-by-step derivation
      1. *-commutative72.0%

        \[\leadsto {\color{blue}{\left(\ell \cdot h\right)}}^{-0.5} \cdot d \]
      2. unpow-prod-down84.3%

        \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
    8. Applied egg-rr84.3%

      \[\leadsto \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \cdot d \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 5.1 \cdot 10^{+84}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]

Alternative 23: 50.8% accurate, 2.5× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{if}\;d \leq 6.6 \cdot 10^{+91}:\\ \;\;\;\;t_0 \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\ \mathbf{elif}\;d \leq 1.8 \cdot 10^{+159} \lor \neg \left(d \leq 4.1 \cdot 10^{+197}\right):\\ \;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 l) (/ d h)))))
   (if (<= d 6.6e+91)
     (* t_0 (- 1.0 (* (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d))) 0.125)))
     (if (or (<= d 1.8e+159) (not (<= d 4.1e+197)))
       (* d (pow (* l h) -0.5))
       (*
        t_0
        (- 1.0 (* 0.125 (* (/ D (/ l D)) (/ (* M M) (/ d (/ h d)))))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt(((d / l) * (d / h)));
	double tmp;
	if (d <= 6.6e+91) {
		tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	} else if ((d <= 1.8e+159) || !(d <= 4.1e+197)) {
		tmp = d * pow((l * h), -0.5);
	} else {
		tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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(((d / l) * (d / h)))
    if (d <= 6.6d+91) then
        tmp = t_0 * (1.0d0 - (((d_1 / (((d / m) / m) / d_1)) * (h / (l * d))) * 0.125d0))
    else if ((d <= 1.8d+159) .or. (.not. (d <= 4.1d+197))) then
        tmp = d * ((l * h) ** (-0.5d0))
    else
        tmp = t_0 * (1.0d0 - (0.125d0 * ((d_1 / (l / d_1)) * ((m * m) / (d / (h / d))))))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt(((d / l) * (d / h)));
	double tmp;
	if (d <= 6.6e+91) {
		tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	} else if ((d <= 1.8e+159) || !(d <= 4.1e+197)) {
		tmp = d * Math.pow((l * h), -0.5);
	} else {
		tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt(((d / l) * (d / h)))
	tmp = 0
	if d <= 6.6e+91:
		tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125))
	elif (d <= 1.8e+159) or not (d <= 4.1e+197):
		tmp = d * math.pow((l * h), -0.5)
	else:
		tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))))
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(Float64(d / l) * Float64(d / h)))
	tmp = 0.0
	if (d <= 6.6e+91)
		tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d))) * 0.125)));
	elseif ((d <= 1.8e+159) || !(d <= 4.1e+197))
		tmp = Float64(d * (Float64(l * h) ^ -0.5));
	else
		tmp = Float64(t_0 * Float64(1.0 - Float64(0.125 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M * M) / Float64(d / Float64(h / d)))))));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt(((d / l) * (d / h)));
	tmp = 0.0;
	if (d <= 6.6e+91)
		tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
	elseif ((d <= 1.8e+159) || ~((d <= 4.1e+197)))
		tmp = d * ((l * h) ^ -0.5);
	else
		tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, 6.6e+91], N[(t$95$0 * N[(1.0 - N[(N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 1.8e+159], N[Not[LessEqual[d, 4.1e+197]], $MachinePrecision]], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[(0.125 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(d / N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{if}\;d \leq 6.6 \cdot 10^{+91}:\\
\;\;\;\;t_0 \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\

\mathbf{elif}\;d \leq 1.8 \cdot 10^{+159} \lor \neg \left(d \leq 4.1 \cdot 10^{+197}\right):\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\

\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < 6.60000000000000034e91

    1. Initial program 69.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. expm1-log1p-u33.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef20.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr18.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def27.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)\right)} \]
      2. expm1-log1p57.3%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)} \]
      3. *-commutative57.3%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      4. associate-*r/58.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\color{blue}{\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      5. *-commutative58.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{\color{blue}{D \cdot \left(M \cdot 0.5\right)}}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      6. *-commutative58.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \color{blue}{\left(0.5 \cdot \frac{h}{\ell}\right)}\right) \]
    5. Simplified58.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    6. Taylor expanded in D around 0 33.6%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}}\right) \]
    7. Step-by-step derivation
      1. associate-*r/33.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \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. *-commutative33.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \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/33.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\right) \]
      4. *-commutative33.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot 0.125}\right) \]
      5. associate-*r*35.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell} \cdot 0.125\right) \]
      6. unpow235.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{\color{blue}{\left(d \cdot d\right)} \cdot \ell} \cdot 0.125\right) \]
      7. associate-*l*37.2%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{\color{blue}{d \cdot \left(d \cdot \ell\right)}} \cdot 0.125\right) \]
      8. times-frac41.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \frac{h}{d \cdot \ell}\right)} \cdot 0.125\right) \]
      9. associate-/l*41.3%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{{D}^{2}}{\frac{d}{{M}^{2}}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      10. unpow241.3%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{\color{blue}{D \cdot D}}{\frac{d}{{M}^{2}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      11. associate-/l*46.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{D}{\frac{\frac{d}{{M}^{2}}}{D}}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      12. unpow246.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{d}{\color{blue}{M \cdot M}}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
      13. associate-/r*48.4%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\color{blue}{\frac{\frac{d}{M}}{M}}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125\right) \]
    8. Simplified48.4%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{d \cdot \ell}\right) \cdot 0.125}\right) \]

    if 6.60000000000000034e91 < d < 1.80000000000000018e159 or 4.1000000000000003e197 < d

    1. Initial program 58.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 85.7%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity85.7%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative85.7%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr85.7%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity85.7%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-185.7%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow85.7%

        \[\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 \]
      4. rem-sqrt-square85.7%

        \[\leadsto \color{blue}{\left|{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}\right|} \cdot d \]
      5. metadata-eval85.7%

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow85.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 d \]
      7. fabs-sqr85.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 d \]
      8. sqr-pow85.7%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified85.7%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]

    if 1.80000000000000018e159 < d < 4.1000000000000003e197

    1. Initial program 100.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. expm1-log1p-u41.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef36.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr27.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def32.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)\right)} \]
      2. expm1-log1p89.3%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)} \]
      3. *-commutative89.3%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      4. associate-*r/89.3%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\color{blue}{\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      5. *-commutative89.3%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{\color{blue}{D \cdot \left(M \cdot 0.5\right)}}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      6. *-commutative89.3%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \color{blue}{\left(0.5 \cdot \frac{h}{\ell}\right)}\right) \]
    5. Simplified89.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    6. Taylor expanded in D around 0 21.9%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}}\right) \]
    7. Step-by-step derivation
      1. *-commutative21.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}} \cdot 0.125}\right) \]
      2. times-frac21.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)} \cdot 0.125\right) \]
      3. unpow221.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right) \cdot 0.125\right) \]
      4. associate-/l*21.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{D}{\frac{\ell}{D}}} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right) \cdot 0.125\right) \]
      5. associate-/l*21.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \color{blue}{\frac{{M}^{2}}{\frac{{d}^{2}}{h}}}\right) \cdot 0.125\right) \]
      6. unpow221.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{\color{blue}{M \cdot M}}{\frac{{d}^{2}}{h}}\right) \cdot 0.125\right) \]
      7. unpow221.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{\color{blue}{d \cdot d}}{h}}\right) \cdot 0.125\right) \]
      8. associate-/l*77.5%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\color{blue}{\frac{d}{\frac{h}{d}}}}\right) \cdot 0.125\right) \]
    8. Simplified77.5%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right) \cdot 0.125}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification54.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 6.6 \cdot 10^{+91}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\ \mathbf{elif}\;d \leq 1.8 \cdot 10^{+159} \lor \neg \left(d \leq 4.1 \cdot 10^{+197}\right):\\ \;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\ \end{array} \]

Alternative 24: 46.6% accurate, 2.5× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2.7 \cdot 10^{+67}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{elif}\;\ell \leq 4.8 \cdot 10^{-80}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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.7e+67)
   (* (- d) (sqrt (/ 1.0 (* l h))))
   (if (<= l 4.8e-80)
     (*
      (sqrt (* (/ d l) (/ d h)))
      (- 1.0 (* 0.125 (* (/ D (/ l D)) (/ (* M M) (/ d (/ h d)))))))
     (* d (pow (* l h) -0.5)))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -2.7e+67) {
		tmp = -d * sqrt((1.0 / (l * h)));
	} else if (l <= 4.8e-80) {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	} else {
		tmp = d * pow((l * h), -0.5);
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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.7d+67)) then
        tmp = -d * sqrt((1.0d0 / (l * h)))
    else if (l <= 4.8d-80) then
        tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (0.125d0 * ((d_1 / (l / d_1)) * ((m * m) / (d / (h / d))))))
    else
        tmp = d * ((l * h) ** (-0.5d0))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -2.7e+67) {
		tmp = -d * Math.sqrt((1.0 / (l * h)));
	} else if (l <= 4.8e-80) {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	} else {
		tmp = d * Math.pow((l * h), -0.5);
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if l <= -2.7e+67:
		tmp = -d * math.sqrt((1.0 / (l * h)))
	elif l <= 4.8e-80:
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))))
	else:
		tmp = d * math.pow((l * h), -0.5)
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -2.7e+67)
		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h))));
	elseif (l <= 4.8e-80)
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(0.125 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M * M) / Float64(d / Float64(h / d)))))));
	else
		tmp = Float64(d * (Float64(l * h) ^ -0.5));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -2.7e+67)
		tmp = -d * sqrt((1.0 / (l * h)));
	elseif (l <= 4.8e-80)
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
	else
		tmp = d * ((l * h) ^ -0.5);
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.7e+67], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.8e-80], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(d / N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.7 \cdot 10^{+67}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\

\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{-80}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -2.6999999999999999e67

    1. Initial program 50.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*50.5%

        \[\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-eval50.5%

        \[\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/250.5%

        \[\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-eval50.5%

        \[\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/250.5%

        \[\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*50.5%

        \[\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-eval50.5%

        \[\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-frac50.5%

        \[\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. Simplified50.5%

      \[\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. frac-2neg50.5%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\color{blue}{\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) \]
      2. sqrt-div63.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    5. Applied egg-rr63.6%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    6. Taylor expanded in d around -inf 54.8%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg54.8%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative54.8%

        \[\leadsto -d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. distribute-rgt-neg-in54.8%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    8. Simplified54.8%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]

    if -2.6999999999999999e67 < l < 4.7999999999999998e-80

    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. Step-by-step derivation
      1. expm1-log1p-u26.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)} \]
      2. expm1-udef20.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\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)\right)} - 1} \]
    3. Applied egg-rr18.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def22.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)\right)} \]
      2. expm1-log1p65.5%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)} \]
      3. *-commutative65.5%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      4. associate-*r/68.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\color{blue}{\left(\frac{\left(M \cdot 0.5\right) \cdot D}{d}\right)}}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      5. *-commutative68.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{\color{blue}{D \cdot \left(M \cdot 0.5\right)}}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right) \]
      6. *-commutative68.1%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \color{blue}{\left(0.5 \cdot \frac{h}{\ell}\right)}\right) \]
    5. Simplified68.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)} \]
    6. Taylor expanded in D around 0 35.6%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}}\right) \]
    7. Step-by-step derivation
      1. *-commutative35.6%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}} \cdot 0.125}\right) \]
      2. times-frac39.5%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)} \cdot 0.125\right) \]
      3. unpow239.5%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right) \cdot 0.125\right) \]
      4. associate-/l*41.9%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\color{blue}{\frac{D}{\frac{\ell}{D}}} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right) \cdot 0.125\right) \]
      5. associate-/l*42.5%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \color{blue}{\frac{{M}^{2}}{\frac{{d}^{2}}{h}}}\right) \cdot 0.125\right) \]
      6. unpow242.5%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{\color{blue}{M \cdot M}}{\frac{{d}^{2}}{h}}\right) \cdot 0.125\right) \]
      7. unpow242.5%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{\color{blue}{d \cdot d}}{h}}\right) \cdot 0.125\right) \]
      8. associate-/l*48.0%

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\color{blue}{\frac{d}{\frac{h}{d}}}}\right) \cdot 0.125\right) \]
    8. Simplified48.0%

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \color{blue}{\left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right) \cdot 0.125}\right) \]

    if 4.7999999999999998e-80 < l

    1. Initial program 64.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 57.8%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity57.8%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative57.8%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr57.8%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity57.8%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-157.8%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow57.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 \]
      4. rem-sqrt-square57.8%

        \[\leadsto \color{blue}{\left|{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}\right|} \cdot d \]
      5. metadata-eval57.8%

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow57.6%

        \[\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 \]
      7. fabs-sqr57.6%

        \[\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 \]
      8. sqr-pow57.8%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified57.8%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
  3. Recombined 3 regimes into one program.
  4. Final simplification52.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.7 \cdot 10^{+67}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{elif}\;\ell \leq 4.8 \cdot 10^{-80}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \end{array} \]

Alternative 25: 42.3% accurate, 3.0× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1.45 \cdot 10^{-157}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \end{array} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -1.45e-157)
   (* (- d) (sqrt (/ 1.0 (* l h))))
   (* d (pow (* l h) -0.5))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -1.45e-157) {
		tmp = -d * sqrt((1.0 / (l * h)));
	} else {
		tmp = d * pow((l * h), -0.5);
	}
	return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= (-1.45d-157)) then
        tmp = -d * sqrt((1.0d0 / (l * h)))
    else
        tmp = d * ((l * h) ** (-0.5d0))
    end if
    code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -1.45e-157) {
		tmp = -d * Math.sqrt((1.0 / (l * h)));
	} else {
		tmp = d * Math.pow((l * h), -0.5);
	}
	return tmp;
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if l <= -1.45e-157:
		tmp = -d * math.sqrt((1.0 / (l * h)))
	else:
		tmp = d * math.pow((l * h), -0.5)
	return tmp
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -1.45e-157)
		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h))));
	else
		tmp = Float64(d * (Float64(l * h) ^ -0.5));
	end
	return tmp
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -1.45e-157)
		tmp = -d * sqrt((1.0 / (l * h)));
	else
		tmp = d * ((l * h) ^ -0.5);
	end
	tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.45e-157], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.45 \cdot 10^{-157}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -1.44999999999999994e-157

    1. Initial program 68.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. Step-by-step derivation
      1. associate-*l*67.2%

        \[\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-eval67.2%

        \[\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/267.2%

        \[\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-eval67.2%

        \[\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/267.2%

        \[\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*66.2%

        \[\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-eval66.2%

        \[\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-frac64.5%

        \[\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. Simplified64.5%

      \[\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. frac-2neg64.5%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\color{blue}{\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) \]
      2. sqrt-div71.0%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    5. Applied egg-rr71.0%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    6. Taylor expanded in d around -inf 46.5%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg46.5%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. *-commutative46.5%

        \[\leadsto -d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      3. distribute-rgt-neg-in46.5%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    8. Simplified46.5%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]

    if -1.44999999999999994e-157 < l

    1. Initial program 69.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. Taylor expanded in d around inf 43.5%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Step-by-step derivation
      1. *-un-lft-identity43.5%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
      2. *-commutative43.5%

        \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
    4. Applied egg-rr43.5%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
    5. Step-by-step derivation
      1. *-lft-identity43.5%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      2. unpow-143.5%

        \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
      3. sqr-pow43.5%

        \[\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 \]
      4. rem-sqrt-square43.5%

        \[\leadsto \color{blue}{\left|{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}\right|} \cdot d \]
      5. metadata-eval43.5%

        \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
      6. sqr-pow43.4%

        \[\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 \]
      7. fabs-sqr43.4%

        \[\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 \]
      8. sqr-pow43.5%

        \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
    6. Simplified43.5%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.45 \cdot 10^{-157}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \end{array} \]

Alternative 26: 26.8% accurate, 3.1× speedup?

\[\begin{array}{l} M = |M|\\ D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ d \cdot {\left(\ell \cdot h\right)}^{-0.5} \end{array} \]
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D) :precision binary64 (* d (pow (* l h) -0.5)))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	return d * pow((l * h), -0.5);
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 * ((l * h) ** (-0.5d0))
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	return d * Math.pow((l * h), -0.5);
}
M = abs(M)
D = abs(D)
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	return d * math.pow((l * h), -0.5)
M = abs(M)
D = abs(D)
M, D = sort([M, D])
function code(d, h, l, M, D)
	return Float64(d * (Float64(l * h) ^ -0.5))
end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
	tmp = d * ((l * h) ^ -0.5);
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 69.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 30.1%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  3. Step-by-step derivation
    1. *-un-lft-identity30.1%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \cdot d \]
    2. *-commutative30.1%

      \[\leadsto \left(1 \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\right) \cdot d \]
  4. Applied egg-rr30.1%

    \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot d \]
  5. Step-by-step derivation
    1. *-lft-identity30.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
    2. unpow-130.1%

      \[\leadsto \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \cdot d \]
    3. sqr-pow30.1%

      \[\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 \]
    4. rem-sqrt-square30.1%

      \[\leadsto \color{blue}{\left|{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}\right|} \cdot d \]
    5. metadata-eval30.1%

      \[\leadsto \left|{\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right| \cdot d \]
    6. sqr-pow30.0%

      \[\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 \]
    7. fabs-sqr30.0%

      \[\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 \]
    8. sqr-pow30.1%

      \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
  6. Simplified30.1%

    \[\leadsto \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \cdot d \]
  7. Final simplification30.1%

    \[\leadsto d \cdot {\left(\ell \cdot h\right)}^{-0.5} \]

Reproduce

?
herbie shell --seed 2023200 
(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)))))