Henrywood and Agarwal, Equation (12)

Percentage Accurate: 65.5% → 75.0%
Time: 28.2s
Alternatives: 21
Speedup: 1.0×

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 21 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: 65.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (*
  (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
  (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
	return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
	return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D):
	return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D)
	return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
end
function tmp = code(d, h, l, M, D)
	tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}

Alternative 1: 75.0% accurate, 0.8× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{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)\\


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

    1. Initial program 68.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*68.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-eval68.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/268.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-eval68.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/268.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*68.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-eval68.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-frac69.3%

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

      \[\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. expm1-log1p-u68.9%

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

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

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

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

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

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

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

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

        \[\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)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      3. associate-*r/71.8%

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

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

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

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

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

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

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

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

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

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

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

    if -3.999999999999988e-310 < h

    1. Initial program 73.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*73.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-eval73.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/273.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-eval73.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/273.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*73.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-eval73.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-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. sqrt-div86.1%

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{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) \]
      2. div-inv86.0%

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{d} \cdot 1}{\sqrt{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) \]
      2. *-rgt-identity86.1%

        \[\leadsto \frac{\color{blue}{\sqrt{d}}}{\sqrt{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) \]
    7. Simplified86.1%

      \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification82.7%

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

Alternative 2: 67.7% accurate, 0.8× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\


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

    1. Initial program 41.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-eval41.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/241.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-eval41.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/241.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. *-commutative41.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*41.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-frac41.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-eval41.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. Simplified41.6%

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    6. Taylor expanded in M around 0 37.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.1999999999999999e157 < l < -2.09999999999999993e-114

    1. Initial program 76.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. metadata-eval76.8%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      5. add-sqr-sqrt76.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. pow276.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-rr82.4%

      \[\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{0.5}{\frac{\ell}{h}}}\right)}^{2}}\right) \]
    6. Step-by-step derivation
      1. *-commutative82.4%

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

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

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

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

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

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

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

    if -2.09999999999999993e-114 < l < 1.90000000000000014e69

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

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

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

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

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

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

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

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

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

      \[\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. expm1-log1p-u77.3%

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

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

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

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

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

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

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

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

        \[\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)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      3. associate-*r/80.1%

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

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

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

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

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

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

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

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

    if 1.90000000000000014e69 < l

    1. Initial program 59.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*59.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-eval59.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/259.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-eval59.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/259.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. sub-neg59.2%

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 59.9%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative59.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3.2 \cdot 10^{+157}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(M \cdot \left(D \cdot \left(D \cdot M\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)} \cdot 0.125\right)\\ \mathbf{elif}\;\ell \leq -2.1 \cdot 10^{-114}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{h \cdot \frac{0.5}{\ell}}\right)}^{2}\right)\\ \mathbf{elif}\;\ell \leq 1.9 \cdot 10^{+69}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(0.5 \cdot \frac{D \cdot M}{d}\right)}^{2}}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 3: 71.1% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -3.1999999999999998e160

    1. Initial program 41.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-eval41.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/241.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-eval41.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/241.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. *-commutative41.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*41.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-frac41.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-eval41.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. Simplified41.6%

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    6. Taylor expanded in M around 0 37.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.1999999999999998e160 < l < -9.999999999999969e-311

    1. Initial program 75.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. metadata-eval75.8%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      5. add-sqr-sqrt75.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. pow275.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-rr78.8%

      \[\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{0.5}{\frac{\ell}{h}}}\right)}^{2}}\right) \]
    6. Step-by-step derivation
      1. *-commutative78.8%

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < l

    1. Initial program 73.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*73.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-eval73.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/273.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-eval73.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/273.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*73.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-eval73.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-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. sqrt-div86.1%

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{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) \]
      2. div-inv86.0%

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{d} \cdot 1}{\sqrt{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) \]
      2. *-rgt-identity86.1%

        \[\leadsto \frac{\color{blue}{\sqrt{d}}}{\sqrt{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) \]
    7. Simplified86.1%

      \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{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) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification81.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3.2 \cdot 10^{+160}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(M \cdot \left(D \cdot \left(D \cdot M\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)} \cdot 0.125\right)\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{h \cdot \frac{0.5}{\ell}}\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{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)\\ \end{array} \]

Alternative 4: 67.8% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -3.39999999999999979e157

    1. Initial program 41.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-eval41.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/241.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-eval41.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/241.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. *-commutative41.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*41.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-frac41.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-eval41.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. Simplified41.6%

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    6. Taylor expanded in M around 0 37.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.39999999999999979e157 < l < 8.1999999999999998e69

    1. Initial program 78.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*78.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-eval78.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/278.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-eval78.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/278.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*78.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-eval78.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-frac78.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. Simplified78.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. expm1-log1p-u77.4%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}\right)\right) \]
      2. expm1-log1p78.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)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      3. associate-*r/80.2%

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

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

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

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

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

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

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

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

    if 8.1999999999999998e69 < l

    1. Initial program 59.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*59.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-eval59.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/259.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-eval59.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/259.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. sub-neg59.2%

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 59.9%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative59.9%

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

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

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

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

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification77.4%

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

