Henrywood and Agarwal, Equation (12)

Percentage Accurate: 67.5% → 84.9%
Time: 28.0s
Alternatives: 16
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 16 alternatives:

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

Initial Program: 67.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: 84.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 66.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Applied egg-rr30.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < h < 2.4999999999999999e195

    1. Initial program 75.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. Simplified75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.4999999999999999e195 < h

    1. Initial program 46.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. Simplified46.0%

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

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

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

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

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

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

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

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

Alternative 2: 78.7% accurate, 0.3× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M_m \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\ \mathbf{if}\;t_0 \leq -4 \cdot 10^{-120} \lor \neg \left(t_0 \leq 0\right) \land t_0 \leq 5 \cdot 10^{+263}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(\frac{M_m \cdot \left(\frac{0.5}{d} \cdot D\right)}{\ell} \cdot \frac{0.5 \cdot \left(M_m \cdot \frac{D}{d}\right)}{-2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (let* ((t_0
         (*
          (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
          (- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M_m D) (* d 2.0)) 2.0)))))))
   (if (or (<= t_0 -4e-120) (and (not (<= t_0 0.0)) (<= t_0 5e+263)))
     (*
      (sqrt (/ d h))
      (*
       (sqrt (/ d l))
       (+
        1.0
        (*
         h
         (* (/ (* M_m (* (/ 0.5 d) D)) l) (/ (* 0.5 (* M_m (/ D d))) -2.0))))))
     (fabs (/ d (sqrt (* l h)))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double t_0 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M_m * D) / (d * 2.0)), 2.0))));
	double tmp;
	if ((t_0 <= -4e-120) || (!(t_0 <= 0.0) && (t_0 <= 5e+263))) {
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * (((M_m * ((0.5 / d) * D)) / l) * ((0.5 * (M_m * (D / d))) / -2.0)))));
	} else {
		tmp = fabs((d / sqrt((l * h))));
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((m_m * d_1) / (d * 2.0d0)) ** 2.0d0))))
    if ((t_0 <= (-4d-120)) .or. (.not. (t_0 <= 0.0d0)) .and. (t_0 <= 5d+263)) then
        tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (h * (((m_m * ((0.5d0 / d) * d_1)) / l) * ((0.5d0 * (m_m * (d_1 / d))) / (-2.0d0))))))
    else
        tmp = abs((d / sqrt((l * h))))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double t_0 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M_m * D) / (d * 2.0)), 2.0))));
	double tmp;
	if ((t_0 <= -4e-120) || (!(t_0 <= 0.0) && (t_0 <= 5e+263))) {
		tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (h * (((M_m * ((0.5 / d) * D)) / l) * ((0.5 * (M_m * (D / d))) / -2.0)))));
	} else {
		tmp = Math.abs((d / Math.sqrt((l * h))));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	t_0 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M_m * D) / (d * 2.0)), 2.0))))
	tmp = 0
	if (t_0 <= -4e-120) or (not (t_0 <= 0.0) and (t_0 <= 5e+263)):
		tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (h * (((M_m * ((0.5 / d) * D)) / l) * ((0.5 * (M_m * (D / d))) / -2.0)))))
	else:
		tmp = math.fabs((d / math.sqrt((l * h))))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	t_0 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M_m * D) / Float64(d * 2.0)) ^ 2.0)))))
	tmp = 0.0
	if ((t_0 <= -4e-120) || (!(t_0 <= 0.0) && (t_0 <= 5e+263)))
		tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(Float64(Float64(M_m * Float64(Float64(0.5 / d) * D)) / l) * Float64(Float64(0.5 * Float64(M_m * Float64(D / d))) / -2.0))))));
	else
		tmp = abs(Float64(d / sqrt(Float64(l * h))));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	t_0 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M_m * D) / (d * 2.0)) ^ 2.0))));
	tmp = 0.0;
	if ((t_0 <= -4e-120) || (~((t_0 <= 0.0)) && (t_0 <= 5e+263)))
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * (((M_m * ((0.5 / d) * D)) / l) * ((0.5 * (M_m * (D / d))) / -2.0)))));
	else
		tmp = abs((d / sqrt((l * h))));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -4e-120], And[N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision], LessEqual[t$95$0, 5e+263]]], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[(N[(M$95$m * N[(N[(0.5 / d), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(0.5 * N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M_m \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{if}\;t_0 \leq -4 \cdot 10^{-120} \lor \neg \left(t_0 \leq 0\right) \land t_0 \leq 5 \cdot 10^{+263}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(\frac{M_m \cdot \left(\frac{0.5}{d} \cdot D\right)}{\ell} \cdot \frac{0.5 \cdot \left(M_m \cdot \frac{D}{d}\right)}{-2}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -3.99999999999999991e-120 or 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 5.00000000000000022e263

    1. Initial program 93.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. Simplified91.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.99999999999999991e-120 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 0.0 or 5.00000000000000022e263 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l))))

    1. Initial program 23.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. Simplified23.4%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{\ell}}{h}}} \]
      4. add-sqr-sqrt27.6%

        \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}} \cdot \sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}}} \]
      5. rem-sqrt-square27.6%

        \[\leadsto \color{blue}{\left|\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right|} \]
      6. associate-/l/30.7%

        \[\leadsto \left|\sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}}\right| \]
      7. sqrt-div36.5%

        \[\leadsto \left|\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}}\right| \]
      8. unpow236.5%

        \[\leadsto \left|\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{h \cdot \ell}}\right| \]
      9. sqrt-prod24.5%

        \[\leadsto \left|\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right| \]
      10. add-sqr-sqrt56.7%

        \[\leadsto \left|\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right| \]
      11. *-commutative56.7%

        \[\leadsto \left|\frac{d}{\sqrt{\color{blue}{\ell \cdot h}}}\right| \]
    8. Applied egg-rr56.7%

      \[\leadsto \color{blue}{\left|\frac{d}{\sqrt{\ell \cdot h}}\right|} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq -4 \cdot 10^{-120} \lor \neg \left(\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq 0\right) \land \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq 5 \cdot 10^{+263}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(\frac{M \cdot \left(\frac{0.5}{d} \cdot D\right)}{\ell} \cdot \frac{0.5 \cdot \left(M \cdot \frac{D}{d}\right)}{-2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 86.9% accurate, 0.6× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -9.999999999999969e-311

    1. Initial program 66.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Applied egg-rr30.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < l

    1. Initial program 69.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified69.2%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 80.2% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 66.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Applied egg-rr30.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < h < 6.4999999999999997e193

    1. Initial program 75.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. Simplified75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.4999999999999997e193 < h

    1. Initial program 46.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. Simplified46.0%

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

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

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

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

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

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

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

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

Alternative 5: 79.0% accurate, 1.0× speedup?

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

\mathbf{elif}\;h \leq 1.7 \cdot 10^{+188}:\\
\;\;\;\;t_2 \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 + h \cdot \left(t_1 \cdot \frac{\frac{0.5}{\frac{d}{M_m \cdot D}}}{-2}\right)\right)\right)\\

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


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

    1. Initial program 66.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Applied egg-rr30.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < h < 1.69999999999999998e188

    1. Initial program 75.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. Simplified75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.69999999999999998e188 < h

    1. Initial program 46.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. Simplified46.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 80.9% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 66.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Applied egg-rr30.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < h < 1.35e188

    1. Initial program 75.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. Simplified75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.35e188 < h

    1. Initial program 46.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. Simplified46.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 80.9% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_2 \cdot \left(1 + h \cdot \left(t_1 \cdot \frac{0.5 \cdot \left(M_m \cdot \frac{D}{d}\right)}{-2}\right)\right)\right)\\


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

    1. Initial program 66.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Applied egg-rr30.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < h < 1.29999999999999994e188

    1. Initial program 75.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. Simplified75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.29999999999999994e188 < h

    1. Initial program 46.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. Simplified46.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 53.2% accurate, 1.4× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;M_m \leq 1.25 \cdot 10^{-226} \lor \neg \left(M_m \leq 2.7 \cdot 10^{-169}\right) \land M_m \leq 4.4 \cdot 10^{-124}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h \cdot M_m}{\frac{\ell \cdot d}{0.5 \cdot D}} \cdot \left(-0.25 \cdot \frac{D}{\frac{d}{M_m}}\right)\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (or (<= M_m 1.25e-226) (and (not (<= M_m 2.7e-169)) (<= M_m 4.4e-124)))
   (fabs (/ d (sqrt (* l h))))
   (*
    (sqrt (/ d h))
    (*
     (sqrt (/ d l))
     (+
      1.0
      (* (/ (* h M_m) (/ (* l d) (* 0.5 D))) (* -0.25 (/ D (/ d M_m)))))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if ((M_m <= 1.25e-226) || (!(M_m <= 2.7e-169) && (M_m <= 4.4e-124))) {
		tmp = fabs((d / sqrt((l * h))));
	} else {
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (((h * M_m) / ((l * d) / (0.5 * D))) * (-0.25 * (D / (d / M_m))))));
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if ((m_m <= 1.25d-226) .or. (.not. (m_m <= 2.7d-169)) .and. (m_m <= 4.4d-124)) then
        tmp = abs((d / sqrt((l * h))))
    else
        tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (((h * m_m) / ((l * d) / (0.5d0 * d_1))) * ((-0.25d0) * (d_1 / (d / m_m))))))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if ((M_m <= 1.25e-226) || (!(M_m <= 2.7e-169) && (M_m <= 4.4e-124))) {
		tmp = Math.abs((d / Math.sqrt((l * h))));
	} else {
		tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (((h * M_m) / ((l * d) / (0.5 * D))) * (-0.25 * (D / (d / M_m))))));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if (M_m <= 1.25e-226) or (not (M_m <= 2.7e-169) and (M_m <= 4.4e-124)):
		tmp = math.fabs((d / math.sqrt((l * h))))
	else:
		tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (((h * M_m) / ((l * d) / (0.5 * D))) * (-0.25 * (D / (d / M_m))))))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if ((M_m <= 1.25e-226) || (!(M_m <= 2.7e-169) && (M_m <= 4.4e-124)))
		tmp = abs(Float64(d / sqrt(Float64(l * h))));
	else
		tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(Float64(h * M_m) / Float64(Float64(l * d) / Float64(0.5 * D))) * Float64(-0.25 * Float64(D / Float64(d / M_m)))))));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if ((M_m <= 1.25e-226) || (~((M_m <= 2.7e-169)) && (M_m <= 4.4e-124)))
		tmp = abs((d / sqrt((l * h))));
	else
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (((h * M_m) / ((l * d) / (0.5 * D))) * (-0.25 * (D / (d / M_m))))));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[Or[LessEqual[M$95$m, 1.25e-226], And[N[Not[LessEqual[M$95$m, 2.7e-169]], $MachinePrecision], LessEqual[M$95$m, 4.4e-124]]], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[(h * M$95$m), $MachinePrecision] / N[(N[(l * d), $MachinePrecision] / N[(0.5 * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.25 * N[(D / N[(d / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M_m \leq 1.25 \cdot 10^{-226} \lor \neg \left(M_m \leq 2.7 \cdot 10^{-169}\right) \land M_m \leq 4.4 \cdot 10^{-124}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h \cdot M_m}{\frac{\ell \cdot d}{0.5 \cdot D}} \cdot \left(-0.25 \cdot \frac{D}{\frac{d}{M_m}}\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 1.2499999999999999e-226 or 2.7000000000000002e-169 < M < 4.3999999999999998e-124

    1. Initial program 69.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified69.7%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{\ell}}{h}}} \]
      4. add-sqr-sqrt20.0%

        \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}} \cdot \sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}}} \]
      5. rem-sqrt-square20.0%

        \[\leadsto \color{blue}{\left|\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right|} \]
      6. associate-/l/19.2%

        \[\leadsto \left|\sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}}\right| \]
      7. sqrt-div24.0%

        \[\leadsto \left|\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}}\right| \]
      8. unpow224.0%

        \[\leadsto \left|\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{h \cdot \ell}}\right| \]
      9. sqrt-prod20.3%

        \[\leadsto \left|\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right| \]
      10. add-sqr-sqrt40.4%

        \[\leadsto \left|\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right| \]
      11. *-commutative40.4%

        \[\leadsto \left|\frac{d}{\sqrt{\color{blue}{\ell \cdot h}}}\right| \]
    8. Applied egg-rr40.4%

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

    if 1.2499999999999999e-226 < M < 2.7000000000000002e-169 or 4.3999999999999998e-124 < M

    1. Initial program 65.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 1.25 \cdot 10^{-226} \lor \neg \left(M \leq 2.7 \cdot 10^{-169}\right) \land M \leq 4.4 \cdot 10^{-124}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h \cdot M}{\frac{\ell \cdot d}{0.5 \cdot D}} \cdot \left(-0.25 \cdot \frac{D}{\frac{d}{M}}\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 46.4% accurate, 1.5× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -7.2 \cdot 10^{+126}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{elif}\;d \leq -1.25 \cdot 10^{-87}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq 1.6 \cdot 10^{-244}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= d -7.2e+126)
   (fabs (/ d (sqrt (* l h))))
   (if (<= d -1.25e-87)
     (* (sqrt (/ d h)) (sqrt (/ d l)))
     (if (<= d 1.6e-244)
       (* d (- (sqrt (/ 1.0 (* l h)))))
       (/ (/ d (sqrt l)) (sqrt h))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (d <= -7.2e+126) {
		tmp = fabs((d / sqrt((l * h))));
	} else if (d <= -1.25e-87) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else if (d <= 1.6e-244) {
		tmp = d * -sqrt((1.0 / (l * h)));
	} else {
		tmp = (d / sqrt(l)) / sqrt(h);
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d <= (-7.2d+126)) then
        tmp = abs((d / sqrt((l * h))))
    else if (d <= (-1.25d-87)) then
        tmp = sqrt((d / h)) * sqrt((d / l))
    else if (d <= 1.6d-244) then
        tmp = d * -sqrt((1.0d0 / (l * h)))
    else
        tmp = (d / sqrt(l)) / sqrt(h)
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (d <= -7.2e+126) {
		tmp = Math.abs((d / Math.sqrt((l * h))));
	} else if (d <= -1.25e-87) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else if (d <= 1.6e-244) {
		tmp = d * -Math.sqrt((1.0 / (l * h)));
	} else {
		tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if d <= -7.2e+126:
		tmp = math.fabs((d / math.sqrt((l * h))))
	elif d <= -1.25e-87:
		tmp = math.sqrt((d / h)) * math.sqrt((d / l))
	elif d <= 1.6e-244:
		tmp = d * -math.sqrt((1.0 / (l * h)))
	else:
		tmp = (d / math.sqrt(l)) / math.sqrt(h)
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (d <= -7.2e+126)
		tmp = abs(Float64(d / sqrt(Float64(l * h))));
	elseif (d <= -1.25e-87)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	elseif (d <= 1.6e-244)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h)))));
	else
		tmp = Float64(Float64(d / sqrt(l)) / sqrt(h));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (d <= -7.2e+126)
		tmp = abs((d / sqrt((l * h))));
	elseif (d <= -1.25e-87)
		tmp = sqrt((d / h)) * sqrt((d / l));
	elseif (d <= 1.6e-244)
		tmp = d * -sqrt((1.0 / (l * h)));
	else
		tmp = (d / sqrt(l)) / sqrt(h);
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -7.2e+126], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -1.25e-87], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.6e-244], N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -7.2 \cdot 10^{+126}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\

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

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

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


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

    1. Initial program 61.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. Simplified63.3%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{\ell}}{h}}} \]
      4. add-sqr-sqrt25.5%

        \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}} \cdot \sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}}} \]
      5. rem-sqrt-square25.5%

        \[\leadsto \color{blue}{\left|\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right|} \]
      6. associate-/l/25.3%

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

        \[\leadsto \left|\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}}\right| \]
      8. unpow225.3%

        \[\leadsto \left|\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{h \cdot \ell}}\right| \]
      9. sqrt-prod0.0%

        \[\leadsto \left|\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right| \]
      10. add-sqr-sqrt68.5%

        \[\leadsto \left|\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right| \]
      11. *-commutative68.5%

        \[\leadsto \left|\frac{d}{\sqrt{\color{blue}{\ell \cdot h}}}\right| \]
    8. Applied egg-rr68.5%

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

    if -7.2000000000000001e126 < d < -1.25000000000000011e-87

    1. Initial program 83.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. Simplified83.6%

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

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

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

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

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

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

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

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

    if -1.25000000000000011e-87 < d < 1.5999999999999999e-244

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

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

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

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

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

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

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

    if 1.5999999999999999e-244 < d

    1. Initial program 72.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. Simplified72.2%

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. expm1-log1p-u42.4%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)\right)} - 1 \]
      4. *-rgt-identity37.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -7.2 \cdot 10^{+126}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{elif}\;d \leq -1.25 \cdot 10^{-87}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq 1.6 \cdot 10^{-244}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 46.5% accurate, 1.5× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -2.2 \cdot 10^{+116}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{elif}\;d \leq -5.8 \cdot 10^{-87}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;d \leq 7.1 \cdot 10^{-245}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= d -2.2e+116)
   (fabs (/ d (sqrt (* l h))))
   (if (<= d -5.8e-87)
     (* (sqrt (/ d l)) (/ 1.0 (sqrt (/ h d))))
     (if (<= d 7.1e-245)
       (* d (- (sqrt (/ 1.0 (* l h)))))
       (/ (/ d (sqrt l)) (sqrt h))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (d <= -2.2e+116) {
		tmp = fabs((d / sqrt((l * h))));
	} else if (d <= -5.8e-87) {
		tmp = sqrt((d / l)) * (1.0 / sqrt((h / d)));
	} else if (d <= 7.1e-245) {
		tmp = d * -sqrt((1.0 / (l * h)));
	} else {
		tmp = (d / sqrt(l)) / sqrt(h);
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d <= (-2.2d+116)) then
        tmp = abs((d / sqrt((l * h))))
    else if (d <= (-5.8d-87)) then
        tmp = sqrt((d / l)) * (1.0d0 / sqrt((h / d)))
    else if (d <= 7.1d-245) then
        tmp = d * -sqrt((1.0d0 / (l * h)))
    else
        tmp = (d / sqrt(l)) / sqrt(h)
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (d <= -2.2e+116) {
		tmp = Math.abs((d / Math.sqrt((l * h))));
	} else if (d <= -5.8e-87) {
		tmp = Math.sqrt((d / l)) * (1.0 / Math.sqrt((h / d)));
	} else if (d <= 7.1e-245) {
		tmp = d * -Math.sqrt((1.0 / (l * h)));
	} else {
		tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if d <= -2.2e+116:
		tmp = math.fabs((d / math.sqrt((l * h))))
	elif d <= -5.8e-87:
		tmp = math.sqrt((d / l)) * (1.0 / math.sqrt((h / d)))
	elif d <= 7.1e-245:
		tmp = d * -math.sqrt((1.0 / (l * h)))
	else:
		tmp = (d / math.sqrt(l)) / math.sqrt(h)
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (d <= -2.2e+116)
		tmp = abs(Float64(d / sqrt(Float64(l * h))));
	elseif (d <= -5.8e-87)
		tmp = Float64(sqrt(Float64(d / l)) * Float64(1.0 / sqrt(Float64(h / d))));
	elseif (d <= 7.1e-245)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h)))));
	else
		tmp = Float64(Float64(d / sqrt(l)) / sqrt(h));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (d <= -2.2e+116)
		tmp = abs((d / sqrt((l * h))));
	elseif (d <= -5.8e-87)
		tmp = sqrt((d / l)) * (1.0 / sqrt((h / d)));
	elseif (d <= 7.1e-245)
		tmp = d * -sqrt((1.0 / (l * h)));
	else
		tmp = (d / sqrt(l)) / sqrt(h);
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -2.2e+116], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -5.8e-87], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.1e-245], N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.2 \cdot 10^{+116}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\