Alternative 5: 67.6% accurate, 1.0× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -1.8999999999999999e-155

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

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

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

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

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

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

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

        \[\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-frac80.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. Simplified80.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. expm1-log1p-u80.0%

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

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

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

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

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

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

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

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

        \[\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)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      3. associate-*r/83.9%

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

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

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

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

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

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

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

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

    if -1.8999999999999999e-155 < d < -3.54999999999999979e-295

    1. Initial program 35.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-eval35.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/235.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-eval35.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/235.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. *-commutative35.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*35.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-frac35.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-eval35.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. Simplified35.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. frac-2neg35.4%

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    6. Taylor expanded in d around -inf 47.1%

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

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

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

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

    if -3.54999999999999979e-295 < d < 3.79999999999999963e100

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

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

        \[\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-frac75.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. Simplified75.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)} \]

    if 3.79999999999999963e100 < d

    1. Initial program 69.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*69.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-eval69.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/269.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-eval69.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/269.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. sub-neg69.7%

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 70.0%

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

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

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

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    8. Step-by-step derivation
      1. sqrt-div80.9%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
    9. Applied egg-rr80.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.9 \cdot 10^{-155}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(0.5 \cdot \frac{D \cdot M}{d}\right)}^{2}}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{elif}\;d \leq -3.55 \cdot 10^{-295}:\\ \;\;\;\;\left(M \cdot \left(D \cdot \left(D \cdot \frac{M}{d}\right)\right)\right) \cdot \left(0.125 \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) - d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{elif}\;d \leq 3.8 \cdot 10^{+100}:\\ \;\;\;\;\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)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 6: 67.6% accurate, 1.0× speedup?

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

    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*71.4%

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

        \[\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.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-eval71.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/271.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*71.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-eval71.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-frac71.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. Simplified71.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. expm1-log1p-u71.0%

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

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

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

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

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

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

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

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

        \[\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)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      3. associate-*r/73.2%

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

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

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

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

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

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

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

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

    if 2.24999999999999991e228 < d

    1. Initial program 66.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*66.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-eval66.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/266.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-eval66.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/266.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. sub-neg66.0%

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 79.0%

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

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

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

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

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
    9. Applied egg-rr89.1%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.4%

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

Alternative 7: 59.2% accurate, 1.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -1.9e92

    1. Initial program 49.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*49.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-eval49.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/249.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-eval49.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/249.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. sub-neg49.6%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg47.0%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv60.1%

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    6. Applied egg-rr60.4%

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/60.2%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified60.2%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]

    if -1.9e92 < l < 3.2000000000000001e48

    1. Initial program 78.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. metadata-eval78.0%

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

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

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

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

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

        \[\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.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-eval78.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. Simplified78.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. Taylor expanded in M around 0 46.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.2000000000000001e48 < l

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 60.4%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative60.4%

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

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

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    8. Step-by-step derivation
      1. sqrt-div73.2%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
    9. Applied egg-rr73.2%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification66.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.9 \cdot 10^{+92}:\\ \;\;\;\;\sqrt{-d} \cdot \frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}}\\ \mathbf{elif}\;\ell \leq 3.2 \cdot 10^{+48}:\\ \;\;\;\;\left(1 - \frac{h \cdot \left(M \cdot \left(D \cdot \left(D \cdot M\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)} \cdot 0.125\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 8: 59.2% accurate, 1.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -1.09999999999999996e92

    1. Initial program 49.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*49.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-eval49.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/249.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-eval49.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/249.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. sub-neg49.6%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg47.0%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv60.1%

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    6. Applied egg-rr60.4%

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
    8. Simplified60.3%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]

    if -1.09999999999999996e92 < l < 1.40000000000000006e48

    1. Initial program 78.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. metadata-eval78.0%

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

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

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

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

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

        \[\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.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-eval78.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. Simplified78.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. Taylor expanded in M around 0 46.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.40000000000000006e48 < l

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 60.4%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative60.4%

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

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

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    8. Step-by-step derivation
      1. sqrt-div73.2%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
    9. Applied egg-rr73.2%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification66.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.1 \cdot 10^{+92}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}\\ \mathbf{elif}\;\ell \leq 1.4 \cdot 10^{+48}:\\ \;\;\;\;\left(1 - \frac{h \cdot \left(M \cdot \left(D \cdot \left(D \cdot M\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)} \cdot 0.125\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 9: 61.3% accurate, 1.4× speedup?

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

\mathbf{elif}\;d \leq -1 \cdot 10^{-95}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;d \leq 4.2 \cdot 10^{-139}:\\
\;\;\;\;t_0 \cdot \left(1 - 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\

\mathbf{elif}\;d \leq 5.5 \cdot 10^{+96}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -1.70000000000000004e191

    1. Initial program 63.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*63.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-eval63.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/263.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-eval63.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/263.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-neg63.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. +-commutative63.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. *-commutative63.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-in63.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-def63.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. Simplified67.7%

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg59.9%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv71.5%

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    6. Applied egg-rr71.5%

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/71.5%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified71.5%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    9. Taylor expanded in d around -inf 71.0%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg71.0%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/l/71.0%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      3. unpow1/271.0%

        \[\leadsto -d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
      4. distribute-rgt-neg-in71.0%

        \[\leadsto \color{blue}{d \cdot \left(-{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\right)} \]
      5. exp-to-pow68.9%

        \[\leadsto d \cdot \left(-\color{blue}{e^{\log \left(\frac{\frac{1}{h}}{\ell}\right) \cdot 0.5}}\right) \]
      6. associate-/l/68.9%

        \[\leadsto d \cdot \left(-e^{\log \color{blue}{\left(\frac{1}{\ell \cdot h}\right)} \cdot 0.5}\right) \]
      7. log-rec68.9%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\left(-\log \left(\ell \cdot h\right)\right)} \cdot 0.5}\right) \]
      8. *-commutative68.9%

        \[\leadsto d \cdot \left(-e^{\left(-\log \color{blue}{\left(h \cdot \ell\right)}\right) \cdot 0.5}\right) \]
      9. distribute-lft-neg-out68.9%

        \[\leadsto d \cdot \left(-e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}}\right) \]
      10. distribute-rgt-neg-in68.9%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}}\right) \]
      11. metadata-eval68.9%

        \[\leadsto d \cdot \left(-e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}}\right) \]
      12. exp-prod68.9%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(e^{\log \left(h \cdot \ell\right)}\right)}^{-0.5}}\right) \]
      13. *-commutative68.9%

        \[\leadsto d \cdot \left(-{\left(e^{\log \color{blue}{\left(\ell \cdot h\right)}}\right)}^{-0.5}\right) \]
      14. rem-exp-log71.1%

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

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

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

    if -1.70000000000000004e191 < d < -9.99999999999999989e-96 or 4.20000000000000016e-139 < d < 5.5000000000000002e96

    1. Initial program 90.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. metadata-eval90.8%

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)}\right) \]
      7. times-frac90.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-eval90.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. Simplified90.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. Taylor expanded in M around 0 69.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999989e-96 < d < 4.20000000000000016e-139

    1. Initial program 48.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. metadata-eval48.2%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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. expm1-log1p-u47.6%

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

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(e^{\mathsf{log1p}\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) \]
    5. Applied egg-rr47.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.5000000000000002e96 < d

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*70.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-eval70.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/270.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-eval70.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/270.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. sub-neg70.2%

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 68.8%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative68.8%

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

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

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

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
    9. Applied egg-rr80.5%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification70.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.7 \cdot 10^{+191}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;d \leq -1 \cdot 10^{-95}:\\ \;\;\;\;\left(1 - \frac{h \cdot \left(M \cdot \left(D \cdot \left(D \cdot M\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)} \cdot 0.125\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{elif}\;d \leq 4.2 \cdot 10^{-139}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \mathbf{elif}\;d \leq 5.5 \cdot 10^{+96}:\\ \;\;\;\;\left(1 - \frac{h \cdot \left(M \cdot \left(D \cdot \left(D \cdot M\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)} \cdot 0.125\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 10: 47.1% accurate, 1.4× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := t_0 \cdot \left(t_1 \cdot \left(\left(\frac{D \cdot D}{\ell} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)\right)\right) \cdot -0.125\right)\right)\\ t_3 := t_0 \cdot t_1\\ \mathbf{if}\;D \leq -3.2 \cdot 10^{-105}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;D \leq 2 \cdot 10^{+90}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;D \leq 8 \cdot 10^{+191}:\\ \;\;\;\;t_0 \cdot \left(t_1 \cdot \left(-0.125 \cdot \frac{D \cdot \frac{D}{\ell}}{\frac{d}{h \cdot M} \cdot \frac{d}{M}}\right)\right)\\ \mathbf{elif}\;D \leq 1.52 \cdot 10^{+206}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d h)))
        (t_1 (sqrt (/ d l)))
        (t_2
         (*
          t_0
          (* t_1 (* (* (/ (* D D) l) (* h (* (/ M d) (/ M d)))) -0.125))))
        (t_3 (* t_0 t_1)))
   (if (<= D -3.2e-105)
     t_2
     (if (<= D 2e+90)
       t_3
       (if (<= D 8e+191)
         (* t_0 (* t_1 (* -0.125 (/ (* D (/ D l)) (* (/ d (* h M)) (/ d M))))))
         (if (<= D 1.52e+206) t_3 t_2))))))
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 = t_0 * (t_1 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125));
	double t_3 = t_0 * t_1;
	double tmp;
	if (D <= -3.2e-105) {
		tmp = t_2;
	} else if (D <= 2e+90) {
		tmp = t_3;
	} else if (D <= 8e+191) {
		tmp = t_0 * (t_1 * (-0.125 * ((D * (D / l)) / ((d / (h * M)) * (d / M)))));
	} else if (D <= 1.52e+206) {
		tmp = t_3;
	} else {
		tmp = t_2;
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = sqrt((d / h))
    t_1 = sqrt((d / l))
    t_2 = t_0 * (t_1 * ((((d_1 * d_1) / l) * (h * ((m / d) * (m / d)))) * (-0.125d0)))
    t_3 = t_0 * t_1
    if (d_1 <= (-3.2d-105)) then
        tmp = t_2
    else if (d_1 <= 2d+90) then
        tmp = t_3
    else if (d_1 <= 8d+191) then
        tmp = t_0 * (t_1 * ((-0.125d0) * ((d_1 * (d_1 / l)) / ((d / (h * m)) * (d / m)))))
    else if (d_1 <= 1.52d+206) then
        tmp = t_3
    else
        tmp = t_2
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / h));
	double t_1 = Math.sqrt((d / l));
	double t_2 = t_0 * (t_1 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125));
	double t_3 = t_0 * t_1;
	double tmp;
	if (D <= -3.2e-105) {
		tmp = t_2;
	} else if (D <= 2e+90) {
		tmp = t_3;
	} else if (D <= 8e+191) {
		tmp = t_0 * (t_1 * (-0.125 * ((D * (D / l)) / ((d / (h * M)) * (d / M)))));
	} else if (D <= 1.52e+206) {
		tmp = t_3;
	} else {
		tmp = t_2;
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / h))
	t_1 = math.sqrt((d / l))
	t_2 = t_0 * (t_1 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125))
	t_3 = t_0 * t_1
	tmp = 0
	if D <= -3.2e-105:
		tmp = t_2
	elif D <= 2e+90:
		tmp = t_3
	elif D <= 8e+191:
		tmp = t_0 * (t_1 * (-0.125 * ((D * (D / l)) / ((d / (h * M)) * (d / M)))))
	elif D <= 1.52e+206:
		tmp = t_3
	else:
		tmp = t_2
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / h))
	t_1 = sqrt(Float64(d / l))
	t_2 = Float64(t_0 * Float64(t_1 * Float64(Float64(Float64(Float64(D * D) / l) * Float64(h * Float64(Float64(M / d) * Float64(M / d)))) * -0.125)))
	t_3 = Float64(t_0 * t_1)
	tmp = 0.0
	if (D <= -3.2e-105)
		tmp = t_2;
	elseif (D <= 2e+90)
		tmp = t_3;
	elseif (D <= 8e+191)
		tmp = Float64(t_0 * Float64(t_1 * Float64(-0.125 * Float64(Float64(D * Float64(D / l)) / Float64(Float64(d / Float64(h * M)) * Float64(d / M))))));
	elseif (D <= 1.52e+206)
		tmp = t_3;
	else
		tmp = t_2;
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / h));
	t_1 = sqrt((d / l));
	t_2 = t_0 * (t_1 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125));
	t_3 = t_0 * t_1;
	tmp = 0.0;
	if (D <= -3.2e-105)
		tmp = t_2;
	elseif (D <= 2e+90)
		tmp = t_3;
	elseif (D <= 8e+191)
		tmp = t_0 * (t_1 * (-0.125 * ((D * (D / l)) / ((d / (h * M)) * (d / M)))));
	elseif (D <= 1.52e+206)
		tmp = t_3;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * N[(t$95$1 * N[(N[(N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision] * N[(h * N[(N[(M / d), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 * t$95$1), $MachinePrecision]}, If[LessEqual[D, -3.2e-105], t$95$2, If[LessEqual[D, 2e+90], t$95$3, If[LessEqual[D, 8e+191], N[(t$95$0 * N[(t$95$1 * N[(-0.125 * N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] / N[(N[(d / N[(h * M), $MachinePrecision]), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 1.52e+206], t$95$3, t$95$2]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := t_0 \cdot \left(t_1 \cdot \left(\left(\frac{D \cdot D}{\ell} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)\right)\right) \cdot -0.125\right)\right)\\
t_3 := t_0 \cdot t_1\\
\mathbf{if}\;D \leq -3.2 \cdot 10^{-105}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;D \leq 2 \cdot 10^{+90}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;D \leq 8 \cdot 10^{+191}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(-0.125 \cdot \frac{D \cdot \frac{D}{\ell}}{\frac{d}{h \cdot M} \cdot \frac{d}{M}}\right)\right)\\

\mathbf{elif}\;D \leq 1.52 \cdot 10^{+206}:\\
\;\;\;\;t_3\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if D < -3.19999999999999981e-105 or 1.52e206 < D

    1. Initial program 76.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*76.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-eval76.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/276.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-eval76.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/276.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. sub-neg76.3%

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

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

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

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

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

      \[\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 inf 31.1%

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\left(\frac{D \cdot D}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot h}{d \cdot d}\right) \cdot -0.125\right)}\right) \]
    7. Taylor expanded in M around 0 33.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.19999999999999981e-105 < D < 1.99999999999999993e90 or 8.00000000000000058e191 < D < 1.52e206

    1. Initial program 68.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*68.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-eval68.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/268.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-eval68.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/268.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. sub-neg68.1%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg53.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv34.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\ell}}} \]
      4. expm1-log1p-u33.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\right)} \]
      5. expm1-udef19.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)} - 1} \]
      6. sqrt-undiv36.1%

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

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{d}{\ell}}}\right)} - 1 \]
    6. Applied egg-rr36.1%

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p53.8%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
    8. Simplified53.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]

    if 1.99999999999999993e90 < D < 8.00000000000000058e191

    1. Initial program 63.7%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*63.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-eval63.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/263.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-eval63.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/263.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. sub-neg63.6%

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

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

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

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

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

      \[\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 inf 21.5%

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\left(\frac{D \cdot D}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot h}{d \cdot d}\right) \cdot -0.125\right)}\right) \]
    7. Taylor expanded in D around 0 21.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\frac{D}{\ell} \cdot D}{\frac{d \cdot d}{\color{blue}{\left(h \cdot M\right) \cdot M}}} \cdot -0.125\right)\right) \]
      14. times-frac31.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;D \leq -3.2 \cdot 10^{-105}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\frac{D \cdot D}{\ell} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)\right)\right) \cdot -0.125\right)\right)\\ \mathbf{elif}\;D \leq 2 \cdot 10^{+90}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;D \leq 8 \cdot 10^{+191}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \cdot \frac{D \cdot \frac{D}{\ell}}{\frac{d}{h \cdot M} \cdot \frac{d}{M}}\right)\right)\\ \mathbf{elif}\;D \leq 1.52 \cdot 10^{+206}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\frac{D \cdot D}{\ell} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)\right)\right) \cdot -0.125\right)\right)\\ \end{array} \]

Alternative 11: 56.6% accurate, 1.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -1.6000000000000001e139

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

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

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

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

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

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

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

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

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

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

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

      \[\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) \]
    5. Step-by-step derivation
      1. *-rgt-identity44.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg44.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv60.8%

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/60.8%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified60.8%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    9. Taylor expanded in d around -inf 57.5%

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/l/57.4%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      3. unpow1/257.4%

        \[\leadsto -d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
      4. distribute-rgt-neg-in57.4%

        \[\leadsto \color{blue}{d \cdot \left(-{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\right)} \]
      5. exp-to-pow54.2%

        \[\leadsto d \cdot \left(-\color{blue}{e^{\log \left(\frac{\frac{1}{h}}{\ell}\right) \cdot 0.5}}\right) \]
      6. associate-/l/54.2%

        \[\leadsto d \cdot \left(-e^{\log \color{blue}{\left(\frac{1}{\ell \cdot h}\right)} \cdot 0.5}\right) \]
      7. log-rec54.2%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\left(-\log \left(\ell \cdot h\right)\right)} \cdot 0.5}\right) \]
      8. *-commutative54.2%

        \[\leadsto d \cdot \left(-e^{\left(-\log \color{blue}{\left(h \cdot \ell\right)}\right) \cdot 0.5}\right) \]
      9. distribute-lft-neg-out54.2%

        \[\leadsto d \cdot \left(-e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}}\right) \]
      10. distribute-rgt-neg-in54.2%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}}\right) \]
      11. metadata-eval54.2%

        \[\leadsto d \cdot \left(-e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}}\right) \]
      12. exp-prod54.2%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(e^{\log \left(h \cdot \ell\right)}\right)}^{-0.5}}\right) \]
      13. *-commutative54.2%

        \[\leadsto d \cdot \left(-{\left(e^{\log \color{blue}{\left(\ell \cdot h\right)}}\right)}^{-0.5}\right) \]
      14. rem-exp-log57.7%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(\ell \cdot h\right)}}^{-0.5}\right) \]
      15. *-commutative57.7%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(h \cdot \ell\right)}}^{-0.5}\right) \]
    11. Simplified57.7%

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

    if -1.6000000000000001e139 < l < 5.6000000000000005e-20

    1. Initial program 77.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. metadata-eval77.2%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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. expm1-log1p-u76.6%

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

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\left(e^{\mathsf{log1p}\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) \]
    5. Applied egg-rr76.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.6000000000000005e-20 < l

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 62.4%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative62.4%

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

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

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    8. Step-by-step derivation
      1. sqrt-div72.4%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
    9. Applied egg-rr72.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.6 \cdot 10^{+139}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;\ell \leq 5.6 \cdot 10^{-20}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 12: 46.6% accurate, 1.4× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{if}\;d \leq -5.6 \cdot 10^{+118}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq -6 \cdot 10^{-156}:\\ \;\;\;\;\frac{\sqrt{\frac{d \cdot \left(-d\right)}{h}}}{\sqrt{-\ell}}\\ \mathbf{elif}\;d \leq -1.75 \cdot 10^{-295}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 2.5 \cdot 10^{-288}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 3.9 \cdot 10^{-134} \lor \neg \left(d \leq 1.25 \cdot 10^{-64}\right) \land d \leq 47000000:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{\frac{d}{M \cdot M}}{D \cdot D}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* d (- (pow (* h l) -0.5)))))
   (if (<= d -5.6e+118)
     t_0
     (if (<= d -6e-156)
       (/ (sqrt (/ (* d (- d)) h)) (sqrt (- l)))
       (if (<= d -1.75e-295)
         t_0
         (if (<= d 2.5e-288)
           (/ d (sqrt (* h l)))
           (if (or (<= d 3.9e-134)
                   (and (not (<= d 1.25e-64)) (<= d 47000000.0)))
             (* (sqrt (/ h (pow l 3.0))) (/ -0.125 (/ (/ d (* M M)) (* D D))))
             (* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = d * -pow((h * l), -0.5);
	double tmp;
	if (d <= -5.6e+118) {
		tmp = t_0;
	} else if (d <= -6e-156) {
		tmp = sqrt(((d * -d) / h)) / sqrt(-l);
	} else if (d <= -1.75e-295) {
		tmp = t_0;
	} else if (d <= 2.5e-288) {
		tmp = d / sqrt((h * l));
	} else if ((d <= 3.9e-134) || (!(d <= 1.25e-64) && (d <= 47000000.0))) {
		tmp = sqrt((h / pow(l, 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)));
	} else {
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = d * -((h * l) ** (-0.5d0))
    if (d <= (-5.6d+118)) then
        tmp = t_0
    else if (d <= (-6d-156)) then
        tmp = sqrt(((d * -d) / h)) / sqrt(-l)
    else if (d <= (-1.75d-295)) then
        tmp = t_0
    else if (d <= 2.5d-288) then
        tmp = d / sqrt((h * l))
    else if ((d <= 3.9d-134) .or. (.not. (d <= 1.25d-64)) .and. (d <= 47000000.0d0)) then
        tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) / ((d / (m * m)) / (d_1 * d_1)))
    else
        tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = d * -Math.pow((h * l), -0.5);
	double tmp;
	if (d <= -5.6e+118) {
		tmp = t_0;
	} else if (d <= -6e-156) {
		tmp = Math.sqrt(((d * -d) / h)) / Math.sqrt(-l);
	} else if (d <= -1.75e-295) {
		tmp = t_0;
	} else if (d <= 2.5e-288) {
		tmp = d / Math.sqrt((h * l));
	} else if ((d <= 3.9e-134) || (!(d <= 1.25e-64) && (d <= 47000000.0))) {
		tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)));
	} else {
		tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = d * -math.pow((h * l), -0.5)
	tmp = 0
	if d <= -5.6e+118:
		tmp = t_0
	elif d <= -6e-156:
		tmp = math.sqrt(((d * -d) / h)) / math.sqrt(-l)
	elif d <= -1.75e-295:
		tmp = t_0
	elif d <= 2.5e-288:
		tmp = d / math.sqrt((h * l))
	elif (d <= 3.9e-134) or (not (d <= 1.25e-64) and (d <= 47000000.0)):
		tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)))
	else:
		tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(d * Float64(-(Float64(h * l) ^ -0.5)))
	tmp = 0.0
	if (d <= -5.6e+118)
		tmp = t_0;
	elseif (d <= -6e-156)
		tmp = Float64(sqrt(Float64(Float64(d * Float64(-d)) / h)) / sqrt(Float64(-l)));
	elseif (d <= -1.75e-295)
		tmp = t_0;
	elseif (d <= 2.5e-288)
		tmp = Float64(d / sqrt(Float64(h * l)));
	elseif ((d <= 3.9e-134) || (!(d <= 1.25e-64) && (d <= 47000000.0)))
		tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 / Float64(Float64(d / Float64(M * M)) / Float64(D * D))));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = d * -((h * l) ^ -0.5);
	tmp = 0.0;
	if (d <= -5.6e+118)
		tmp = t_0;
	elseif (d <= -6e-156)
		tmp = sqrt(((d * -d) / h)) / sqrt(-l);
	elseif (d <= -1.75e-295)
		tmp = t_0;
	elseif (d <= 2.5e-288)
		tmp = d / sqrt((h * l));
	elseif ((d <= 3.9e-134) || (~((d <= 1.25e-64)) && (d <= 47000000.0)))
		tmp = sqrt((h / (l ^ 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)));
	else
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -5.6e+118], t$95$0, If[LessEqual[d, -6e-156], N[(N[Sqrt[N[(N[(d * (-d)), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.75e-295], t$95$0, If[LessEqual[d, 2.5e-288], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 3.9e-134], And[N[Not[LessEqual[d, 1.25e-64]], $MachinePrecision], LessEqual[d, 47000000.0]]], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 / N[(N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{if}\;d \leq -5.6 \cdot 10^{+118}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;d \leq -6 \cdot 10^{-156}:\\
\;\;\;\;\frac{\sqrt{\frac{d \cdot \left(-d\right)}{h}}}{\sqrt{-\ell}}\\

\mathbf{elif}\;d \leq -1.75 \cdot 10^{-295}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;d \leq 2.5 \cdot 10^{-288}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\

\mathbf{elif}\;d \leq 3.9 \cdot 10^{-134} \lor \neg \left(d \leq 1.25 \cdot 10^{-64}\right) \land d \leq 47000000:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{\frac{d}{M \cdot M}}{D \cdot D}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -5.59999999999999972e118 or -6e-156 < d < -1.74999999999999994e-295

    1. Initial program 57.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*57.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-eval57.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/257.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-eval57.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/257.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. sub-neg57.7%

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv53.3%

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    6. Applied egg-rr53.3%

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/53.2%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified53.2%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    9. Taylor expanded in d around -inf 54.4%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg54.4%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/l/54.4%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      3. unpow1/254.4%

        \[\leadsto -d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
      4. distribute-rgt-neg-in54.4%

        \[\leadsto \color{blue}{d \cdot \left(-{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\right)} \]
      5. exp-to-pow51.9%

        \[\leadsto d \cdot \left(-\color{blue}{e^{\log \left(\frac{\frac{1}{h}}{\ell}\right) \cdot 0.5}}\right) \]
      6. associate-/l/51.9%

        \[\leadsto d \cdot \left(-e^{\log \color{blue}{\left(\frac{1}{\ell \cdot h}\right)} \cdot 0.5}\right) \]
      7. log-rec51.9%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\left(-\log \left(\ell \cdot h\right)\right)} \cdot 0.5}\right) \]
      8. *-commutative51.9%

        \[\leadsto d \cdot \left(-e^{\left(-\log \color{blue}{\left(h \cdot \ell\right)}\right) \cdot 0.5}\right) \]
      9. distribute-lft-neg-out51.9%

        \[\leadsto d \cdot \left(-e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}}\right) \]
      10. distribute-rgt-neg-in51.9%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}}\right) \]
      11. metadata-eval51.9%

        \[\leadsto d \cdot \left(-e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}}\right) \]
      12. exp-prod51.9%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(e^{\log \left(h \cdot \ell\right)}\right)}^{-0.5}}\right) \]
      13. *-commutative51.9%

        \[\leadsto d \cdot \left(-{\left(e^{\log \color{blue}{\left(\ell \cdot h\right)}}\right)}^{-0.5}\right) \]
      14. rem-exp-log54.5%

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

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

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

    if -5.59999999999999972e118 < d < -6e-156

    1. Initial program 83.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*83.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-eval83.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/283.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-eval83.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/283.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. sub-neg83.5%

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv44.0%

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/44.0%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified44.0%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    9. Step-by-step derivation
      1. associate-*l/44.1%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
      2. pow1/244.1%

        \[\leadsto \frac{\color{blue}{{\left(\frac{d}{h}\right)}^{0.5}} \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
      3. pow1/244.1%

        \[\leadsto \frac{{\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(-d\right)}^{0.5}}}{\sqrt{-\ell}} \]
      4. pow-prod-down43.0%

        \[\leadsto \frac{\color{blue}{{\left(\frac{d}{h} \cdot \left(-d\right)\right)}^{0.5}}}{\sqrt{-\ell}} \]
    10. Applied egg-rr43.0%

      \[\leadsto \color{blue}{\frac{{\left(\frac{d}{h} \cdot \left(-d\right)\right)}^{0.5}}{\sqrt{-\ell}}} \]
    11. Step-by-step derivation
      1. unpow1/243.0%

        \[\leadsto \frac{\color{blue}{\sqrt{\frac{d}{h} \cdot \left(-d\right)}}}{\sqrt{-\ell}} \]
      2. associate-*l/43.0%

        \[\leadsto \frac{\sqrt{\color{blue}{\frac{d \cdot \left(-d\right)}{h}}}}{\sqrt{-\ell}} \]
      3. distribute-rgt-neg-out43.0%

        \[\leadsto \frac{\sqrt{\frac{\color{blue}{-d \cdot d}}{h}}}{\sqrt{-\ell}} \]
    12. Simplified43.0%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{-d \cdot d}{h}}}{\sqrt{-\ell}}} \]

    if -1.74999999999999994e-295 < d < 2.50000000000000005e-288

    1. Initial program 50.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*50.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-eval50.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/250.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-eval50.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/250.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-neg50.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. +-commutative50.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. *-commutative50.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-in50.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-def50.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. Simplified50.8%

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 52.0%

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

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

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

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    8. Taylor expanded in l around 0 52.0%

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

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

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    10. Simplified52.0%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    11. Step-by-step derivation
      1. div-inv52.0%

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

        \[\leadsto d \cdot \sqrt{\color{blue}{{h}^{-1}} \cdot \frac{1}{\ell}} \]
      3. inv-pow52.0%

        \[\leadsto d \cdot \sqrt{{h}^{-1} \cdot \color{blue}{{\ell}^{-1}}} \]
      4. pow-prod-down52.0%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      5. inv-pow52.0%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
      6. associate-/l/51.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      7. add-cbrt-cube51.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{\sqrt[3]{\left(\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}\right) \cdot \frac{\frac{1}{\ell}}{h}}}} \]
      8. add-cbrt-cube51.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      9. add-sqr-sqrt51.9%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)} \]
      10. expm1-log1p-u11.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)\right)\right)} \]
      11. expm1-udef3.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)\right)} - 1} \]
    12. Applied egg-rr3.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)} - 1} \]
    13. Step-by-step derivation
      1. expm1-def12.0%

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

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

        \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
      4. *-rgt-identity52.0%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    14. Simplified52.0%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]

    if 2.50000000000000005e-288 < d < 3.9000000000000001e-134 or 1.25000000000000008e-64 < d < 4.7e7

    1. Initial program 72.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-eval72.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/272.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-eval72.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/272.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. *-commutative72.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*72.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.5%

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    6. Taylor expanded in d around 0 51.0%

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

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

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

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

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\frac{-0.125 \cdot {D}^{2}}{\frac{d}{{M}^{2}}}} \]
      5. associate-/l*53.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\frac{-0.125}{\frac{\frac{d}{{M}^{2}}}{{D}^{2}}}} \]
      6. unpow253.7%

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

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

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

    if 3.9000000000000001e-134 < d < 1.25000000000000008e-64 or 4.7e7 < d

    1. Initial program 77.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*77.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-eval77.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/277.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-eval77.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/277.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. sub-neg77.2%

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 59.4%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative59.4%

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

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

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

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
    9. Applied egg-rr70.3%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification57.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -5.6 \cdot 10^{+118}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;d \leq -6 \cdot 10^{-156}:\\ \;\;\;\;\frac{\sqrt{\frac{d \cdot \left(-d\right)}{h}}}{\sqrt{-\ell}}\\ \mathbf{elif}\;d \leq -1.75 \cdot 10^{-295}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;d \leq 2.5 \cdot 10^{-288}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 3.9 \cdot 10^{-134} \lor \neg \left(d \leq 1.25 \cdot 10^{-64}\right) \land d \leq 47000000:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{\frac{d}{M \cdot M}}{D \cdot D}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 13: 47.7% accurate, 1.4× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;D \leq -4.2 \cdot 10^{-105} \lor \neg \left(D \leq 1.5 \cdot 10^{+91}\right):\\ \;\;\;\;t_1 \cdot \left(t_0 \cdot \left(-0.125 \cdot \left(\frac{h}{d} \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(M \cdot \frac{M}{d}\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot t_0\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l))) (t_1 (sqrt (/ d h))))
   (if (or (<= D -4.2e-105) (not (<= D 1.5e+91)))
     (* t_1 (* t_0 (* -0.125 (* (/ h d) (* (* D (/ D l)) (* M (/ M d)))))))
     (* t_1 t_0))))
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 / h));
	double tmp;
	if ((D <= -4.2e-105) || !(D <= 1.5e+91)) {
		tmp = t_1 * (t_0 * (-0.125 * ((h / d) * ((D * (D / l)) * (M * (M / d))))));
	} else {
		tmp = t_1 * t_0;
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sqrt((d / l))
    t_1 = sqrt((d / h))
    if ((d_1 <= (-4.2d-105)) .or. (.not. (d_1 <= 1.5d+91))) then
        tmp = t_1 * (t_0 * ((-0.125d0) * ((h / d) * ((d_1 * (d_1 / l)) * (m * (m / d))))))
    else
        tmp = t_1 * t_0
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / l));
	double t_1 = Math.sqrt((d / h));
	double tmp;
	if ((D <= -4.2e-105) || !(D <= 1.5e+91)) {
		tmp = t_1 * (t_0 * (-0.125 * ((h / d) * ((D * (D / l)) * (M * (M / d))))));
	} else {
		tmp = t_1 * t_0;
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / l))
	t_1 = math.sqrt((d / h))
	tmp = 0
	if (D <= -4.2e-105) or not (D <= 1.5e+91):
		tmp = t_1 * (t_0 * (-0.125 * ((h / d) * ((D * (D / l)) * (M * (M / d))))))
	else:
		tmp = t_1 * t_0
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = sqrt(Float64(d / h))
	tmp = 0.0
	if ((D <= -4.2e-105) || !(D <= 1.5e+91))
		tmp = Float64(t_1 * Float64(t_0 * Float64(-0.125 * Float64(Float64(h / d) * Float64(Float64(D * Float64(D / l)) * Float64(M * Float64(M / d)))))));
	else
		tmp = Float64(t_1 * t_0);
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / l));
	t_1 = sqrt((d / h));
	tmp = 0.0;
	if ((D <= -4.2e-105) || ~((D <= 1.5e+91)))
		tmp = t_1 * (t_0 * (-0.125 * ((h / d) * ((D * (D / l)) * (M * (M / d))))));
	else
		tmp = t_1 * t_0;
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[D, -4.2e-105], N[Not[LessEqual[D, 1.5e+91]], $MachinePrecision]], N[(t$95$1 * N[(t$95$0 * N[(-0.125 * N[(N[(h / d), $MachinePrecision] * N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;D \leq -4.2 \cdot 10^{-105} \lor \neg \left(D \leq 1.5 \cdot 10^{+91}\right):\\
\;\;\;\;t_1 \cdot \left(t_0 \cdot \left(-0.125 \cdot \left(\frac{h}{d} \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(M \cdot \frac{M}{d}\right)\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t_1 \cdot t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if D < -4.2e-105 or 1.50000000000000003e91 < D

    1. Initial program 73.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*73.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-eval73.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/273.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-eval73.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/273.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. sub-neg73.1%

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

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

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

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

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

      \[\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 inf 28.5%

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\left(\frac{D \cdot D}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot h}{d \cdot d}\right) \cdot -0.125\right)}\right) \]
    7. Taylor expanded in D around 0 28.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\frac{h}{d} \cdot \left(\color{blue}{\frac{M}{\frac{d}{M}}} \cdot \frac{D}{\frac{\ell}{D}}\right)\right) \cdot -0.125\right)\right) \]
      12. associate-/r/40.5%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\frac{h}{d} \cdot \left(\color{blue}{\left(\frac{M}{d} \cdot M\right)} \cdot \frac{D}{\frac{\ell}{D}}\right)\right) \cdot -0.125\right)\right) \]
      13. associate-/r/40.5%

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

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

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

    if -4.2e-105 < D < 1.50000000000000003e91

    1. Initial program 69.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*69.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-eval69.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/269.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-eval69.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/269.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. sub-neg69.0%

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv34.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\ell}}} \]
      4. expm1-log1p-u33.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\right)} \]
      5. expm1-udef19.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)} - 1} \]
      6. sqrt-undiv35.9%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{-d}{-\ell}}}\right)} - 1 \]
      7. frac-2neg35.9%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{d}{\ell}}}\right)} - 1 \]
    6. Applied egg-rr35.9%

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p54.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
    8. Simplified54.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification47.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;D \leq -4.2 \cdot 10^{-105} \lor \neg \left(D \leq 1.5 \cdot 10^{+91}\right):\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \cdot \left(\frac{h}{d} \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(M \cdot \frac{M}{d}\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \end{array} \]

Alternative 14: 47.1% accurate, 1.4× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;D \leq -2.6 \cdot 10^{-105} \lor \neg \left(D \leq 5 \cdot 10^{+90}\right):\\ \;\;\;\;t_1 \cdot \left(t_0 \cdot \left(\left(\frac{D \cdot D}{\ell} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)\right)\right) \cdot -0.125\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot t_0\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l))) (t_1 (sqrt (/ d h))))
   (if (or (<= D -2.6e-105) (not (<= D 5e+90)))
     (* t_1 (* t_0 (* (* (/ (* D D) l) (* h (* (/ M d) (/ M d)))) -0.125)))
     (* t_1 t_0))))
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 / h));
	double tmp;
	if ((D <= -2.6e-105) || !(D <= 5e+90)) {
		tmp = t_1 * (t_0 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125));
	} else {
		tmp = t_1 * t_0;
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sqrt((d / l))
    t_1 = sqrt((d / h))
    if ((d_1 <= (-2.6d-105)) .or. (.not. (d_1 <= 5d+90))) then
        tmp = t_1 * (t_0 * ((((d_1 * d_1) / l) * (h * ((m / d) * (m / d)))) * (-0.125d0)))
    else
        tmp = t_1 * t_0
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / l));
	double t_1 = Math.sqrt((d / h));
	double tmp;
	if ((D <= -2.6e-105) || !(D <= 5e+90)) {
		tmp = t_1 * (t_0 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125));
	} else {
		tmp = t_1 * t_0;
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / l))
	t_1 = math.sqrt((d / h))
	tmp = 0
	if (D <= -2.6e-105) or not (D <= 5e+90):
		tmp = t_1 * (t_0 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125))
	else:
		tmp = t_1 * t_0
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = sqrt(Float64(d / h))
	tmp = 0.0
	if ((D <= -2.6e-105) || !(D <= 5e+90))
		tmp = Float64(t_1 * Float64(t_0 * Float64(Float64(Float64(Float64(D * D) / l) * Float64(h * Float64(Float64(M / d) * Float64(M / d)))) * -0.125)));
	else
		tmp = Float64(t_1 * t_0);
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / l));
	t_1 = sqrt((d / h));
	tmp = 0.0;
	if ((D <= -2.6e-105) || ~((D <= 5e+90)))
		tmp = t_1 * (t_0 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125));
	else
		tmp = t_1 * t_0;
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[D, -2.6e-105], N[Not[LessEqual[D, 5e+90]], $MachinePrecision]], N[(t$95$1 * N[(t$95$0 * N[(N[(N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision] * N[(h * N[(N[(M / d), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;D \leq -2.6 \cdot 10^{-105} \lor \neg \left(D \leq 5 \cdot 10^{+90}\right):\\
\;\;\;\;t_1 \cdot \left(t_0 \cdot \left(\left(\frac{D \cdot D}{\ell} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)\right)\right) \cdot -0.125\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t_1 \cdot t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if D < -2.5999999999999999e-105 or 5.0000000000000004e90 < D

    1. Initial program 73.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*73.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-eval73.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/273.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-eval73.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/273.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. sub-neg73.1%

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

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

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

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

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

      \[\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 inf 28.5%

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\left(\frac{D \cdot D}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot h}{d \cdot d}\right) \cdot -0.125\right)}\right) \]
    7. Taylor expanded in M around 0 30.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\frac{D \cdot D}{\ell} \cdot \left(h \cdot \frac{M \cdot M}{\color{blue}{d \cdot d}}\right)\right) \cdot -0.125\right)\right) \]
      12. times-frac42.1%

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

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

    if -2.5999999999999999e-105 < D < 5.0000000000000004e90

    1. Initial program 69.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*69.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-eval69.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/269.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-eval69.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/269.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. sub-neg69.0%

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv34.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\ell}}} \]
      4. expm1-log1p-u33.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\right)} \]
      5. expm1-udef19.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)} - 1} \]
      6. sqrt-undiv35.9%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{-d}{-\ell}}}\right)} - 1 \]
      7. frac-2neg35.9%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{d}{\ell}}}\right)} - 1 \]
    6. Applied egg-rr35.9%

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p54.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
    8. Simplified54.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;D \leq -2.6 \cdot 10^{-105} \lor \neg \left(D \leq 5 \cdot 10^{+90}\right):\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\frac{D \cdot D}{\ell} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)\right)\right) \cdot -0.125\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \end{array} \]