\mathbf{elif}\;d \leq -5.8 \cdot 10^{-87}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\

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

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


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

    1. Initial program 64.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. Simplified66.5%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{\ell}}{h}}} \]
      4. add-sqr-sqrt29.9%

        \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}} \cdot \sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}}} \]
      5. rem-sqrt-square29.9%

        \[\leadsto \color{blue}{\left|\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right|} \]
      6. associate-/l/29.8%

        \[\leadsto \left|\sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}}\right| \]
      7. sqrt-div29.8%

        \[\leadsto \left|\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}}\right| \]
      8. unpow229.8%

        \[\leadsto \left|\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{h \cdot \ell}}\right| \]
      9. sqrt-prod0.0%

        \[\leadsto \left|\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right| \]
      10. add-sqr-sqrt69.1%

        \[\leadsto \left|\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right| \]
      11. *-commutative69.1%

        \[\leadsto \left|\frac{d}{\sqrt{\color{blue}{\ell \cdot h}}}\right| \]
    8. Applied egg-rr69.1%

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

    if -2.2e116 < d < -5.7999999999999998e-87

    1. Initial program 82.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. Simplified82.1%

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

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

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

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

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

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

    if -5.7999999999999998e-87 < d < 7.10000000000000016e-245

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

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

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

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

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

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

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

    if 7.10000000000000016e-245 < d

    1. Initial program 72.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. Simplified72.2%

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. expm1-log1p-u42.4%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)\right)} - 1 \]
      4. *-rgt-identity37.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.2 \cdot 10^{+116}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{elif}\;d \leq -5.8 \cdot 10^{-87}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;d \leq 7.1 \cdot 10^{-245}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 46.5% accurate, 1.5× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -4.5 \cdot 10^{-239}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{elif}\;\ell \leq 4.2 \cdot 10^{-307}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l -4.5e-239)
   (fabs (/ d (sqrt (* l h))))
   (if (<= l 4.2e-307)
     (/ d (cbrt (pow (* l h) 1.5)))
     (/ (/ d (sqrt l)) (sqrt h)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= -4.5e-239) {
		tmp = fabs((d / sqrt((l * h))));
	} else if (l <= 4.2e-307) {
		tmp = d / cbrt(pow((l * h), 1.5));
	} else {
		tmp = (d / sqrt(l)) / sqrt(h);
	}
	return tmp;
}
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= -4.5e-239) {
		tmp = Math.abs((d / Math.sqrt((l * h))));
	} else if (l <= 4.2e-307) {
		tmp = d / Math.cbrt(Math.pow((l * h), 1.5));
	} else {
		tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= -4.5e-239)
		tmp = abs(Float64(d / sqrt(Float64(l * h))));
	elseif (l <= 4.2e-307)
		tmp = Float64(d / cbrt((Float64(l * h) ^ 1.5)));
	else
		tmp = Float64(Float64(d / sqrt(l)) / sqrt(h));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -4.5e-239], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 4.2e-307], N[(d / N[Power[N[Power[N[(l * h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{-239}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\

\mathbf{elif}\;\ell \leq 4.2 \cdot 10^{-307}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\

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


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

    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. Simplified64.1%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{\ell}}{h}}} \]
      4. add-sqr-sqrt22.9%

        \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}} \cdot \sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}}} \]
      5. rem-sqrt-square22.9%

        \[\leadsto \color{blue}{\left|\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right|} \]
      6. associate-/l/22.7%

        \[\leadsto \left|\sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}}\right| \]
      7. sqrt-div25.6%

        \[\leadsto \left|\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}}\right| \]
      8. unpow225.6%

        \[\leadsto \left|\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{h \cdot \ell}}\right| \]
      9. sqrt-prod0.0%

        \[\leadsto \left|\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right| \]
      10. add-sqr-sqrt42.3%

        \[\leadsto \left|\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right| \]
      11. *-commutative42.3%

        \[\leadsto \left|\frac{d}{\sqrt{\color{blue}{\ell \cdot h}}}\right| \]
    8. Applied egg-rr42.3%

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

    if -4.50000000000000013e-239 < l < 4.2000000000000002e-307

    1. Initial program 86.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. Simplified86.1%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{\ell}}{h}}} \]
      4. expm1-log1p-u8.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right)\right)} \]
      5. expm1-udef8.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right)} - 1} \]
      6. associate-/l/8.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    11. Step-by-step derivation
      1. add-cbrt-cube44.0%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{\left(\sqrt{\ell \cdot h} \cdot \sqrt{\ell \cdot h}\right) \cdot \sqrt{\ell \cdot h}}}} \]
      2. pow1/344.0%

        \[\leadsto \frac{d}{\color{blue}{{\left(\left(\sqrt{\ell \cdot h} \cdot \sqrt{\ell \cdot h}\right) \cdot \sqrt{\ell \cdot h}\right)}^{0.3333333333333333}}} \]
      3. add-sqr-sqrt44.0%

        \[\leadsto \frac{d}{{\left(\color{blue}{\left(\ell \cdot h\right)} \cdot \sqrt{\ell \cdot h}\right)}^{0.3333333333333333}} \]
      4. pow144.0%

        \[\leadsto \frac{d}{{\left(\color{blue}{{\left(\ell \cdot h\right)}^{1}} \cdot \sqrt{\ell \cdot h}\right)}^{0.3333333333333333}} \]
      5. pow1/244.0%

        \[\leadsto \frac{d}{{\left({\left(\ell \cdot h\right)}^{1} \cdot \color{blue}{{\left(\ell \cdot h\right)}^{0.5}}\right)}^{0.3333333333333333}} \]
      6. pow-prod-up44.0%

        \[\leadsto \frac{d}{{\color{blue}{\left({\left(\ell \cdot h\right)}^{\left(1 + 0.5\right)}\right)}}^{0.3333333333333333}} \]
      7. *-commutative44.0%

        \[\leadsto \frac{d}{{\left({\color{blue}{\left(h \cdot \ell\right)}}^{\left(1 + 0.5\right)}\right)}^{0.3333333333333333}} \]
      8. metadata-eval44.0%

        \[\leadsto \frac{d}{{\left({\left(h \cdot \ell\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333}} \]
    12. Applied egg-rr44.0%

      \[\leadsto \frac{d}{\color{blue}{{\left({\left(h \cdot \ell\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
    13. Step-by-step derivation
      1. unpow1/344.0%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}} \]
    14. Simplified44.0%

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

    if 4.2000000000000002e-307 < l

    1. Initial program 69.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. Simplified69.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -4.5 \cdot 10^{-239}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{elif}\;\ell \leq 4.2 \cdot 10^{-307}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 46.1% accurate, 1.5× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\ell \cdot h}\\ \mathbf{if}\;\ell \leq -1.05 \cdot 10^{-243}:\\ \;\;\;\;\left|\frac{d}{t_0}\right|\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\mathsf{reciprocal}\left(\left(\frac{t_0}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (let* ((t_0 (sqrt (* l h))))
   (if (<= l -1.05e-243)
     (fabs (/ d t_0))
     (if (<= l -1e-310) (reciprocal (/ t_0 d)) (/ (/ d (sqrt l)) (sqrt h))))))
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;\ell \leq -1.05 \cdot 10^{-243}:\\
\;\;\;\;\left|\frac{d}{t_0}\right|\\

\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{reciprocal}\left(\left(\frac{t_0}{d}\right)\right)\\

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


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

    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. Simplified64.1%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{\ell}}{h}}} \]
      4. add-sqr-sqrt22.9%

        \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}} \cdot \sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}}} \]
      5. rem-sqrt-square22.9%

        \[\leadsto \color{blue}{\left|\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right|} \]
      6. associate-/l/22.7%

        \[\leadsto \left|\sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}}\right| \]
      7. sqrt-div25.6%

        \[\leadsto \left|\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}}\right| \]
      8. unpow225.6%

        \[\leadsto \left|\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{h \cdot \ell}}\right| \]
      9. sqrt-prod0.0%

        \[\leadsto \left|\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right| \]
      10. add-sqr-sqrt42.3%

        \[\leadsto \left|\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right| \]
      11. *-commutative42.3%

        \[\leadsto \left|\frac{d}{\sqrt{\color{blue}{\ell \cdot h}}}\right| \]
    8. Applied egg-rr42.3%

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

    if -1.05e-243 < l < -9.999999999999969e-311

    1. Initial program 92.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. Simplified92.2%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{\ell}}{h}}} \]
      4. expm1-log1p-u8.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right)\right)} \]
      5. expm1-udef9.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right)} - 1} \]
      6. associate-/l/8.8%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    10. Simplified40.0%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    11. Step-by-step derivation
      1. clear-num40.0%

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

        \[\leadsto \color{blue}{\mathsf{reciprocal}\left(\left(\frac{\sqrt{\ell \cdot h}}{d}\right)\right)} \]
      3. *-commutative40.0%

        \[\leadsto \mathsf{reciprocal}\left(\left(\frac{\sqrt{\color{blue}{h \cdot \ell}}}{d}\right)\right) \]
    12. Applied egg-rr40.0%

      \[\leadsto \color{blue}{\mathsf{reciprocal}\left(\left(\frac{\sqrt{h \cdot \ell}}{d}\right)\right)} \]

    if -9.999999999999969e-311 < l

    1. Initial program 69.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified69.2%

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. expm1-log1p-u38.6%

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right)\right)} - 1 \]
      4. *-rgt-identity33.3%

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\right)} - 1} \]
    7. Step-by-step derivation
      1. expm1-def47.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\right)\right)} \]
      2. expm1-log1p49.8%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      3. associate-/l/48.3%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}} \]
    8. Simplified48.3%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification44.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.05 \cdot 10^{-243}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\mathsf{reciprocal}\left(\left(\frac{\sqrt{\ell \cdot h}}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 43.2% accurate, 1.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{if}\;M_m \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\left|t_0\right|\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (let* ((t_0 (/ d (sqrt (* l h))))) (if (<= M_m 2e-7) (fabs t_0) t_0)))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double t_0 = d / sqrt((l * h));
	double tmp;
	if (M_m <= 2e-7) {
		tmp = fabs(t_0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = d / sqrt((l * h))
    if (m_m <= 2d-7) then
        tmp = abs(t_0)
    else
        tmp = t_0
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double t_0 = d / Math.sqrt((l * h));
	double tmp;
	if (M_m <= 2e-7) {
		tmp = Math.abs(t_0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	t_0 = d / math.sqrt((l * h))
	tmp = 0
	if M_m <= 2e-7:
		tmp = math.fabs(t_0)
	else:
		tmp = t_0
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	t_0 = Float64(d / sqrt(Float64(l * h)))
	tmp = 0.0
	if (M_m <= 2e-7)
		tmp = abs(t_0);
	else
		tmp = t_0;
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	t_0 = d / sqrt((l * h));
	tmp = 0.0;
	if (M_m <= 2e-7)
		tmp = abs(t_0);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M$95$m, 2e-7], N[Abs[t$95$0], $MachinePrecision], t$95$0]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;M_m \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\left|t_0\right|\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 1.9999999999999999e-7

    1. Initial program 70.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified70.7%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(\frac{D}{\frac{2}{M} \cdot d}\right)}^{2} \cdot -0.5, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in h around 0 40.6%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. *-rgt-identity40.6%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. sqrt-unprod29.4%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr29.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    7. Step-by-step derivation
      1. frac-times22.2%

        \[\leadsto \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}} \]
      2. unpow222.2%

        \[\leadsto \sqrt{\frac{\color{blue}{{d}^{2}}}{h \cdot \ell}} \]
      3. associate-/l/22.4%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{\ell}}{h}}} \]
      4. add-sqr-sqrt22.4%

        \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}} \cdot \sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}}} \]
      5. rem-sqrt-square22.4%

        \[\leadsto \color{blue}{\left|\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right|} \]
      6. associate-/l/22.2%

        \[\leadsto \left|\sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}}\right| \]
      7. sqrt-div27.0%

        \[\leadsto \left|\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}}\right| \]
      8. unpow227.0%

        \[\leadsto \left|\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{h \cdot \ell}}\right| \]
      9. sqrt-prod21.2%

        \[\leadsto \left|\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right| \]
      10. add-sqr-sqrt44.2%

        \[\leadsto \left|\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right| \]
      11. *-commutative44.2%

        \[\leadsto \left|\frac{d}{\sqrt{\color{blue}{\ell \cdot h}}}\right| \]
    8. Applied egg-rr44.2%

      \[\leadsto \color{blue}{\left|\frac{d}{\sqrt{\ell \cdot h}}\right|} \]

    if 1.9999999999999999e-7 < M

    1. Initial program 59.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. Simplified59.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(\frac{D}{\frac{2}{M} \cdot d}\right)}^{2} \cdot -0.5, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in h around 0 23.1%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. *-rgt-identity23.1%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. sqrt-unprod23.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr23.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    7. Step-by-step derivation
      1. frac-times21.7%

        \[\leadsto \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}} \]
      2. unpow221.7%

        \[\leadsto \sqrt{\frac{\color{blue}{{d}^{2}}}{h \cdot \ell}} \]
      3. associate-/l/23.2%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{\ell}}{h}}} \]
      4. expm1-log1p-u22.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right)\right)} \]
      5. expm1-udef18.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right)} - 1} \]
      6. associate-/l/18.2%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}}\right)} - 1 \]
      7. unpow218.2%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}}\right)} - 1 \]
      8. frac-times18.2%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}}\right)} - 1 \]
      9. frac-times18.2%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}}\right)} - 1 \]
      10. unpow218.2%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{\color{blue}{{d}^{2}}}{h \cdot \ell}}\right)} - 1 \]
      11. sqrt-div18.2%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}}\right)} - 1 \]
      12. unpow218.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
      13. sqrt-prod10.9%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
      14. add-sqr-sqrt13.1%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
      15. *-commutative13.1%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\color{blue}{\ell \cdot h}}}\right)} - 1 \]
    8. Applied egg-rr13.1%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def13.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
      2. expm1-log1p18.3%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    10. Simplified18.3%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification37.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 42.9% accurate, 2.9× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1.02 \cdot 10^{-243}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l -1.02e-243) (* d (- (sqrt (/ 1.0 (* l h))))) (/ d (sqrt (* l h)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= -1.02e-243) {
		tmp = d * -sqrt((1.0 / (l * h)));
	} else {
		tmp = d / sqrt((l * h));
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= (-1.02d-243)) then
        tmp = d * -sqrt((1.0d0 / (l * h)))
    else
        tmp = d / sqrt((l * h))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= -1.02e-243) {
		tmp = d * -Math.sqrt((1.0 / (l * h)));
	} else {
		tmp = d / Math.sqrt((l * h));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if l <= -1.02e-243:
		tmp = d * -math.sqrt((1.0 / (l * h)))
	else:
		tmp = d / math.sqrt((l * h))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= -1.02e-243)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h)))));
	else
		tmp = Float64(d / sqrt(Float64(l * h)));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (l <= -1.02e-243)
		tmp = d * -sqrt((1.0 / (l * h)));
	else
		tmp = d / sqrt((l * h));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1.02e-243], N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.02 \cdot 10^{-243}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -1.01999999999999996e-243

    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. Simplified64.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(\frac{D}{\frac{2}{M} \cdot d}\right)}^{2} \cdot -0.5, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in h around 0 33.7%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. *-rgt-identity33.7%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. sqrt-unprod25.8%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr25.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    7. Taylor expanded in d around -inf 41.6%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]

    if -1.01999999999999996e-243 < l

    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. Simplified71.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(\frac{D}{\frac{2}{M} \cdot d}\right)}^{2} \cdot -0.5, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in h around 0 38.5%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. *-rgt-identity38.5%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. sqrt-unprod29.8%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr29.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    7. Step-by-step derivation
      1. frac-times21.4%

        \[\leadsto \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}} \]
      2. unpow221.4%

        \[\leadsto \sqrt{\frac{\color{blue}{{d}^{2}}}{h \cdot \ell}} \]
      3. associate-/l/22.4%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{\ell}}{h}}} \]
      4. expm1-log1p-u21.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right)\right)} \]
      5. expm1-udef19.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right)} - 1} \]
      6. associate-/l/18.1%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}}\right)} - 1 \]
      7. unpow218.1%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}}\right)} - 1 \]
      8. frac-times23.0%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}}\right)} - 1 \]
      9. frac-times18.1%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}}\right)} - 1 \]
      10. unpow218.1%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{\color{blue}{{d}^{2}}}{h \cdot \ell}}\right)} - 1 \]
      11. sqrt-div20.7%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}}\right)} - 1 \]
      12. unpow220.7%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
      13. sqrt-prod29.7%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
      14. add-sqr-sqrt29.8%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
      15. *-commutative29.8%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\color{blue}{\ell \cdot h}}}\right)} - 1 \]
    8. Applied egg-rr29.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def35.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
      2. expm1-log1p41.4%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    10. Simplified41.4%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification41.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.02 \cdot 10^{-243}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 36.4% accurate, 3.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -1.7 \cdot 10^{-68}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= d -1.7e-68) (sqrt (* (/ d h) (/ d l))) (/ d (sqrt (* l h)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (d <= -1.7e-68) {
		tmp = sqrt(((d / h) * (d / l)));
	} else {
		tmp = d / sqrt((l * h));
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d <= (-1.7d-68)) then
        tmp = sqrt(((d / h) * (d / l)))
    else
        tmp = d / sqrt((l * h))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (d <= -1.7e-68) {
		tmp = Math.sqrt(((d / h) * (d / l)));
	} else {
		tmp = d / Math.sqrt((l * h));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if d <= -1.7e-68:
		tmp = math.sqrt(((d / h) * (d / l)))
	else:
		tmp = d / math.sqrt((l * h))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (d <= -1.7e-68)
		tmp = sqrt(Float64(Float64(d / h) * Float64(d / l)));
	else
		tmp = Float64(d / sqrt(Float64(l * h)));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (d <= -1.7e-68)
		tmp = sqrt(((d / h) * (d / l)));
	else
		tmp = d / sqrt((l * h));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -1.7e-68], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.7 \cdot 10^{-68}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -1.70000000000000009e-68

    1. Initial program 71.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. Simplified72.7%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(\frac{D}{\frac{2}{M} \cdot d}\right)}^{2} \cdot -0.5, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in h around 0 44.3%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. *-rgt-identity44.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. sqrt-unprod34.4%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr34.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]

    if -1.70000000000000009e-68 < d

    1. Initial program 65.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. Simplified65.5%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(\frac{D}{\frac{2}{M} \cdot d}\right)}^{2} \cdot -0.5, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in h around 0 32.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. *-rgt-identity32.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      2. sqrt-unprod24.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    6. Applied egg-rr24.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    7. Step-by-step derivation
      1. frac-times17.8%

        \[\leadsto \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}} \]
      2. unpow217.8%

        \[\leadsto \sqrt{\frac{\color{blue}{{d}^{2}}}{h \cdot \ell}} \]
      3. associate-/l/18.0%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{\ell}}{h}}} \]
      4. expm1-log1p-u17.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right)\right)} \]
      5. expm1-udef15.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right)} - 1} \]
      6. associate-/l/14.8%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}}\right)} - 1 \]
      7. unpow214.8%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}}\right)} - 1 \]
      8. frac-times18.5%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}}\right)} - 1 \]
      9. frac-times14.8%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}}\right)} - 1 \]
      10. unpow214.8%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{\color{blue}{{d}^{2}}}{h \cdot \ell}}\right)} - 1 \]
      11. sqrt-div16.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}}\right)} - 1 \]
      12. unpow216.8%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
      13. sqrt-prod22.1%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
      14. add-sqr-sqrt24.1%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
      15. *-commutative24.1%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\color{blue}{\ell \cdot h}}}\right)} - 1 \]
    8. Applied egg-rr24.1%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def28.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
      2. expm1-log1p34.5%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    10. Simplified34.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification34.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.7 \cdot 10^{-68}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 26.2% accurate, 3.2× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \frac{d}{\sqrt{\ell \cdot h}} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D) :precision binary64 (/ d (sqrt (* l h))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	return d / sqrt((l * h));
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    code = d / sqrt((l * h))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	return d / Math.sqrt((l * h));
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	return d / math.sqrt((l * h))
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	return Float64(d / sqrt(Float64(l * h)))
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
	tmp = d / sqrt((l * h));
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Derivation
  1. Initial program 67.6%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified67.9%

    \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(\frac{D}{\frac{2}{M} \cdot d}\right)}^{2} \cdot -0.5, 1\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in h around 0 36.1%

    \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
  5. Step-by-step derivation
    1. *-rgt-identity36.1%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
    2. sqrt-unprod27.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
  6. Applied egg-rr27.8%

    \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
  7. Step-by-step derivation
    1. frac-times22.0%

      \[\leadsto \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}} \]
    2. unpow222.0%

      \[\leadsto \sqrt{\frac{\color{blue}{{d}^{2}}}{h \cdot \ell}} \]
    3. associate-/l/22.6%

      \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{\ell}}{h}}} \]
    4. expm1-log1p-u21.9%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right)\right)} \]
    5. expm1-udef17.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{\frac{{d}^{2}}{\ell}}{h}}\right)} - 1} \]
    6. associate-/l/17.4%

      \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}}\right)} - 1 \]
    7. unpow217.4%

      \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}}\right)} - 1 \]
    8. frac-times20.6%

      \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{d}{h} \cdot \frac{d}{\ell}}}\right)} - 1 \]
    9. frac-times17.4%

      \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}}\right)} - 1 \]
    10. unpow217.4%

      \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\frac{\color{blue}{{d}^{2}}}{h \cdot \ell}}\right)} - 1 \]
    11. sqrt-div18.7%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}}\right)} - 1 \]
    12. unpow218.7%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
    13. sqrt-prod14.9%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
    14. add-sqr-sqrt16.5%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{d}}{\sqrt{h \cdot \ell}}\right)} - 1 \]
    15. *-commutative16.5%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\color{blue}{\ell \cdot h}}}\right)} - 1 \]
  8. Applied egg-rr16.5%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
  9. Step-by-step derivation
    1. expm1-def19.3%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
    2. expm1-log1p25.4%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
  10. Simplified25.4%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
  11. Final simplification25.4%

    \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
  12. Add Preprocessing

Reproduce

?
herbie shell --seed 2024024 
(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)))))