Alternative 15: 47.6% accurate, 1.5× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \frac{\frac{1}{\ell}}{h}\\ \mathbf{if}\;d \leq -3 \cdot 10^{+124}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;d \leq -8.2 \cdot 10^{-171}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq 2.5 \cdot 10^{-288}:\\ \;\;\;\;d \cdot \sqrt{\sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}}\\ \mathbf{elif}\;d \leq 3.5 \cdot 10^{-134} \lor \neg \left(d \leq 1.24 \cdot 10^{-64}\right) \land d \leq 47000000:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{\frac{d}{M \cdot M}}{D \cdot D}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (/ (/ 1.0 l) h)))
   (if (<= d -3e+124)
     (* d (- (pow (* h l) -0.5)))
     (if (<= d -8.2e-171)
       (* (sqrt (/ d h)) (sqrt (/ d l)))
       (if (<= d 2.5e-288)
         (* d (sqrt (cbrt (* t_0 (* t_0 t_0)))))
         (if (or (<= d 3.5e-134) (and (not (<= d 1.24e-64)) (<= d 47000000.0)))
           (* (sqrt (/ h (pow l 3.0))) (/ -0.125 (/ (/ d (* M M)) (* D D))))
           (* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = (1.0 / l) / h;
	double tmp;
	if (d <= -3e+124) {
		tmp = d * -pow((h * l), -0.5);
	} else if (d <= -8.2e-171) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else if (d <= 2.5e-288) {
		tmp = d * sqrt(cbrt((t_0 * (t_0 * t_0))));
	} else if ((d <= 3.5e-134) || (!(d <= 1.24e-64) && (d <= 47000000.0))) {
		tmp = sqrt((h / pow(l, 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)));
	} else {
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	}
	return tmp;
}
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = (1.0 / l) / h;
	double tmp;
	if (d <= -3e+124) {
		tmp = d * -Math.pow((h * l), -0.5);
	} else if (d <= -8.2e-171) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else if (d <= 2.5e-288) {
		tmp = d * Math.sqrt(Math.cbrt((t_0 * (t_0 * t_0))));
	} else if ((d <= 3.5e-134) || (!(d <= 1.24e-64) && (d <= 47000000.0))) {
		tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)));
	} else {
		tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
	}
	return tmp;
}
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(Float64(1.0 / l) / h)
	tmp = 0.0
	if (d <= -3e+124)
		tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5)));
	elseif (d <= -8.2e-171)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	elseif (d <= 2.5e-288)
		tmp = Float64(d * sqrt(cbrt(Float64(t_0 * Float64(t_0 * t_0)))));
	elseif ((d <= 3.5e-134) || (!(d <= 1.24e-64) && (d <= 47000000.0)))
		tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 / Float64(Float64(d / Float64(M * M)) / Float64(D * D))));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h)));
	end
	return tmp
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[d, -3e+124], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -8.2e-171], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.5e-288], N[(d * N[Sqrt[N[Power[N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 3.5e-134], And[N[Not[LessEqual[d, 1.24e-64]], $MachinePrecision], LessEqual[d, 47000000.0]]], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 / N[(N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{\ell}}{h}\\
\mathbf{if}\;d \leq -3 \cdot 10^{+124}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\

\mathbf{elif}\;d \leq -8.2 \cdot 10^{-171}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

\mathbf{elif}\;d \leq 2.5 \cdot 10^{-288}:\\
\;\;\;\;d \cdot \sqrt{\sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}}\\

\mathbf{elif}\;d \leq 3.5 \cdot 10^{-134} \lor \neg \left(d \leq 1.24 \cdot 10^{-64}\right) \land d \leq 47000000:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{\frac{d}{M \cdot M}}{D \cdot D}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -3e124

    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. sub-neg72.1%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg53.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv63.5%

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/63.6%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified63.6%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    9. Taylor expanded in d around -inf 65.7%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg65.7%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/l/65.7%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      3. unpow1/265.7%

        \[\leadsto -d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
      4. distribute-rgt-neg-in65.7%

        \[\leadsto \color{blue}{d \cdot \left(-{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\right)} \]
      5. exp-to-pow63.4%

        \[\leadsto d \cdot \left(-\color{blue}{e^{\log \left(\frac{\frac{1}{h}}{\ell}\right) \cdot 0.5}}\right) \]
      6. associate-/l/63.4%

        \[\leadsto d \cdot \left(-e^{\log \color{blue}{\left(\frac{1}{\ell \cdot h}\right)} \cdot 0.5}\right) \]
      7. log-rec63.4%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\left(-\log \left(\ell \cdot h\right)\right)} \cdot 0.5}\right) \]
      8. *-commutative63.4%

        \[\leadsto d \cdot \left(-e^{\left(-\log \color{blue}{\left(h \cdot \ell\right)}\right) \cdot 0.5}\right) \]
      9. distribute-lft-neg-out63.4%

        \[\leadsto d \cdot \left(-e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}}\right) \]
      10. distribute-rgt-neg-in63.4%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}}\right) \]
      11. metadata-eval63.4%

        \[\leadsto d \cdot \left(-e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}}\right) \]
      12. exp-prod63.4%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(e^{\log \left(h \cdot \ell\right)}\right)}^{-0.5}}\right) \]
      13. *-commutative63.4%

        \[\leadsto d \cdot \left(-{\left(e^{\log \color{blue}{\left(\ell \cdot h\right)}}\right)}^{-0.5}\right) \]
      14. rem-exp-log65.9%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(\ell \cdot h\right)}}^{-0.5}\right) \]
      15. *-commutative65.9%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(h \cdot \ell\right)}}^{-0.5}\right) \]
    11. Simplified65.9%

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

    if -3e124 < d < -8.2e-171

    1. Initial program 80.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*80.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-eval80.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/280.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-eval80.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/280.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. sub-neg80.2%

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg46.5%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv52.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\ell}}} \]
      4. expm1-log1p-u51.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\right)} \]
      5. expm1-udef24.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)} - 1} \]
      6. sqrt-undiv22.7%

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

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{d}{\ell}}}\right)} - 1 \]
    6. Applied egg-rr22.7%

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p46.5%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
    8. Simplified46.5%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]

    if -8.2e-171 < d < 2.50000000000000005e-288

    1. Initial program 37.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*37.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-eval37.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/237.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-eval37.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/237.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. sub-neg37.6%

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 19.3%

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

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

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

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    8. Step-by-step derivation
      1. add-cbrt-cube27.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{\sqrt[3]{\left(\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}\right) \cdot \frac{\frac{1}{\ell}}{h}}}} \]
    9. Applied egg-rr27.6%

      \[\leadsto d \cdot \sqrt{\color{blue}{\sqrt[3]{\left(\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}\right) \cdot \frac{\frac{1}{\ell}}{h}}}} \]

    if 2.50000000000000005e-288 < d < 3.4999999999999998e-134 or 1.24000000000000006e-64 < d < 4.7e7

    1. Initial program 72.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-eval72.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/272.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-eval72.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/272.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. *-commutative72.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*72.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.5%

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    6. Taylor expanded in d around 0 51.0%

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

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

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

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

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\frac{-0.125 \cdot {D}^{2}}{\frac{d}{{M}^{2}}}} \]
      5. associate-/l*53.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\frac{-0.125}{\frac{\frac{d}{{M}^{2}}}{{D}^{2}}}} \]
      6. unpow253.7%

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

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

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

    if 3.4999999999999998e-134 < d < 1.24000000000000006e-64 or 4.7e7 < d

    1. Initial program 77.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*77.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-eval77.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/277.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-eval77.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/277.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. sub-neg77.2%

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 59.4%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative59.4%

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

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

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

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
    9. Applied egg-rr70.3%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification56.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -3 \cdot 10^{+124}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;d \leq -8.2 \cdot 10^{-171}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq 2.5 \cdot 10^{-288}:\\ \;\;\;\;d \cdot \sqrt{\sqrt[3]{\frac{\frac{1}{\ell}}{h} \cdot \left(\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}\right)}}\\ \mathbf{elif}\;d \leq 3.5 \cdot 10^{-134} \lor \neg \left(d \leq 1.24 \cdot 10^{-64}\right) \land d \leq 47000000:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{\frac{d}{M \cdot M}}{D \cdot D}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 16: 47.8% accurate, 1.5× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -1.45 \cdot 10^{+125}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;d \leq -5.4 \cdot 10^{-170}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq 2.5 \cdot 10^{-288}:\\ \;\;\;\;d \cdot \sqrt{\sqrt[3]{\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell} \cdot \frac{\frac{1}{h}}{\ell}}{h}}}\\ \mathbf{elif}\;d \leq 6.2 \cdot 10^{-134} \lor \neg \left(d \leq 1.06 \cdot 10^{-64}\right) \land d \leq 58000000:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{\frac{d}{M \cdot M}}{D \cdot D}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= d -1.45e+125)
   (* d (- (pow (* h l) -0.5)))
   (if (<= d -5.4e-170)
     (* (sqrt (/ d h)) (sqrt (/ d l)))
     (if (<= d 2.5e-288)
       (*
        d
        (sqrt (cbrt (* (/ (/ 1.0 l) h) (/ (* (/ 1.0 l) (/ (/ 1.0 h) l)) h)))))
       (if (or (<= d 6.2e-134) (and (not (<= d 1.06e-64)) (<= d 58000000.0)))
         (* (sqrt (/ h (pow l 3.0))) (/ -0.125 (/ (/ d (* M M)) (* D D))))
         (* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -1.45e+125) {
		tmp = d * -pow((h * l), -0.5);
	} else if (d <= -5.4e-170) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else if (d <= 2.5e-288) {
		tmp = d * sqrt(cbrt((((1.0 / l) / h) * (((1.0 / l) * ((1.0 / h) / l)) / h))));
	} else if ((d <= 6.2e-134) || (!(d <= 1.06e-64) && (d <= 58000000.0))) {
		tmp = sqrt((h / pow(l, 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)));
	} else {
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	}
	return tmp;
}
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -1.45e+125) {
		tmp = d * -Math.pow((h * l), -0.5);
	} else if (d <= -5.4e-170) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else if (d <= 2.5e-288) {
		tmp = d * Math.sqrt(Math.cbrt((((1.0 / l) / h) * (((1.0 / l) * ((1.0 / h) / l)) / h))));
	} else if ((d <= 6.2e-134) || (!(d <= 1.06e-64) && (d <= 58000000.0))) {
		tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)));
	} else {
		tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
	}
	return tmp;
}
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= -1.45e+125)
		tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5)));
	elseif (d <= -5.4e-170)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	elseif (d <= 2.5e-288)
		tmp = Float64(d * sqrt(cbrt(Float64(Float64(Float64(1.0 / l) / h) * Float64(Float64(Float64(1.0 / l) * Float64(Float64(1.0 / h) / l)) / h)))));
	elseif ((d <= 6.2e-134) || (!(d <= 1.06e-64) && (d <= 58000000.0)))
		tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 / Float64(Float64(d / Float64(M * M)) / Float64(D * D))));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h)));
	end
	return tmp
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -1.45e+125], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -5.4e-170], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.5e-288], N[(d * N[Sqrt[N[Power[N[(N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision] * N[(N[(N[(1.0 / l), $MachinePrecision] * N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 6.2e-134], And[N[Not[LessEqual[d, 1.06e-64]], $MachinePrecision], LessEqual[d, 58000000.0]]], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 / N[(N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.45 \cdot 10^{+125}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\

\mathbf{elif}\;d \leq -5.4 \cdot 10^{-170}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

\mathbf{elif}\;d \leq 2.5 \cdot 10^{-288}:\\
\;\;\;\;d \cdot \sqrt{\sqrt[3]{\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell} \cdot \frac{\frac{1}{h}}{\ell}}{h}}}\\

\mathbf{elif}\;d \leq 6.2 \cdot 10^{-134} \lor \neg \left(d \leq 1.06 \cdot 10^{-64}\right) \land d \leq 58000000:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{\frac{d}{M \cdot M}}{D \cdot D}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -1.44999999999999997e125

    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. sub-neg72.1%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg53.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv63.5%

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/63.6%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified63.6%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    9. Taylor expanded in d around -inf 65.7%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg65.7%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/l/65.7%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      3. unpow1/265.7%

        \[\leadsto -d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
      4. distribute-rgt-neg-in65.7%

        \[\leadsto \color{blue}{d \cdot \left(-{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\right)} \]
      5. exp-to-pow63.4%

        \[\leadsto d \cdot \left(-\color{blue}{e^{\log \left(\frac{\frac{1}{h}}{\ell}\right) \cdot 0.5}}\right) \]
      6. associate-/l/63.4%

        \[\leadsto d \cdot \left(-e^{\log \color{blue}{\left(\frac{1}{\ell \cdot h}\right)} \cdot 0.5}\right) \]
      7. log-rec63.4%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\left(-\log \left(\ell \cdot h\right)\right)} \cdot 0.5}\right) \]
      8. *-commutative63.4%

        \[\leadsto d \cdot \left(-e^{\left(-\log \color{blue}{\left(h \cdot \ell\right)}\right) \cdot 0.5}\right) \]
      9. distribute-lft-neg-out63.4%

        \[\leadsto d \cdot \left(-e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}}\right) \]
      10. distribute-rgt-neg-in63.4%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}}\right) \]
      11. metadata-eval63.4%

        \[\leadsto d \cdot \left(-e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}}\right) \]
      12. exp-prod63.4%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(e^{\log \left(h \cdot \ell\right)}\right)}^{-0.5}}\right) \]
      13. *-commutative63.4%

        \[\leadsto d \cdot \left(-{\left(e^{\log \color{blue}{\left(\ell \cdot h\right)}}\right)}^{-0.5}\right) \]
      14. rem-exp-log65.9%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(\ell \cdot h\right)}}^{-0.5}\right) \]
      15. *-commutative65.9%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(h \cdot \ell\right)}}^{-0.5}\right) \]
    11. Simplified65.9%

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

    if -1.44999999999999997e125 < d < -5.3999999999999997e-170

    1. Initial program 80.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*80.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-eval80.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/280.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-eval80.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/280.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. sub-neg80.2%

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg46.5%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv52.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\ell}}} \]
      4. expm1-log1p-u51.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\right)} \]
      5. expm1-udef24.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)} - 1} \]
      6. sqrt-undiv22.7%

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

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{d}{\ell}}}\right)} - 1 \]
    6. Applied egg-rr22.7%

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p46.5%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
    8. Simplified46.5%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]

    if -5.3999999999999997e-170 < d < 2.50000000000000005e-288

    1. Initial program 37.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*37.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-eval37.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/237.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-eval37.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/237.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. sub-neg37.6%

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 19.3%

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

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

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

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    8. Step-by-step derivation
      1. add-cbrt-cube27.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{\sqrt[3]{\left(\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}\right) \cdot \frac{\frac{1}{\ell}}{h}}}} \]
    9. Applied egg-rr27.6%

      \[\leadsto d \cdot \sqrt{\color{blue}{\sqrt[3]{\left(\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}\right) \cdot \frac{\frac{1}{\ell}}{h}}}} \]
    10. Step-by-step derivation
      1. associate-*r/27.7%

        \[\leadsto d \cdot \sqrt{\sqrt[3]{\color{blue}{\frac{\frac{\frac{1}{\ell}}{h} \cdot \frac{1}{\ell}}{h}} \cdot \frac{\frac{1}{\ell}}{h}}} \]
      2. associate-/l/27.7%

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

        \[\leadsto d \cdot \sqrt{\sqrt[3]{\frac{\color{blue}{{\left(h \cdot \ell\right)}^{-1}} \cdot \frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}}} \]
      4. pow-prod-down27.7%

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

        \[\leadsto d \cdot \sqrt{\sqrt[3]{\frac{\left(\color{blue}{\frac{1}{h}} \cdot {\ell}^{-1}\right) \cdot \frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}}} \]
      6. inv-pow27.7%

        \[\leadsto d \cdot \sqrt{\sqrt[3]{\frac{\left(\frac{1}{h} \cdot \color{blue}{\frac{1}{\ell}}\right) \cdot \frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}}} \]
      7. div-inv27.7%

        \[\leadsto d \cdot \sqrt{\sqrt[3]{\frac{\color{blue}{\frac{\frac{1}{h}}{\ell}} \cdot \frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}}} \]
    11. Applied egg-rr27.7%

      \[\leadsto d \cdot \sqrt{\sqrt[3]{\color{blue}{\frac{\frac{\frac{1}{h}}{\ell} \cdot \frac{1}{\ell}}{h}} \cdot \frac{\frac{1}{\ell}}{h}}} \]

    if 2.50000000000000005e-288 < d < 6.20000000000000012e-134 or 1.06000000000000007e-64 < d < 5.8e7

    1. Initial program 72.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-eval72.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/272.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-eval72.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/272.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. *-commutative72.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*72.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.5%

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\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) \]
    6. Taylor expanded in d around 0 51.0%

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

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

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

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

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\frac{-0.125 \cdot {D}^{2}}{\frac{d}{{M}^{2}}}} \]
      5. associate-/l*53.7%

        \[\leadsto \sqrt{\frac{h}{{\ell}^{3}}} \cdot \color{blue}{\frac{-0.125}{\frac{\frac{d}{{M}^{2}}}{{D}^{2}}}} \]
      6. unpow253.7%

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

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

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

    if 6.20000000000000012e-134 < d < 1.06000000000000007e-64 or 5.8e7 < d

    1. Initial program 77.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*77.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-eval77.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/277.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-eval77.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/277.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. sub-neg77.2%

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 59.4%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative59.4%

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

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

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

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
    9. Applied egg-rr70.3%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification56.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.45 \cdot 10^{+125}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;d \leq -5.4 \cdot 10^{-170}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq 2.5 \cdot 10^{-288}:\\ \;\;\;\;d \cdot \sqrt{\sqrt[3]{\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell} \cdot \frac{\frac{1}{h}}{\ell}}{h}}}\\ \mathbf{elif}\;d \leq 6.2 \cdot 10^{-134} \lor \neg \left(d \leq 1.06 \cdot 10^{-64}\right) \land d \leq 58000000:\\ \;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{\frac{d}{M \cdot M}}{D \cdot D}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 17: 45.8% accurate, 1.5× speedup?

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

\mathbf{elif}\;d \leq -3.4 \cdot 10^{-155}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

\mathbf{elif}\;d \leq -3.25 \cdot 10^{-295}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;d \leq 1.45 \cdot 10^{-269}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\

\mathbf{elif}\;d \leq 5 \cdot 10^{-211}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -1.2e125 or -3.4e-155 < d < -3.2499999999999999e-295

    1. Initial program 55.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*55.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-eval55.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/255.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-eval55.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/255.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. sub-neg55.3%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg37.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv50.6%

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/50.6%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified50.6%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    9. Taylor expanded in d around -inf 51.9%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg51.9%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/l/51.9%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      3. unpow1/251.9%

        \[\leadsto -d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
      4. distribute-rgt-neg-in51.9%

        \[\leadsto \color{blue}{d \cdot \left(-{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\right)} \]
      5. exp-to-pow49.5%

        \[\leadsto d \cdot \left(-\color{blue}{e^{\log \left(\frac{\frac{1}{h}}{\ell}\right) \cdot 0.5}}\right) \]
      6. associate-/l/49.5%

        \[\leadsto d \cdot \left(-e^{\log \color{blue}{\left(\frac{1}{\ell \cdot h}\right)} \cdot 0.5}\right) \]
      7. log-rec49.5%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\left(-\log \left(\ell \cdot h\right)\right)} \cdot 0.5}\right) \]
      8. *-commutative49.5%

        \[\leadsto d \cdot \left(-e^{\left(-\log \color{blue}{\left(h \cdot \ell\right)}\right) \cdot 0.5}\right) \]
      9. distribute-lft-neg-out49.5%

        \[\leadsto d \cdot \left(-e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}}\right) \]
      10. distribute-rgt-neg-in49.5%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}}\right) \]
      11. metadata-eval49.5%

        \[\leadsto d \cdot \left(-e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}}\right) \]
      12. exp-prod49.5%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(e^{\log \left(h \cdot \ell\right)}\right)}^{-0.5}}\right) \]
      13. *-commutative49.5%

        \[\leadsto d \cdot \left(-{\left(e^{\log \color{blue}{\left(\ell \cdot h\right)}}\right)}^{-0.5}\right) \]
      14. rem-exp-log51.9%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(\ell \cdot h\right)}}^{-0.5}\right) \]
      15. *-commutative51.9%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(h \cdot \ell\right)}}^{-0.5}\right) \]
    11. Simplified51.9%

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]

    if -1.2e125 < d < -3.4e-155

    1. Initial program 84.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*84.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-eval84.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/284.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-eval84.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/284.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-neg84.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. +-commutative84.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. *-commutative84.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-in84.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-def84.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. Simplified84.8%

      \[\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 46.6%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. *-rgt-identity46.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg46.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv48.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\ell}}} \]
      4. expm1-log1p-u46.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\right)} \]
      5. expm1-udef26.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)} - 1} \]
      6. sqrt-undiv25.1%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{-d}{-\ell}}}\right)} - 1 \]
      7. frac-2neg25.1%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{d}{\ell}}}\right)} - 1 \]
    6. Applied egg-rr25.1%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)} - 1} \]
    7. Step-by-step derivation
      1. expm1-def45.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)} \]
      2. expm1-log1p46.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]
    8. Simplified46.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \]

    if -3.2499999999999999e-295 < d < 1.45e-269

    1. Initial program 43.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. associate-*l*43.4%

        \[\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-eval43.4%

        \[\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/243.4%

        \[\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-eval43.4%

        \[\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/243.4%

        \[\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-neg43.4%

        \[\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. +-commutative43.4%

        \[\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. *-commutative43.4%

        \[\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-in43.4%

        \[\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-def43.4%

        \[\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. Simplified43.4%

      \[\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 16.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 44.6%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative44.6%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/r*44.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    7. Simplified44.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    8. Taylor expanded in l around 0 44.6%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. *-commutative44.6%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      2. associate-/r*44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    10. Simplified44.6%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    11. Step-by-step derivation
      1. div-inv44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h} \cdot \frac{1}{\ell}}} \]
      2. inv-pow44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{{h}^{-1}} \cdot \frac{1}{\ell}} \]
      3. inv-pow44.6%

        \[\leadsto d \cdot \sqrt{{h}^{-1} \cdot \color{blue}{{\ell}^{-1}}} \]
      4. pow-prod-down44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      5. inv-pow44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
      6. associate-/l/44.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      7. add-cbrt-cube37.4%

        \[\leadsto d \cdot \sqrt{\color{blue}{\sqrt[3]{\left(\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}\right) \cdot \frac{\frac{1}{\ell}}{h}}}} \]
      8. add-cbrt-cube44.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      9. add-sqr-sqrt44.5%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)} \]
      10. expm1-log1p-u15.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)\right)\right)} \]
      11. expm1-udef2.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)\right)} - 1} \]
    12. Applied egg-rr2.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)} - 1} \]
    13. Step-by-step derivation
      1. expm1-def16.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)\right)} \]
      2. expm1-log1p44.6%

        \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
      3. associate-*r/44.6%

        \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
      4. *-rgt-identity44.6%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    14. Simplified44.6%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]

    if 1.45e-269 < d < 5.0000000000000002e-211

    1. Initial program 73.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*73.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-eval73.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/273.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-eval73.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/273.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. sub-neg73.1%

        \[\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. +-commutative73.1%

        \[\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. *-commutative73.1%

        \[\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-in73.1%

        \[\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-def73.1%

        \[\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. Simplified73.1%

      \[\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 1.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. *-rgt-identity1.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg1.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv0.0%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\ell}}} \]
      4. associate-*r/0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    6. Applied egg-rr0.0%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    7. Step-by-step derivation
      1. associate-/l*0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    9. Taylor expanded in d around -inf 46.9%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg46.9%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/l/46.9%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      3. unpow1/246.9%

        \[\leadsto -d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
      4. distribute-rgt-neg-in46.9%

        \[\leadsto \color{blue}{d \cdot \left(-{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\right)} \]
      5. unpow1/246.9%

        \[\leadsto d \cdot \left(-\color{blue}{\sqrt{\frac{\frac{1}{h}}{\ell}}}\right) \]
    11. Simplified46.9%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)} \]

    if 5.0000000000000002e-211 < d

    1. Initial program 78.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*78.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-eval78.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/278.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-eval78.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/278.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. sub-neg78.0%

        \[\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. +-commutative78.0%

        \[\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. *-commutative78.0%

        \[\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-in78.0%

        \[\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-def78.0%

        \[\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. Simplified77.1%

      \[\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 47.9%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 50.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative50.0%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/r*50.1%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    7. Simplified50.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    8. Step-by-step derivation
      1. sqrt-div60.5%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
    9. Applied egg-rr60.5%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification53.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.2 \cdot 10^{+125}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;d \leq -3.4 \cdot 10^{-155}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq -3.25 \cdot 10^{-295}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;d \leq 1.45 \cdot 10^{-269}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 5 \cdot 10^{-211}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 18: 45.5% accurate, 1.5× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{if}\;d \leq -1.25 \cdot 10^{+118}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq -1.55 \cdot 10^{-155}:\\ \;\;\;\;\frac{\sqrt{\frac{d \cdot \left(-d\right)}{h}}}{\sqrt{-\ell}}\\ \mathbf{elif}\;d \leq -7 \cdot 10^{-295}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 1.7 \cdot 10^{-270}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 4.9 \cdot 10^{-210}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* d (- (pow (* h l) -0.5)))))
   (if (<= d -1.25e+118)
     t_0
     (if (<= d -1.55e-155)
       (/ (sqrt (/ (* d (- d)) h)) (sqrt (- l)))
       (if (<= d -7e-295)
         t_0
         (if (<= d 1.7e-270)
           (/ d (sqrt (* h l)))
           (if (<= d 4.9e-210)
             (* d (- (sqrt (/ (/ 1.0 h) l))))
             (* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = d * -pow((h * l), -0.5);
	double tmp;
	if (d <= -1.25e+118) {
		tmp = t_0;
	} else if (d <= -1.55e-155) {
		tmp = sqrt(((d * -d) / h)) / sqrt(-l);
	} else if (d <= -7e-295) {
		tmp = t_0;
	} else if (d <= 1.7e-270) {
		tmp = d / sqrt((h * l));
	} else if (d <= 4.9e-210) {
		tmp = d * -sqrt(((1.0 / h) / l));
	} else {
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = d * -((h * l) ** (-0.5d0))
    if (d <= (-1.25d+118)) then
        tmp = t_0
    else if (d <= (-1.55d-155)) then
        tmp = sqrt(((d * -d) / h)) / sqrt(-l)
    else if (d <= (-7d-295)) then
        tmp = t_0
    else if (d <= 1.7d-270) then
        tmp = d / sqrt((h * l))
    else if (d <= 4.9d-210) then
        tmp = d * -sqrt(((1.0d0 / h) / l))
    else
        tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = d * -Math.pow((h * l), -0.5);
	double tmp;
	if (d <= -1.25e+118) {
		tmp = t_0;
	} else if (d <= -1.55e-155) {
		tmp = Math.sqrt(((d * -d) / h)) / Math.sqrt(-l);
	} else if (d <= -7e-295) {
		tmp = t_0;
	} else if (d <= 1.7e-270) {
		tmp = d / Math.sqrt((h * l));
	} else if (d <= 4.9e-210) {
		tmp = d * -Math.sqrt(((1.0 / h) / l));
	} else {
		tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	t_0 = d * -math.pow((h * l), -0.5)
	tmp = 0
	if d <= -1.25e+118:
		tmp = t_0
	elif d <= -1.55e-155:
		tmp = math.sqrt(((d * -d) / h)) / math.sqrt(-l)
	elif d <= -7e-295:
		tmp = t_0
	elif d <= 1.7e-270:
		tmp = d / math.sqrt((h * l))
	elif d <= 4.9e-210:
		tmp = d * -math.sqrt(((1.0 / h) / l))
	else:
		tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	t_0 = Float64(d * Float64(-(Float64(h * l) ^ -0.5)))
	tmp = 0.0
	if (d <= -1.25e+118)
		tmp = t_0;
	elseif (d <= -1.55e-155)
		tmp = Float64(sqrt(Float64(Float64(d * Float64(-d)) / h)) / sqrt(Float64(-l)));
	elseif (d <= -7e-295)
		tmp = t_0;
	elseif (d <= 1.7e-270)
		tmp = Float64(d / sqrt(Float64(h * l)));
	elseif (d <= 4.9e-210)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l))));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = d * -((h * l) ^ -0.5);
	tmp = 0.0;
	if (d <= -1.25e+118)
		tmp = t_0;
	elseif (d <= -1.55e-155)
		tmp = sqrt(((d * -d) / h)) / sqrt(-l);
	elseif (d <= -7e-295)
		tmp = t_0;
	elseif (d <= 1.7e-270)
		tmp = d / sqrt((h * l));
	elseif (d <= 4.9e-210)
		tmp = d * -sqrt(((1.0 / h) / l));
	else
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -1.25e+118], t$95$0, If[LessEqual[d, -1.55e-155], N[(N[Sqrt[N[(N[(d * (-d)), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7e-295], t$95$0, If[LessEqual[d, 1.7e-270], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.9e-210], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{if}\;d \leq -1.25 \cdot 10^{+118}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;d \leq -1.55 \cdot 10^{-155}:\\
\;\;\;\;\frac{\sqrt{\frac{d \cdot \left(-d\right)}{h}}}{\sqrt{-\ell}}\\

\mathbf{elif}\;d \leq -7 \cdot 10^{-295}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;d \leq 1.7 \cdot 10^{-270}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\

\mathbf{elif}\;d \leq 4.9 \cdot 10^{-210}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -1.24999999999999993e118 or -1.55e-155 < d < -6.99999999999999977e-295

    1. Initial program 57.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*57.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-eval57.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/257.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-eval57.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/257.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. sub-neg57.7%

        \[\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. +-commutative57.7%

        \[\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. *-commutative57.7%

        \[\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-in57.7%

        \[\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-def57.7%

        \[\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. Simplified57.5%

      \[\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 40.7%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. *-rgt-identity40.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg40.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv53.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\ell}}} \]
      4. associate-*r/53.3%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    6. Applied egg-rr53.3%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    7. Step-by-step derivation
      1. associate-/l*53.4%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/53.2%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified53.2%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    9. Taylor expanded in d around -inf 54.4%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg54.4%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/l/54.4%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      3. unpow1/254.4%

        \[\leadsto -d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
      4. distribute-rgt-neg-in54.4%

        \[\leadsto \color{blue}{d \cdot \left(-{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\right)} \]
      5. exp-to-pow51.9%

        \[\leadsto d \cdot \left(-\color{blue}{e^{\log \left(\frac{\frac{1}{h}}{\ell}\right) \cdot 0.5}}\right) \]
      6. associate-/l/51.9%

        \[\leadsto d \cdot \left(-e^{\log \color{blue}{\left(\frac{1}{\ell \cdot h}\right)} \cdot 0.5}\right) \]
      7. log-rec51.9%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\left(-\log \left(\ell \cdot h\right)\right)} \cdot 0.5}\right) \]
      8. *-commutative51.9%

        \[\leadsto d \cdot \left(-e^{\left(-\log \color{blue}{\left(h \cdot \ell\right)}\right) \cdot 0.5}\right) \]
      9. distribute-lft-neg-out51.9%

        \[\leadsto d \cdot \left(-e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}}\right) \]
      10. distribute-rgt-neg-in51.9%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}}\right) \]
      11. metadata-eval51.9%

        \[\leadsto d \cdot \left(-e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}}\right) \]
      12. exp-prod51.9%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(e^{\log \left(h \cdot \ell\right)}\right)}^{-0.5}}\right) \]
      13. *-commutative51.9%

        \[\leadsto d \cdot \left(-{\left(e^{\log \color{blue}{\left(\ell \cdot h\right)}}\right)}^{-0.5}\right) \]
      14. rem-exp-log54.5%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(\ell \cdot h\right)}}^{-0.5}\right) \]
      15. *-commutative54.5%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(h \cdot \ell\right)}}^{-0.5}\right) \]
    11. Simplified54.5%

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]

    if -1.24999999999999993e118 < d < -1.55e-155

    1. Initial program 83.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*83.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-eval83.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/283.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-eval83.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/283.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. sub-neg83.5%

        \[\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. +-commutative83.5%

        \[\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. *-commutative83.5%

        \[\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-in83.5%

        \[\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-def83.5%

        \[\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. Simplified83.6%

      \[\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 42.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. *-rgt-identity42.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg42.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv44.0%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\ell}}} \]
      4. associate-*r/44.1%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    6. Applied egg-rr44.1%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    7. Step-by-step derivation
      1. associate-/l*44.0%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/44.0%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified44.0%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    9. Step-by-step derivation
      1. associate-*l/44.1%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
      2. pow1/244.1%

        \[\leadsto \frac{\color{blue}{{\left(\frac{d}{h}\right)}^{0.5}} \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
      3. pow1/244.1%

        \[\leadsto \frac{{\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(-d\right)}^{0.5}}}{\sqrt{-\ell}} \]
      4. pow-prod-down43.0%

        \[\leadsto \frac{\color{blue}{{\left(\frac{d}{h} \cdot \left(-d\right)\right)}^{0.5}}}{\sqrt{-\ell}} \]
    10. Applied egg-rr43.0%

      \[\leadsto \color{blue}{\frac{{\left(\frac{d}{h} \cdot \left(-d\right)\right)}^{0.5}}{\sqrt{-\ell}}} \]
    11. Step-by-step derivation
      1. unpow1/243.0%

        \[\leadsto \frac{\color{blue}{\sqrt{\frac{d}{h} \cdot \left(-d\right)}}}{\sqrt{-\ell}} \]
      2. associate-*l/43.0%

        \[\leadsto \frac{\sqrt{\color{blue}{\frac{d \cdot \left(-d\right)}{h}}}}{\sqrt{-\ell}} \]
      3. distribute-rgt-neg-out43.0%

        \[\leadsto \frac{\sqrt{\frac{\color{blue}{-d \cdot d}}{h}}}{\sqrt{-\ell}} \]
    12. Simplified43.0%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{-d \cdot d}{h}}}{\sqrt{-\ell}}} \]

    if -6.99999999999999977e-295 < d < 1.7e-270

    1. Initial program 43.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. associate-*l*43.4%

        \[\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-eval43.4%

        \[\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/243.4%

        \[\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-eval43.4%

        \[\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/243.4%

        \[\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-neg43.4%

        \[\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. +-commutative43.4%

        \[\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. *-commutative43.4%

        \[\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-in43.4%

        \[\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-def43.4%

        \[\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. Simplified43.4%

      \[\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 16.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 44.6%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative44.6%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/r*44.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    7. Simplified44.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    8. Taylor expanded in l around 0 44.6%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. *-commutative44.6%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      2. associate-/r*44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    10. Simplified44.6%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    11. Step-by-step derivation
      1. div-inv44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h} \cdot \frac{1}{\ell}}} \]
      2. inv-pow44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{{h}^{-1}} \cdot \frac{1}{\ell}} \]
      3. inv-pow44.6%

        \[\leadsto d \cdot \sqrt{{h}^{-1} \cdot \color{blue}{{\ell}^{-1}}} \]
      4. pow-prod-down44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      5. inv-pow44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
      6. associate-/l/44.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      7. add-cbrt-cube37.4%

        \[\leadsto d \cdot \sqrt{\color{blue}{\sqrt[3]{\left(\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}\right) \cdot \frac{\frac{1}{\ell}}{h}}}} \]
      8. add-cbrt-cube44.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      9. add-sqr-sqrt44.5%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)} \]
      10. expm1-log1p-u15.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)\right)\right)} \]
      11. expm1-udef2.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)\right)} - 1} \]
    12. Applied egg-rr2.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)} - 1} \]
    13. Step-by-step derivation
      1. expm1-def16.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)\right)} \]
      2. expm1-log1p44.6%

        \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
      3. associate-*r/44.6%

        \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
      4. *-rgt-identity44.6%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    14. Simplified44.6%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]

    if 1.7e-270 < d < 4.8999999999999998e-210

    1. Initial program 73.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*73.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-eval73.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/273.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-eval73.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/273.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. sub-neg73.1%

        \[\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. +-commutative73.1%

        \[\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. *-commutative73.1%

        \[\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-in73.1%

        \[\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-def73.1%

        \[\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. Simplified73.1%

      \[\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 1.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. *-rgt-identity1.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg1.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv0.0%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\ell}}} \]
      4. associate-*r/0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    6. Applied egg-rr0.0%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    7. Step-by-step derivation
      1. associate-/l*0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    9. Taylor expanded in d around -inf 46.9%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg46.9%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/l/46.9%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      3. unpow1/246.9%

        \[\leadsto -d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
      4. distribute-rgt-neg-in46.9%

        \[\leadsto \color{blue}{d \cdot \left(-{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\right)} \]
      5. unpow1/246.9%

        \[\leadsto d \cdot \left(-\color{blue}{\sqrt{\frac{\frac{1}{h}}{\ell}}}\right) \]
    11. Simplified46.9%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)} \]

    if 4.8999999999999998e-210 < d

    1. Initial program 78.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*78.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-eval78.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/278.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-eval78.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/278.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. sub-neg78.0%

        \[\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. +-commutative78.0%

        \[\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. *-commutative78.0%

        \[\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-in78.0%

        \[\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-def78.0%

        \[\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. Simplified77.1%

      \[\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 47.9%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 50.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative50.0%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/r*50.1%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    7. Simplified50.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    8. Step-by-step derivation
      1. sqrt-div60.5%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
    9. Applied egg-rr60.5%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification54.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.25 \cdot 10^{+118}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;d \leq -1.55 \cdot 10^{-155}:\\ \;\;\;\;\frac{\sqrt{\frac{d \cdot \left(-d\right)}{h}}}{\sqrt{-\ell}}\\ \mathbf{elif}\;d \leq -7 \cdot 10^{-295}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;d \leq 1.7 \cdot 10^{-270}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 4.9 \cdot 10^{-210}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 19: 45.4% accurate, 1.6× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -4.4 \cdot 10^{-295}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;d \leq 8 \cdot 10^{-269}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 3.8 \cdot 10^{-211}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= d -4.4e-295)
   (* d (- (pow (* h l) -0.5)))
   (if (<= d 8e-269)
     (/ d (sqrt (* h l)))
     (if (<= d 3.8e-211)
       (* d (- (sqrt (/ (/ 1.0 h) l))))
       (* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -4.4e-295) {
		tmp = d * -pow((h * l), -0.5);
	} else if (d <= 8e-269) {
		tmp = d / sqrt((h * l));
	} else if (d <= 3.8e-211) {
		tmp = d * -sqrt(((1.0 / h) / l));
	} else {
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d <= (-4.4d-295)) then
        tmp = d * -((h * l) ** (-0.5d0))
    else if (d <= 8d-269) then
        tmp = d / sqrt((h * l))
    else if (d <= 3.8d-211) then
        tmp = d * -sqrt(((1.0d0 / h) / l))
    else
        tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -4.4e-295) {
		tmp = d * -Math.pow((h * l), -0.5);
	} else if (d <= 8e-269) {
		tmp = d / Math.sqrt((h * l));
	} else if (d <= 3.8e-211) {
		tmp = d * -Math.sqrt(((1.0 / h) / l));
	} else {
		tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if d <= -4.4e-295:
		tmp = d * -math.pow((h * l), -0.5)
	elif d <= 8e-269:
		tmp = d / math.sqrt((h * l))
	elif d <= 3.8e-211:
		tmp = d * -math.sqrt(((1.0 / h) / l))
	else:
		tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= -4.4e-295)
		tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5)));
	elseif (d <= 8e-269)
		tmp = Float64(d / sqrt(Float64(h * l)));
	elseif (d <= 3.8e-211)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l))));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (d <= -4.4e-295)
		tmp = d * -((h * l) ^ -0.5);
	elseif (d <= 8e-269)
		tmp = d / sqrt((h * l));
	elseif (d <= 3.8e-211)
		tmp = d * -sqrt(((1.0 / h) / l));
	else
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -4.4e-295], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, 8e-269], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.8e-211], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4.4 \cdot 10^{-295}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\

\mathbf{elif}\;d \leq 8 \cdot 10^{-269}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\

\mathbf{elif}\;d \leq 3.8 \cdot 10^{-211}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -4.4000000000000004e-295

    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. Simplified67.8%

      \[\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 41.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. *-rgt-identity41.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg41.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv49.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\ell}}} \]
      4. associate-*r/49.7%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    6. Applied egg-rr49.7%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    7. Step-by-step derivation
      1. associate-/l*49.7%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/49.6%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified49.6%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    9. Taylor expanded in d around -inf 41.8%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg41.8%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/l/41.8%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      3. unpow1/241.8%

        \[\leadsto -d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
      4. distribute-rgt-neg-in41.8%

        \[\leadsto \color{blue}{d \cdot \left(-{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\right)} \]
      5. exp-to-pow39.8%

        \[\leadsto d \cdot \left(-\color{blue}{e^{\log \left(\frac{\frac{1}{h}}{\ell}\right) \cdot 0.5}}\right) \]
      6. associate-/l/39.8%

        \[\leadsto d \cdot \left(-e^{\log \color{blue}{\left(\frac{1}{\ell \cdot h}\right)} \cdot 0.5}\right) \]
      7. log-rec41.0%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\left(-\log \left(\ell \cdot h\right)\right)} \cdot 0.5}\right) \]
      8. *-commutative41.0%

        \[\leadsto d \cdot \left(-e^{\left(-\log \color{blue}{\left(h \cdot \ell\right)}\right) \cdot 0.5}\right) \]
      9. distribute-lft-neg-out41.0%

        \[\leadsto d \cdot \left(-e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}}\right) \]
      10. distribute-rgt-neg-in41.0%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}}\right) \]
      11. metadata-eval41.0%

        \[\leadsto d \cdot \left(-e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}}\right) \]
      12. exp-prod41.0%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(e^{\log \left(h \cdot \ell\right)}\right)}^{-0.5}}\right) \]
      13. *-commutative41.0%

        \[\leadsto d \cdot \left(-{\left(e^{\log \color{blue}{\left(\ell \cdot h\right)}}\right)}^{-0.5}\right) \]
      14. rem-exp-log43.0%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(\ell \cdot h\right)}}^{-0.5}\right) \]
      15. *-commutative43.0%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(h \cdot \ell\right)}}^{-0.5}\right) \]
    11. Simplified43.0%

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]

    if -4.4000000000000004e-295 < d < 7.9999999999999997e-269

    1. Initial program 43.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. associate-*l*43.4%

        \[\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-eval43.4%

        \[\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/243.4%

        \[\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-eval43.4%

        \[\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/243.4%

        \[\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-neg43.4%

        \[\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. +-commutative43.4%

        \[\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. *-commutative43.4%

        \[\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-in43.4%

        \[\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-def43.4%

        \[\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. Simplified43.4%

      \[\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 16.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 44.6%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative44.6%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/r*44.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    7. Simplified44.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    8. Taylor expanded in l around 0 44.6%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. *-commutative44.6%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      2. associate-/r*44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    10. Simplified44.6%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    11. Step-by-step derivation
      1. div-inv44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h} \cdot \frac{1}{\ell}}} \]
      2. inv-pow44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{{h}^{-1}} \cdot \frac{1}{\ell}} \]
      3. inv-pow44.6%

        \[\leadsto d \cdot \sqrt{{h}^{-1} \cdot \color{blue}{{\ell}^{-1}}} \]
      4. pow-prod-down44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      5. inv-pow44.6%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
      6. associate-/l/44.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      7. add-cbrt-cube37.4%

        \[\leadsto d \cdot \sqrt{\color{blue}{\sqrt[3]{\left(\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}\right) \cdot \frac{\frac{1}{\ell}}{h}}}} \]
      8. add-cbrt-cube44.5%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      9. add-sqr-sqrt44.5%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)} \]
      10. expm1-log1p-u15.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)\right)\right)} \]
      11. expm1-udef2.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)\right)} - 1} \]
    12. Applied egg-rr2.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)} - 1} \]
    13. Step-by-step derivation
      1. expm1-def16.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)\right)} \]
      2. expm1-log1p44.6%

        \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
      3. associate-*r/44.6%

        \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
      4. *-rgt-identity44.6%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    14. Simplified44.6%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]

    if 7.9999999999999997e-269 < d < 3.80000000000000012e-211

    1. Initial program 73.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*73.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-eval73.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/273.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-eval73.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/273.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. sub-neg73.1%

        \[\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. +-commutative73.1%

        \[\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. *-commutative73.1%

        \[\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-in73.1%

        \[\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-def73.1%

        \[\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. Simplified73.1%

      \[\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 1.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. *-rgt-identity1.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg1.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv0.0%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\ell}}} \]
      4. associate-*r/0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    6. Applied egg-rr0.0%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    7. Step-by-step derivation
      1. associate-/l*0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    9. Taylor expanded in d around -inf 46.9%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg46.9%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/l/46.9%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      3. unpow1/246.9%

        \[\leadsto -d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
      4. distribute-rgt-neg-in46.9%

        \[\leadsto \color{blue}{d \cdot \left(-{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\right)} \]
      5. unpow1/246.9%

        \[\leadsto d \cdot \left(-\color{blue}{\sqrt{\frac{\frac{1}{h}}{\ell}}}\right) \]
    11. Simplified46.9%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)} \]

    if 3.80000000000000012e-211 < d

    1. Initial program 78.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*78.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-eval78.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/278.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-eval78.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/278.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. sub-neg78.0%

        \[\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. +-commutative78.0%

        \[\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. *-commutative78.0%

        \[\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-in78.0%

        \[\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-def78.0%

        \[\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. Simplified77.1%

      \[\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 47.9%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 50.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative50.0%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/r*50.1%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    7. Simplified50.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    8. Step-by-step derivation
      1. sqrt-div60.5%

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
    9. Applied egg-rr60.5%

      \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification50.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4.4 \cdot 10^{-295}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{elif}\;d \leq 8 \cdot 10^{-269}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 3.8 \cdot 10^{-211}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]

Alternative 20: 42.2% accurate, 3.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2.1 \cdot 10^{-265}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -2.1e-265) (* d (- (pow (* h l) -0.5))) (/ d (sqrt (* h l)))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -2.1e-265) {
		tmp = d * -pow((h * l), -0.5);
	} else {
		tmp = d / sqrt((h * l));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= (-2.1d-265)) then
        tmp = d * -((h * l) ** (-0.5d0))
    else
        tmp = d / sqrt((h * l))
    end if
    code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -2.1e-265) {
		tmp = d * -Math.pow((h * l), -0.5);
	} else {
		tmp = d / Math.sqrt((h * l));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	tmp = 0
	if l <= -2.1e-265:
		tmp = d * -math.pow((h * l), -0.5)
	else:
		tmp = d / math.sqrt((h * l))
	return tmp
M, D = sort([M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -2.1e-265)
		tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5)));
	else
		tmp = Float64(d / sqrt(Float64(h * l)));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (l <= -2.1e-265)
		tmp = d * -((h * l) ^ -0.5);
	else
		tmp = d / sqrt((h * l));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.1e-265], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{-265}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -2.10000000000000004e-265

    1. Initial program 66.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Step-by-step derivation
      1. associate-*l*66.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-eval66.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/266.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-eval66.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/266.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-neg66.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. +-commutative66.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. *-commutative66.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-in66.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-def66.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.7%

      \[\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 42.9%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. *-rgt-identity42.9%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. frac-2neg42.9%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\color{blue}{\frac{-d}{-\ell}}} \]
      3. sqrt-undiv51.8%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{-d}}{\sqrt{-\ell}}} \]
      4. associate-*r/51.8%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    6. Applied egg-rr51.8%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    7. Step-by-step derivation
      1. associate-/l*51.9%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}} \]
      2. associate-/r/51.8%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    8. Simplified51.8%

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}} \]
    9. Taylor expanded in d around -inf 44.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg44.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/l/44.3%

        \[\leadsto -d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
      3. unpow1/244.3%

        \[\leadsto -d \cdot \color{blue}{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}} \]
      4. distribute-rgt-neg-in44.3%

        \[\leadsto \color{blue}{d \cdot \left(-{\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\right)} \]
      5. exp-to-pow42.2%

        \[\leadsto d \cdot \left(-\color{blue}{e^{\log \left(\frac{\frac{1}{h}}{\ell}\right) \cdot 0.5}}\right) \]
      6. associate-/l/42.2%

        \[\leadsto d \cdot \left(-e^{\log \color{blue}{\left(\frac{1}{\ell \cdot h}\right)} \cdot 0.5}\right) \]
      7. log-rec43.4%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\left(-\log \left(\ell \cdot h\right)\right)} \cdot 0.5}\right) \]
      8. *-commutative43.4%

        \[\leadsto d \cdot \left(-e^{\left(-\log \color{blue}{\left(h \cdot \ell\right)}\right) \cdot 0.5}\right) \]
      9. distribute-lft-neg-out43.4%

        \[\leadsto d \cdot \left(-e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}}\right) \]
      10. distribute-rgt-neg-in43.4%

        \[\leadsto d \cdot \left(-e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}}\right) \]
      11. metadata-eval43.4%

        \[\leadsto d \cdot \left(-e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}}\right) \]
      12. exp-prod43.4%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(e^{\log \left(h \cdot \ell\right)}\right)}^{-0.5}}\right) \]
      13. *-commutative43.4%

        \[\leadsto d \cdot \left(-{\left(e^{\log \color{blue}{\left(\ell \cdot h\right)}}\right)}^{-0.5}\right) \]
      14. rem-exp-log45.6%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(\ell \cdot h\right)}}^{-0.5}\right) \]
      15. *-commutative45.6%

        \[\leadsto d \cdot \left(-{\color{blue}{\left(h \cdot \ell\right)}}^{-0.5}\right) \]
    11. Simplified45.6%

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]

    if -2.10000000000000004e-265 < l

    1. Initial program 74.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*74.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-eval74.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/274.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-eval74.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/274.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. sub-neg74.5%

        \[\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. +-commutative74.5%

        \[\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. *-commutative74.5%

        \[\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-in74.5%

        \[\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-def74.5%

        \[\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. Simplified73.9%

      \[\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 39.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 42.7%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. *-commutative42.7%

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
      2. associate-/r*42.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    7. Simplified42.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
    8. Taylor expanded in l around 0 42.7%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. *-commutative42.7%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      2. associate-/r*42.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    10. Simplified42.7%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
    11. Step-by-step derivation
      1. div-inv42.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h} \cdot \frac{1}{\ell}}} \]
      2. inv-pow42.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{{h}^{-1}} \cdot \frac{1}{\ell}} \]
      3. inv-pow42.7%

        \[\leadsto d \cdot \sqrt{{h}^{-1} \cdot \color{blue}{{\ell}^{-1}}} \]
      4. pow-prod-down42.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      5. inv-pow42.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
      6. associate-/l/42.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      7. add-cbrt-cube29.8%

        \[\leadsto d \cdot \sqrt{\color{blue}{\sqrt[3]{\left(\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}\right) \cdot \frac{\frac{1}{\ell}}{h}}}} \]
      8. add-cbrt-cube42.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      9. add-sqr-sqrt42.6%

        \[\leadsto d \cdot \color{blue}{\left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)} \]
      10. expm1-log1p-u38.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)\right)\right)} \]
      11. expm1-udef30.7%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)\right)} - 1} \]
    12. Applied egg-rr31.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)} - 1} \]
    13. Step-by-step derivation
      1. expm1-def39.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)\right)} \]
      2. expm1-log1p43.3%

        \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
      3. associate-*r/43.4%

        \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
      4. *-rgt-identity43.4%

        \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
    14. Simplified43.4%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.1 \cdot 10^{-265}:\\ \;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \end{array} \]

Alternative 21: 26.3% accurate, 3.2× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \frac{d}{\sqrt{h \cdot \ell}} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D) :precision binary64 (/ d (sqrt (* h l))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
	return d / sqrt((h * l));
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = d / sqrt((h * l))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
	return d / Math.sqrt((h * l));
}
[M, D] = sort([M, D])
def code(d, h, l, M, D):
	return d / math.sqrt((h * l))
M, D = sort([M, D])
function code(d, h, l, M, D)
	return Float64(d / sqrt(Float64(h * l)))
end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
	tmp = d / sqrt((h * l));
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Derivation
  1. Initial program 71.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.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-eval71.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/271.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-eval71.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/271.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. sub-neg71.0%

      \[\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. +-commutative71.0%

      \[\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. *-commutative71.0%

      \[\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-in71.0%

      \[\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-def71.0%

      \[\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. Simplified70.6%

    \[\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 41.0%

    \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
  5. Taylor expanded in d around 0 26.1%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  6. Step-by-step derivation
    1. *-commutative26.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    2. associate-/r*26.1%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
  7. Simplified26.1%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}} \]
  8. Taylor expanded in l around 0 26.1%

    \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}} \]
  9. Step-by-step derivation
    1. *-commutative26.1%

      \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
    2. associate-/r*26.1%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
  10. Simplified26.1%

    \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \]
  11. Step-by-step derivation
    1. div-inv26.1%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h} \cdot \frac{1}{\ell}}} \]
    2. inv-pow26.1%

      \[\leadsto d \cdot \sqrt{\color{blue}{{h}^{-1}} \cdot \frac{1}{\ell}} \]
    3. inv-pow26.1%

      \[\leadsto d \cdot \sqrt{{h}^{-1} \cdot \color{blue}{{\ell}^{-1}}} \]
    4. pow-prod-down26.1%

      \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
    5. inv-pow26.1%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
    6. associate-/l/26.1%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    7. add-cbrt-cube21.3%

      \[\leadsto d \cdot \sqrt{\color{blue}{\sqrt[3]{\left(\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell}}{h}\right) \cdot \frac{\frac{1}{\ell}}{h}}}} \]
    8. add-cbrt-cube26.1%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    9. add-sqr-sqrt26.0%

      \[\leadsto d \cdot \color{blue}{\left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)} \]
    10. expm1-log1p-u22.3%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)\right)\right)} \]
    11. expm1-udef18.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \left(\sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}} \cdot \sqrt{\sqrt{\frac{\frac{1}{\ell}}{h}}}\right)\right)} - 1} \]
  12. Applied egg-rr18.3%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)} - 1} \]
  13. Step-by-step derivation
    1. expm1-def22.6%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right)\right)} \]
    2. expm1-log1p26.4%

      \[\leadsto \color{blue}{d \cdot \frac{1}{\sqrt{h \cdot \ell}}} \]
    3. associate-*r/26.5%

      \[\leadsto \color{blue}{\frac{d \cdot 1}{\sqrt{h \cdot \ell}}} \]
    4. *-rgt-identity26.5%

      \[\leadsto \frac{\color{blue}{d}}{\sqrt{h \cdot \ell}} \]
  14. Simplified26.5%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  15. Final simplification26.5%

    \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]

Reproduce

?
herbie shell --seed 2023174 
(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)))))