Henrywood and Agarwal, Equation (12)

Percentage Accurate: 65.7% → 84.4%
Time: 35.2s
Alternatives: 20
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 20 alternatives:

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

Initial Program: 65.7% accurate, 1.0× speedup?

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

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

Alternative 1: 84.4% accurate, 0.6× speedup?

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

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


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

    1. Initial program 67.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.8%

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \color{blue}{\frac{\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/70.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. *-commutative70.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*70.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. associate-*r*70.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < h

    1. Initial program 63.8%

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \color{blue}{\frac{\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/67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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 \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\ell \cdot -2}{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 72.1% accurate, 0.3× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := D_m \cdot \left(0.5 \cdot \frac{M_m}{d}\right)\\ t_2 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot {\left(\frac{D_m \cdot M_m}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_3 := \sqrt{h \cdot \ell}\\ \mathbf{if}\;t_2 \leq -2 \cdot 10^{-122}:\\ \;\;\;\;\left(t_0 \cdot \left(1 + h \cdot \frac{t_1}{\frac{\ell \cdot -2}{t_1}}\right)\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5, \frac{h}{\ell} \cdot {\left(D_m \cdot \left(M_m \cdot \frac{0.5}{d}\right)\right)}^{2}, 1\right)}{t_3}\\ \mathbf{elif}\;t_2 \leq \infty:\\ \;\;\;\;\frac{1}{\sqrt{\frac{h}{d}}} \cdot \left(t_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M_m}{2} \cdot \frac{D_m}{d}\right)}^{2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{t_3} \cdot \left(1 + -0.5 \cdot \frac{h}{\frac{\ell}{{\left(M_m \cdot \frac{D_m \cdot 0.5}{d}\right)}^{2}}}\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l)))
        (t_1 (* D_m (* 0.5 (/ M_m d))))
        (t_2
         (*
          (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
          (- 1.0 (* (* 0.5 (pow (/ (* D_m M_m) (* d 2.0)) 2.0)) (/ h l)))))
        (t_3 (sqrt (* h l))))
   (if (<= t_2 -2e-122)
     (* (* t_0 (+ 1.0 (* h (/ t_1 (/ (* l -2.0) t_1))))) (sqrt (/ d h)))
     (if (<= t_2 0.0)
       (*
        d
        (/ (fma -0.5 (* (/ h l) (pow (* D_m (* M_m (/ 0.5 d))) 2.0)) 1.0) t_3))
       (if (<= t_2 INFINITY)
         (*
          (/ 1.0 (sqrt (/ h d)))
          (*
           t_0
           (+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))))))
         (*
          (/ d t_3)
          (+
           1.0
           (* -0.5 (/ h (/ l (pow (* M_m (/ (* D_m 0.5) d)) 2.0)))))))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double t_0 = sqrt((d / l));
	double t_1 = D_m * (0.5 * (M_m / d));
	double t_2 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((0.5 * pow(((D_m * M_m) / (d * 2.0)), 2.0)) * (h / l)));
	double t_3 = sqrt((h * l));
	double tmp;
	if (t_2 <= -2e-122) {
		tmp = (t_0 * (1.0 + (h * (t_1 / ((l * -2.0) / t_1))))) * sqrt((d / h));
	} else if (t_2 <= 0.0) {
		tmp = d * (fma(-0.5, ((h / l) * pow((D_m * (M_m * (0.5 / d))), 2.0)), 1.0) / t_3);
	} else if (t_2 <= ((double) INFINITY)) {
		tmp = (1.0 / sqrt((h / d))) * (t_0 * (1.0 + ((h / l) * (-0.5 * pow(((M_m / 2.0) * (D_m / d)), 2.0)))));
	} else {
		tmp = (d / t_3) * (1.0 + (-0.5 * (h / (l / pow((M_m * ((D_m * 0.5) / d)), 2.0)))));
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	t_0 = sqrt(Float64(d / l))
	t_1 = Float64(D_m * Float64(0.5 * Float64(M_m / d)))
	t_2 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(0.5 * (Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.0)) * Float64(h / l))))
	t_3 = sqrt(Float64(h * l))
	tmp = 0.0
	if (t_2 <= -2e-122)
		tmp = Float64(Float64(t_0 * Float64(1.0 + Float64(h * Float64(t_1 / Float64(Float64(l * -2.0) / t_1))))) * sqrt(Float64(d / h)));
	elseif (t_2 <= 0.0)
		tmp = Float64(d * Float64(fma(-0.5, Float64(Float64(h / l) * (Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0)), 1.0) / t_3));
	elseif (t_2 <= Inf)
		tmp = Float64(Float64(1.0 / sqrt(Float64(h / d))) * Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))))));
	else
		tmp = Float64(Float64(d / t_3) * Float64(1.0 + Float64(-0.5 * Float64(h / Float64(l / (Float64(M_m * Float64(Float64(D_m * 0.5) / d)) ^ 2.0))))));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = 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[(0.5 * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, -2e-122], N[(N[(t$95$0 * N[(1.0 + N[(h * N[(t$95$1 / N[(N[(l * -2.0), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(d * N[(N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$3), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h / N[(l / N[Power[N[(M$95$m * N[(N[(D$95$m * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := D_m \cdot \left(0.5 \cdot \frac{M_m}{d}\right)\\
t_2 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot {\left(\frac{D_m \cdot M_m}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_3 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;t_2 \leq -2 \cdot 10^{-122}:\\
\;\;\;\;\left(t_0 \cdot \left(1 + h \cdot \frac{t_1}{\frac{\ell \cdot -2}{t_1}}\right)\right) \cdot \sqrt{\frac{d}{h}}\\

\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5, \frac{h}{\ell} \cdot {\left(D_m \cdot \left(M_m \cdot \frac{0.5}{d}\right)\right)}^{2}, 1\right)}{t_3}\\

\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;\frac{1}{\sqrt{\frac{h}{d}}} \cdot \left(t_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M_m}{2} \cdot \frac{D_m}{d}\right)}^{2}\right)\right)\right)\\

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


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

    1. Initial program 85.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. Simplified84.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. Applied egg-rr0.1%

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \color{blue}{\frac{\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/85.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. *-commutative85.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*85.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. associate-*r*85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.00000000000000012e-122 < (*.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

    1. Initial program 50.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 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)))) < +inf.0

    1. Initial program 85.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. Simplified85.5%

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

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

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

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

      \[\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) \]

    if +inf.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))))

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 79.1% accurate, 1.0× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t_1\right)\\


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

    1. Initial program 67.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.8%

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \color{blue}{\frac{\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/70.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. *-commutative70.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*70.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. associate-*r*70.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < h

    1. Initial program 63.8%

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \color{blue}{\frac{\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/67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 80.8% accurate, 1.0× speedup?

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

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


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

    1. Initial program 67.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.8%

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \color{blue}{\frac{\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/70.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. *-commutative70.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*70.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. associate-*r*70.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < l

    1. Initial program 63.8%

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \color{blue}{\frac{\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/67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 73.9% accurate, 1.0× speedup?

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

\mathbf{elif}\;\ell \leq 3.75 \cdot 10^{+15}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.5 \cdot \frac{h}{\frac{\ell}{{\left(M_m \cdot \frac{D_m \cdot 0.5}{d}\right)}^{2}}}\right)\\

\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(t_2 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\


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

    1. Initial program 67.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.8%

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \color{blue}{\frac{\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/70.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. *-commutative70.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*70.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. associate-*r*70.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1000000000000001e-308 < l < 3.75e15

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

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

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

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

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

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

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

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

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

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

    if 3.75e15 < l

    1. Initial program 52.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.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-rr35.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-def35.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-log1p52.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. *-commutative52.0%

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \color{blue}{\frac{\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/53.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 74.5% accurate, 1.0× speedup?

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

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


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

    1. Initial program 66.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. Simplified65.5%

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \color{blue}{\frac{\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/69.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.6000000000000002e-255 < l

    1. Initial program 65.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. Simplified65.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-rr39.7%

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \color{blue}{\frac{\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/68.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. *-commutative68.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*68.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. associate-*r*68.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 72.1% accurate, 1.3× speedup?

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

\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+213}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.5 \cdot \frac{h}{\frac{\ell}{{\left(M_m \cdot \frac{D_m \cdot 0.5}{d}\right)}^{2}}}\right)\\

\mathbf{elif}\;\ell \leq 7.5 \cdot 10^{+275}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -1.00000000000000003e-306 or 2.59999999999999999e213 < l < 7.49999999999999978e275

    1. Initial program 65.5%

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \color{blue}{\frac{\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/68.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.00000000000000003e-306 < l < 2.59999999999999999e213

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

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

    if 7.49999999999999978e275 < l

    1. Initial program 34.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. Simplified34.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 68.7% accurate, 1.4× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := D_m \cdot \left(0.5 \cdot \frac{M_m}{d}\right)\\ \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{t_0}{\frac{\ell \cdot -2}{t_0}}\right)\right) \cdot \sqrt{\frac{d}{h}} \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (let* ((t_0 (* D_m (* 0.5 (/ M_m d)))))
   (*
    (* (sqrt (/ d l)) (+ 1.0 (* h (/ t_0 (/ (* l -2.0) t_0)))))
    (sqrt (/ d h)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double t_0 = D_m * (0.5 * (M_m / d));
	return (sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))))) * sqrt((d / h));
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: t_0
    t_0 = d_m * (0.5d0 * (m_m / d))
    code = (sqrt((d / l)) * (1.0d0 + (h * (t_0 / ((l * (-2.0d0)) / t_0))))) * sqrt((d / h))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double t_0 = D_m * (0.5 * (M_m / d));
	return (Math.sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))))) * Math.sqrt((d / h));
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	t_0 = D_m * (0.5 * (M_m / d))
	return (math.sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))))) * math.sqrt((d / h))
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	t_0 = Float64(D_m * Float64(0.5 * Float64(M_m / d)))
	return Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(t_0 / Float64(Float64(l * -2.0) / t_0))))) * sqrt(Float64(d / h)))
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
	t_0 = D_m * (0.5 * (M_m / d));
	tmp = (sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))))) * sqrt((d / h));
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(t$95$0 / N[(N[(l * -2.0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := D_m \cdot \left(0.5 \cdot \frac{M_m}{d}\right)\\
\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{t_0}{\frac{\ell \cdot -2}{t_0}}\right)\right) \cdot \sqrt{\frac{d}{h}}
\end{array}
\end{array}
Derivation
  1. Initial program 65.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. Simplified65.4%

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \color{blue}{\frac{\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/69.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. *-commutative69.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*69.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. associate-*r*69.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\ell \cdot -2}{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}}\right)\right) \cdot \sqrt{\frac{d}{h}} \]
  14. Add Preprocessing

Alternative 9: 63.9% accurate, 1.4× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D_m \cdot \left(0.5 \cdot \frac{M_m}{d}\right)}{\frac{-4}{M_m} \cdot \left(d \cdot \frac{\ell}{D_m}\right)}\right)\right) \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (*
  (sqrt (/ d h))
  (*
   (sqrt (/ d l))
   (+
    1.0
    (* h (/ (* D_m (* 0.5 (/ M_m d))) (* (/ -4.0 M_m) (* d (/ l D_m)))))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	return sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * ((D_m * (0.5 * (M_m / d))) / ((-4.0 / M_m) * (d * (l / D_m)))))));
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    code = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (h * ((d_m * (0.5d0 * (m_m / d))) / (((-4.0d0) / m_m) * (d * (l / d_m)))))))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	return Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (h * ((D_m * (0.5 * (M_m / d))) / ((-4.0 / M_m) * (d * (l / D_m)))))));
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	return math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (h * ((D_m * (0.5 * (M_m / d))) / ((-4.0 / M_m) * (d * (l / D_m)))))))
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	return Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(Float64(D_m * Float64(0.5 * Float64(M_m / d))) / Float64(Float64(-4.0 / M_m) * Float64(d * Float64(l / D_m))))))))
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
	tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * ((D_m * (0.5 * (M_m / d))) / ((-4.0 / M_m) * (d * (l / D_m)))))));
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(-4.0 / M$95$m), $MachinePrecision] * N[(d * N[(l / D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D_m \cdot \left(0.5 \cdot \frac{M_m}{d}\right)}{\frac{-4}{M_m} \cdot \left(d \cdot \frac{\ell}{D_m}\right)}\right)\right)
\end{array}
Derivation
  1. Initial program 65.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. Simplified65.4%

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \color{blue}{\frac{\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/69.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. *-commutative69.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*69.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. associate-*r*69.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{{\left(D \cdot \frac{M \cdot 0.5}{d}\right)}^{2}}{\ell} \cdot -0.5\right)} - 1\right)}\right)\right) \]
  9. Step-by-step derivation
    1. expm1-def57.5%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(D \cdot \frac{M \cdot 0.5}{d}\right)}^{2}}{\ell} \cdot -0.5\right)\right)}\right)\right) \]
    2. expm1-log1p69.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\left(\frac{{\left(D \cdot \frac{M \cdot 0.5}{d}\right)}^{2}}{\ell} \cdot -0.5\right)}\right)\right) \]
    3. metadata-eval69.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(\frac{{\left(D \cdot \frac{M \cdot 0.5}{d}\right)}^{2}}{\ell} \cdot \color{blue}{\frac{1}{-2}}\right)\right)\right) \]
    4. times-frac69.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{{\left(D \cdot \frac{M \cdot 0.5}{d}\right)}^{2} \cdot 1}{\ell \cdot -2}}\right)\right) \]
    5. associate-*r/69.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\left({\left(D \cdot \frac{M \cdot 0.5}{d}\right)}^{2} \cdot \frac{1}{\ell \cdot -2}\right)}\right)\right) \]
    6. *-commutative69.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left({\left(D \cdot \frac{\color{blue}{0.5 \cdot M}}{d}\right)}^{2} \cdot \frac{1}{\ell \cdot -2}\right)\right)\right) \]
    7. associate-/l*69.0%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left({\left(D \cdot \color{blue}{\frac{0.5}{\frac{d}{M}}}\right)}^{2} \cdot \frac{1}{\ell \cdot -2}\right)\right)\right) \]
    8. associate-/r/69.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left({\left(D \cdot \color{blue}{\left(\frac{0.5}{d} \cdot M\right)}\right)}^{2} \cdot \frac{1}{\ell \cdot -2}\right)\right)\right) \]
    9. *-commutative69.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left({\left(D \cdot \left(\frac{0.5}{d} \cdot M\right)\right)}^{2} \cdot \frac{1}{\color{blue}{-2 \cdot \ell}}\right)\right)\right) \]
    10. associate-/r*69.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left({\left(D \cdot \left(\frac{0.5}{d} \cdot M\right)\right)}^{2} \cdot \color{blue}{\frac{\frac{1}{-2}}{\ell}}\right)\right)\right) \]
    11. metadata-eval69.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left({\left(D \cdot \left(\frac{0.5}{d} \cdot M\right)\right)}^{2} \cdot \frac{\color{blue}{-0.5}}{\ell}\right)\right)\right) \]
  10. Simplified69.4%

    \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\left({\left(D \cdot \left(\frac{0.5}{d} \cdot M\right)\right)}^{2} \cdot \frac{-0.5}{\ell}\right)}\right)\right) \]
  11. Step-by-step derivation
    1. *-commutative69.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left({\left(D \cdot \color{blue}{\left(M \cdot \frac{0.5}{d}\right)}\right)}^{2} \cdot \frac{-0.5}{\ell}\right)\right)\right) \]
    2. clear-num69.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left({\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2} \cdot \color{blue}{\frac{1}{\frac{\ell}{-0.5}}}\right)\right)\right) \]
    3. div-inv69.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}}\right)\right) \]
    4. unpow269.4%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{\color{blue}{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. associate-/l*72.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{D \cdot \left(M \cdot \frac{0.5}{d}\right)}{\frac{\frac{\ell}{-0.5}}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}}\right)\right) \]
    6. *-commutative72.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \color{blue}{\left(\frac{0.5}{d} \cdot M\right)}}{\frac{\frac{\ell}{-0.5}}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}\right)\right) \]
    7. associate-*l/72.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \color{blue}{\frac{0.5 \cdot M}{d}}}{\frac{\frac{\ell}{-0.5}}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}\right)\right) \]
    8. *-un-lft-identity72.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \frac{0.5 \cdot M}{\color{blue}{1 \cdot d}}}{\frac{\frac{\ell}{-0.5}}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}\right)\right) \]
    9. times-frac72.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \color{blue}{\left(\frac{0.5}{1} \cdot \frac{M}{d}\right)}}{\frac{\frac{\ell}{-0.5}}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}\right)\right) \]
    10. metadata-eval72.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)}{\frac{\frac{\ell}{-0.5}}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}\right)\right) \]
    11. div-inv72.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\color{blue}{\ell \cdot \frac{1}{-0.5}}}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}\right)\right) \]
    12. metadata-eval72.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\ell \cdot \color{blue}{-2}}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}\right)\right) \]
    13. *-commutative72.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\ell \cdot -2}{D \cdot \color{blue}{\left(\frac{0.5}{d} \cdot M\right)}}}\right)\right) \]
    14. associate-*l/72.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\ell \cdot -2}{D \cdot \color{blue}{\frac{0.5 \cdot M}{d}}}}\right)\right) \]
    15. *-un-lft-identity72.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\ell \cdot -2}{D \cdot \frac{0.5 \cdot M}{\color{blue}{1 \cdot d}}}}\right)\right) \]
    16. times-frac72.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\ell \cdot -2}{D \cdot \color{blue}{\left(\frac{0.5}{1} \cdot \frac{M}{d}\right)}}}\right)\right) \]
    17. metadata-eval72.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\ell \cdot -2}{D \cdot \left(\color{blue}{0.5} \cdot \frac{M}{d}\right)}}\right)\right) \]
  12. Applied egg-rr72.2%

    \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\ell \cdot -2}{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}}}\right)\right) \]
  13. Taylor expanded in l around 0 68.1%

    \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\color{blue}{-4 \cdot \frac{d \cdot \ell}{D \cdot M}}}\right)\right) \]
  14. Step-by-step derivation
    1. associate-*r/68.1%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\color{blue}{\frac{-4 \cdot \left(d \cdot \ell\right)}{D \cdot M}}}\right)\right) \]
    2. times-frac67.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\color{blue}{\frac{-4}{D} \cdot \frac{d \cdot \ell}{M}}}\right)\right) \]
    3. metadata-eval67.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\color{blue}{\frac{-2}{0.5}}}{D} \cdot \frac{d \cdot \ell}{M}}\right)\right) \]
    4. associate-/r*67.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\color{blue}{\frac{-2}{0.5 \cdot D}} \cdot \frac{d \cdot \ell}{M}}\right)\right) \]
    5. *-commutative67.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{-2}{\color{blue}{D \cdot 0.5}} \cdot \frac{d \cdot \ell}{M}}\right)\right) \]
    6. *-commutative67.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{-2}{D \cdot 0.5} \cdot \frac{\color{blue}{\ell \cdot d}}{M}}\right)\right) \]
    7. associate-*l/69.6%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{-2}{D \cdot 0.5} \cdot \color{blue}{\left(\frac{\ell}{M} \cdot d\right)}}\right)\right) \]
    8. associate-/r/70.6%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{-2}{D \cdot 0.5} \cdot \color{blue}{\frac{\ell}{\frac{M}{d}}}}\right)\right) \]
    9. associate-*r/71.0%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\color{blue}{\frac{\frac{-2}{D \cdot 0.5} \cdot \ell}{\frac{M}{d}}}}\right)\right) \]
    10. associate-*l/71.0%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\color{blue}{\frac{-2 \cdot \ell}{D \cdot 0.5}}}{\frac{M}{d}}}\right)\right) \]
    11. *-commutative71.0%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\frac{\color{blue}{\ell \cdot -2}}{D \cdot 0.5}}{\frac{M}{d}}}\right)\right) \]
    12. rem-square-sqrt38.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\frac{\color{blue}{\sqrt{\ell \cdot -2} \cdot \sqrt{\ell \cdot -2}}}{D \cdot 0.5}}{\frac{M}{d}}}\right)\right) \]
    13. associate-*l/38.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{\color{blue}{\frac{\sqrt{\ell \cdot -2}}{D \cdot 0.5} \cdot \sqrt{\ell \cdot -2}}}{\frac{M}{d}}}\right)\right) \]
    14. associate-/r/38.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\color{blue}{\frac{\frac{\sqrt{\ell \cdot -2}}{D \cdot 0.5} \cdot \sqrt{\ell \cdot -2}}{M} \cdot d}}\right)\right) \]
  15. Simplified70.0%

    \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\color{blue}{\frac{-4}{M} \cdot \left(d \cdot \frac{\ell}{D}\right)}}\right)\right) \]
  16. Final simplification70.0%

    \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{-4}{M} \cdot \left(d \cdot \frac{\ell}{D}\right)}\right)\right) \]
  17. Add Preprocessing

Alternative 10: 55.3% accurate, 1.4× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -3.2 \cdot 10^{-186}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq 5.8 \cdot 10^{-290}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M_m \cdot \frac{0.5}{\frac{d}{D_m}}\right)}^{2}\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= l -3.2e-186)
   (* d (- (sqrt (/ 1.0 (* h l)))))
   (if (<= l 5.8e-290)
     (/ d (cbrt (pow (* h l) 1.5)))
     (*
      (/ d (sqrt (* h l)))
      (+ 1.0 (* -0.5 (* (/ h l) (pow (* M_m (/ 0.5 (/ d D_m))) 2.0))))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -3.2e-186) {
		tmp = d * -sqrt((1.0 / (h * l)));
	} else if (l <= 5.8e-290) {
		tmp = d / cbrt(pow((h * l), 1.5));
	} else {
		tmp = (d / sqrt((h * l))) * (1.0 + (-0.5 * ((h / l) * pow((M_m * (0.5 / (d / D_m))), 2.0))));
	}
	return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -3.2e-186) {
		tmp = d * -Math.sqrt((1.0 / (h * l)));
	} else if (l <= 5.8e-290) {
		tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
	} else {
		tmp = (d / Math.sqrt((h * l))) * (1.0 + (-0.5 * ((h / l) * Math.pow((M_m * (0.5 / (d / D_m))), 2.0))));
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (l <= -3.2e-186)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))));
	elseif (l <= 5.8e-290)
		tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5)));
	else
		tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(M_m * Float64(0.5 / Float64(d / D_m))) ^ 2.0)))));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -3.2e-186], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 5.8e-290], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M$95$m * N[(0.5 / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{-186}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\

\mathbf{elif}\;\ell \leq 5.8 \cdot 10^{-290}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M_m \cdot \frac{0.5}{\frac{d}{D_m}}\right)}^{2}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -3.2e-186

    1. Initial program 66.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified65.5%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg69.6%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div83.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr78.0%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around -inf 48.0%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg48.0%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative48.0%

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. distribute-rgt-neg-in48.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
      4. *-commutative48.0%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot \left(-d\right) \]
    8. Simplified48.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)} \]

    if -3.2e-186 < l < 5.79999999999999989e-290

    1. Initial program 66.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. Simplified66.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg76.4%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div76.1%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr71.4%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 43.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative43.9%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified43.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u9.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      2. expm1-udef9.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} - 1} \]
      3. sqrt-div9.4%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
      4. metadata-eval9.4%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)} - 1 \]
      5. un-div-inv9.4%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
    10. Applied egg-rr9.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def9.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
      2. expm1-log1p44.0%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    12. Simplified44.0%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    13. Step-by-step derivation
      1. add-cbrt-cube57.6%

        \[\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/357.1%

        \[\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-sqrt57.1%

        \[\leadsto \frac{d}{{\left(\color{blue}{\left(\ell \cdot h\right)} \cdot \sqrt{\ell \cdot h}\right)}^{0.3333333333333333}} \]
      4. pow157.1%

        \[\leadsto \frac{d}{{\left(\color{blue}{{\left(\ell \cdot h\right)}^{1}} \cdot \sqrt{\ell \cdot h}\right)}^{0.3333333333333333}} \]
      5. pow1/257.1%

        \[\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-up57.1%

        \[\leadsto \frac{d}{{\color{blue}{\left({\left(\ell \cdot h\right)}^{\left(1 + 0.5\right)}\right)}}^{0.3333333333333333}} \]
      7. metadata-eval57.1%

        \[\leadsto \frac{d}{{\left({\left(\ell \cdot h\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333}} \]
    14. Applied egg-rr57.1%

      \[\leadsto \frac{d}{\color{blue}{{\left({\left(\ell \cdot h\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
    15. Step-by-step derivation
      1. unpow1/357.6%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}} \]
    16. Simplified57.6%

      \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}} \]

    if 5.79999999999999989e-290 < l

    1. Initial program 65.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. Simplified65.2%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. *-commutative65.2%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right)}\right) \]
      2. associate-*l/67.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{h \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}}{\ell}}\right) \]
      3. div-inv67.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \]
      4. associate-*l*67.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\color{blue}{\left(M \cdot \left(\frac{1}{2} \cdot \frac{D}{d}\right)\right)}}^{2}}{\ell}\right) \]
      5. metadata-eval67.3%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(M \cdot \left(\color{blue}{0.5} \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right) \]
    5. Applied egg-rr67.3%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{h \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}}\right) \]
    6. Applied egg-rr32.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + -0.5 \cdot \frac{h}{\frac{\ell}{{\left(M \cdot \frac{0.5 \cdot D}{d}\right)}^{2}}}\right)\right)} - 1} \]
    7. Step-by-step derivation
      1. expm1-def42.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + -0.5 \cdot \frac{h}{\frac{\ell}{{\left(M \cdot \frac{0.5 \cdot D}{d}\right)}^{2}}}\right)\right)\right)} \]
      2. expm1-log1p75.8%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + -0.5 \cdot \frac{h}{\frac{\ell}{{\left(M \cdot \frac{0.5 \cdot D}{d}\right)}^{2}}}\right)} \]
      3. associate-/r/69.9%

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(\frac{h}{\ell} \cdot {\left(M \cdot \frac{0.5 \cdot D}{d}\right)}^{2}\right)}\right) \]
      4. associate-/l*70.0%

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \color{blue}{\frac{0.5}{\frac{d}{D}}}\right)}^{2}\right)\right) \]
    8. Simplified70.0%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \frac{0.5}{\frac{d}{D}}\right)}^{2}\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification58.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3.2 \cdot 10^{-186}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq 5.8 \cdot 10^{-290}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \frac{0.5}{\frac{d}{D}}\right)}^{2}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 61.2% accurate, 1.4× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -2.25 \cdot 10^{-122}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D_m}{d} \cdot \left(M_m \cdot 0.5\right)\right)}^{2}\right)\right)\\ \mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M_m \cdot \frac{0.5}{\frac{d}{D_m}}\right)}^{2}\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= h -2.25e-122)
   (*
    (sqrt (* (/ d l) (/ d h)))
    (+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ D_m d) (* M_m 0.5)) 2.0)))))
   (if (<= h -5e-310)
     (* d (- (sqrt (/ 1.0 (* h l)))))
     (*
      (/ d (sqrt (* h l)))
      (+ 1.0 (* -0.5 (* (/ h l) (pow (* M_m (/ 0.5 (/ d D_m))) 2.0))))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (h <= -2.25e-122) {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * pow(((D_m / d) * (M_m * 0.5)), 2.0))));
	} else if (h <= -5e-310) {
		tmp = d * -sqrt((1.0 / (h * l)));
	} else {
		tmp = (d / sqrt((h * l))) * (1.0 + (-0.5 * ((h / l) * pow((M_m * (0.5 / (d / D_m))), 2.0))));
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (h <= (-2.25d-122)) then
        tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((d_m / d) * (m_m * 0.5d0)) ** 2.0d0))))
    else if (h <= (-5d-310)) then
        tmp = d * -sqrt((1.0d0 / (h * l)))
    else
        tmp = (d / sqrt((h * l))) * (1.0d0 + ((-0.5d0) * ((h / l) * ((m_m * (0.5d0 / (d / d_m))) ** 2.0d0))))
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (h <= -2.25e-122) {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((D_m / d) * (M_m * 0.5)), 2.0))));
	} else if (h <= -5e-310) {
		tmp = d * -Math.sqrt((1.0 / (h * l)));
	} else {
		tmp = (d / Math.sqrt((h * l))) * (1.0 + (-0.5 * ((h / l) * Math.pow((M_m * (0.5 / (d / D_m))), 2.0))));
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if h <= -2.25e-122:
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * math.pow(((D_m / d) * (M_m * 0.5)), 2.0))))
	elif h <= -5e-310:
		tmp = d * -math.sqrt((1.0 / (h * l)))
	else:
		tmp = (d / math.sqrt((h * l))) * (1.0 + (-0.5 * ((h / l) * math.pow((M_m * (0.5 / (d / D_m))), 2.0))))
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (h <= -2.25e-122)
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M_m * 0.5)) ^ 2.0)))));
	elseif (h <= -5e-310)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))));
	else
		tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(M_m * Float64(0.5 / Float64(d / D_m))) ^ 2.0)))));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (h <= -2.25e-122)
		tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * (((D_m / d) * (M_m * 0.5)) ^ 2.0))));
	elseif (h <= -5e-310)
		tmp = d * -sqrt((1.0 / (h * l)));
	else
		tmp = (d / sqrt((h * l))) * (1.0 + (-0.5 * ((h / l) * ((M_m * (0.5 / (d / D_m))) ^ 2.0))));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, -2.25e-122], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M$95$m * N[(0.5 / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2.25 \cdot 10^{-122}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D_m}{d} \cdot \left(M_m \cdot 0.5\right)\right)}^{2}\right)\right)\\

\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M_m \cdot \frac{0.5}{\frac{d}{D_m}}\right)}^{2}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if h < -2.2499999999999999e-122

    1. Initial program 68.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. Simplified68.5%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg71.8%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div83.9%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr79.4%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. expm1-log1p-u37.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\right)} \]
      2. expm1-udef27.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} - 1} \]
    7. Applied egg-rr24.1%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left({\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def31.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left({\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\right)} \]
      2. expm1-log1p59.3%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left({\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
      3. *-commutative59.3%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left({\color{blue}{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    9. Simplified59.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left({\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]

    if -2.2499999999999999e-122 < h < -4.999999999999985e-310

    1. Initial program 65.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. Simplified63.8%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg70.0%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div85.2%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr79.0%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around -inf 60.7%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg60.7%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative60.7%

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. distribute-rgt-neg-in60.7%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
      4. *-commutative60.7%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot \left(-d\right) \]
    8. Simplified60.7%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)} \]

    if -4.999999999999985e-310 < h

    1. Initial program 63.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified63.8%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. *-commutative63.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right)}\right) \]
      2. associate-*l/66.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{h \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}}{\ell}}\right) \]
      3. div-inv66.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \]
      4. associate-*l*66.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\color{blue}{\left(M \cdot \left(\frac{1}{2} \cdot \frac{D}{d}\right)\right)}}^{2}}{\ell}\right) \]
      5. metadata-eval66.8%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(M \cdot \left(\color{blue}{0.5} \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right) \]
    5. Applied egg-rr66.8%

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{h \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}}\right) \]
    6. Applied egg-rr32.7%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + -0.5 \cdot \frac{h}{\frac{\ell}{{\left(M \cdot \frac{0.5 \cdot D}{d}\right)}^{2}}}\right)\right)} - 1} \]
    7. Step-by-step derivation
      1. expm1-def42.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + -0.5 \cdot \frac{h}{\frac{\ell}{{\left(M \cdot \frac{0.5 \cdot D}{d}\right)}^{2}}}\right)\right)\right)} \]
      2. expm1-log1p75.8%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + -0.5 \cdot \frac{h}{\frac{\ell}{{\left(M \cdot \frac{0.5 \cdot D}{d}\right)}^{2}}}\right)} \]
      3. associate-/r/68.5%

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + -0.5 \cdot \color{blue}{\left(\frac{h}{\ell} \cdot {\left(M \cdot \frac{0.5 \cdot D}{d}\right)}^{2}\right)}\right) \]
      4. associate-/l*68.5%

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \color{blue}{\frac{0.5}{\frac{d}{D}}}\right)}^{2}\right)\right) \]
    8. Simplified68.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \frac{0.5}{\frac{d}{D}}\right)}^{2}\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification63.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -2.25 \cdot 10^{-122}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right)\right)\\ \mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \frac{0.5}{\frac{d}{D}}\right)}^{2}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 46.4% accurate, 1.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -3 \cdot 10^{-190}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= l -3e-190)
   (* d (- (sqrt (/ 1.0 (* h l)))))
   (if (<= l -2e-310)
     (/ d (cbrt (pow (* h l) 1.5)))
     (* d (* (pow l -0.5) (pow h -0.5))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -3e-190) {
		tmp = d * -sqrt((1.0 / (h * l)));
	} else if (l <= -2e-310) {
		tmp = d / cbrt(pow((h * l), 1.5));
	} else {
		tmp = d * (pow(l, -0.5) * pow(h, -0.5));
	}
	return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -3e-190) {
		tmp = d * -Math.sqrt((1.0 / (h * l)));
	} else if (l <= -2e-310) {
		tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
	} else {
		tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (l <= -3e-190)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))));
	elseif (l <= -2e-310)
		tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5)));
	else
		tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5)));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -3e-190], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3 \cdot 10^{-190}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\

\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -2.9999999999999998e-190

    1. Initial program 66.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified65.5%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg69.6%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div83.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr78.0%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around -inf 48.0%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg48.0%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative48.0%

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. distribute-rgt-neg-in48.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
      4. *-commutative48.0%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot \left(-d\right) \]
    8. Simplified48.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)} \]

    if -2.9999999999999998e-190 < l < -1.999999999999994e-310

    1. Initial program 76.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. Simplified76.4%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg82.3%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div94.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr88.1%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 42.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative42.5%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified42.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u0.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      2. expm1-udef0.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} - 1} \]
      3. sqrt-div0.5%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
      4. metadata-eval0.5%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)} - 1 \]
      5. un-div-inv0.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
    10. Applied egg-rr0.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def0.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
      2. expm1-log1p42.5%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    12. Simplified42.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    13. Step-by-step derivation
      1. add-cbrt-cube59.4%

        \[\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/359.4%

        \[\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-sqrt59.4%

        \[\leadsto \frac{d}{{\left(\color{blue}{\left(\ell \cdot h\right)} \cdot \sqrt{\ell \cdot h}\right)}^{0.3333333333333333}} \]
      4. pow159.4%

        \[\leadsto \frac{d}{{\left(\color{blue}{{\left(\ell \cdot h\right)}^{1}} \cdot \sqrt{\ell \cdot h}\right)}^{0.3333333333333333}} \]
      5. pow1/259.4%

        \[\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-up59.4%

        \[\leadsto \frac{d}{{\color{blue}{\left({\left(\ell \cdot h\right)}^{\left(1 + 0.5\right)}\right)}}^{0.3333333333333333}} \]
      7. metadata-eval59.4%

        \[\leadsto \frac{d}{{\left({\left(\ell \cdot h\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333}} \]
    14. Applied egg-rr59.4%

      \[\leadsto \frac{d}{\color{blue}{{\left({\left(\ell \cdot h\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
    15. Step-by-step derivation
      1. unpow1/359.4%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}} \]
    16. Simplified59.4%

      \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}} \]

    if -1.999999999999994e-310 < l

    1. Initial program 63.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified63.8%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg67.3%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr0.0%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 45.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative45.4%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified45.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. add-log-exp13.3%

        \[\leadsto d \cdot \color{blue}{\log \left(e^{\sqrt{\frac{1}{\ell \cdot h}}}\right)} \]
      2. inv-pow13.3%

        \[\leadsto d \cdot \log \left(e^{\sqrt{\color{blue}{{\left(\ell \cdot h\right)}^{-1}}}}\right) \]
      3. sqrt-pow113.3%

        \[\leadsto d \cdot \log \left(e^{\color{blue}{{\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)}}}\right) \]
      4. metadata-eval13.3%

        \[\leadsto d \cdot \log \left(e^{{\left(\ell \cdot h\right)}^{\color{blue}{-0.5}}}\right) \]
    10. Applied egg-rr13.3%

      \[\leadsto d \cdot \color{blue}{\log \left(e^{{\left(\ell \cdot h\right)}^{-0.5}}\right)} \]
    11. Step-by-step derivation
      1. rem-log-exp45.4%

        \[\leadsto d \cdot \color{blue}{{\left(\ell \cdot h\right)}^{-0.5}} \]
      2. unpow-prod-down52.1%

        \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
    12. Applied egg-rr52.1%

      \[\leadsto d \cdot \color{blue}{\left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification50.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3 \cdot 10^{-190}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 46.4% accurate, 1.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2.4 \cdot 10^{-190}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= l -2.4e-190)
   (* d (- (sqrt (/ 1.0 (* h l)))))
   (if (<= l -2e-310)
     (/ d (cbrt (pow (* h l) 1.5)))
     (/ d (* (sqrt h) (sqrt l))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -2.4e-190) {
		tmp = d * -sqrt((1.0 / (h * l)));
	} else if (l <= -2e-310) {
		tmp = d / cbrt(pow((h * l), 1.5));
	} else {
		tmp = d / (sqrt(h) * sqrt(l));
	}
	return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -2.4e-190) {
		tmp = d * -Math.sqrt((1.0 / (h * l)));
	} else if (l <= -2e-310) {
		tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
	} else {
		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (l <= -2.4e-190)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))));
	elseif (l <= -2e-310)
		tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5)));
	else
		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -2.4e-190], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{-190}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\

\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -2.4e-190

    1. Initial program 66.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified65.5%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg69.6%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div83.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr78.0%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around -inf 48.0%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg48.0%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative48.0%

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. distribute-rgt-neg-in48.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
      4. *-commutative48.0%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot \left(-d\right) \]
    8. Simplified48.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)} \]

    if -2.4e-190 < l < -1.999999999999994e-310

    1. Initial program 76.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. Simplified76.4%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg82.3%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div94.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr88.1%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 42.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative42.5%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified42.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u0.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      2. expm1-udef0.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} - 1} \]
      3. sqrt-div0.5%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
      4. metadata-eval0.5%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)} - 1 \]
      5. un-div-inv0.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
    10. Applied egg-rr0.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def0.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
      2. expm1-log1p42.5%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    12. Simplified42.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    13. Step-by-step derivation
      1. add-cbrt-cube59.4%

        \[\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/359.4%

        \[\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-sqrt59.4%

        \[\leadsto \frac{d}{{\left(\color{blue}{\left(\ell \cdot h\right)} \cdot \sqrt{\ell \cdot h}\right)}^{0.3333333333333333}} \]
      4. pow159.4%

        \[\leadsto \frac{d}{{\left(\color{blue}{{\left(\ell \cdot h\right)}^{1}} \cdot \sqrt{\ell \cdot h}\right)}^{0.3333333333333333}} \]
      5. pow1/259.4%

        \[\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-up59.4%

        \[\leadsto \frac{d}{{\color{blue}{\left({\left(\ell \cdot h\right)}^{\left(1 + 0.5\right)}\right)}}^{0.3333333333333333}} \]
      7. metadata-eval59.4%

        \[\leadsto \frac{d}{{\left({\left(\ell \cdot h\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333}} \]
    14. Applied egg-rr59.4%

      \[\leadsto \frac{d}{\color{blue}{{\left({\left(\ell \cdot h\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
    15. Step-by-step derivation
      1. unpow1/359.4%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}} \]
    16. Simplified59.4%

      \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}} \]

    if -1.999999999999994e-310 < l

    1. Initial program 63.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified63.8%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg67.3%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr0.0%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 45.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative45.4%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified45.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u43.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      2. expm1-udef33.3%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} - 1} \]
      3. sqrt-div33.3%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
      4. metadata-eval33.3%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)} - 1 \]
      5. un-div-inv33.3%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
    10. Applied egg-rr33.3%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def43.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
      2. expm1-log1p45.4%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    12. Simplified45.4%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    13. Step-by-step derivation
      1. sqrt-prod52.1%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
    14. Applied egg-rr52.1%

      \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification50.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.4 \cdot 10^{-190}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 46.4% accurate, 1.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1.15 \cdot 10^{-238}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= l -1.15e-238)
   (* d (- (sqrt (/ 1.0 (* h l)))))
   (if (<= l -2e-310) (/ d (sqrt (* h l))) (/ d (* (sqrt h) (sqrt l))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -1.15e-238) {
		tmp = d * -sqrt((1.0 / (h * l)));
	} else if (l <= -2e-310) {
		tmp = d / sqrt((h * l));
	} else {
		tmp = d / (sqrt(h) * sqrt(l));
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (l <= (-1.15d-238)) then
        tmp = d * -sqrt((1.0d0 / (h * l)))
    else if (l <= (-2d-310)) then
        tmp = d / sqrt((h * l))
    else
        tmp = d / (sqrt(h) * sqrt(l))
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -1.15e-238) {
		tmp = d * -Math.sqrt((1.0 / (h * l)));
	} else if (l <= -2e-310) {
		tmp = d / Math.sqrt((h * l));
	} else {
		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if l <= -1.15e-238:
		tmp = d * -math.sqrt((1.0 / (h * l)))
	elif l <= -2e-310:
		tmp = d / math.sqrt((h * l))
	else:
		tmp = d / (math.sqrt(h) * math.sqrt(l))
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (l <= -1.15e-238)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))));
	elseif (l <= -2e-310)
		tmp = Float64(d / sqrt(Float64(h * l)));
	else
		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (l <= -1.15e-238)
		tmp = d * -sqrt((1.0 / (h * l)));
	elseif (l <= -2e-310)
		tmp = d / sqrt((h * l));
	else
		tmp = d / (sqrt(h) * sqrt(l));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -1.15e-238], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.15 \cdot 10^{-238}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\

\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -1.15000000000000002e-238

    1. Initial program 67.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified66.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg70.5%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div83.9%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr79.2%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around -inf 46.9%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg46.9%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative46.9%

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. distribute-rgt-neg-in46.9%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
      4. *-commutative46.9%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot \left(-d\right) \]
    8. Simplified46.9%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)} \]

    if -1.15000000000000002e-238 < l < -1.999999999999994e-310

    1. Initial program 70.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified70.0%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg80.0%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div90.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr80.0%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 70.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative70.4%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified70.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u0.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      2. expm1-udef0.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} - 1} \]
      3. sqrt-div0.2%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
      4. metadata-eval0.2%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)} - 1 \]
      5. un-div-inv0.2%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
    10. Applied egg-rr0.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def0.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
      2. expm1-log1p70.4%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    12. Simplified70.4%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]

    if -1.999999999999994e-310 < l

    1. Initial program 63.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified63.8%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg67.3%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr0.0%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 45.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative45.4%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified45.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u43.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      2. expm1-udef33.3%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} - 1} \]
      3. sqrt-div33.3%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
      4. metadata-eval33.3%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)} - 1 \]
      5. un-div-inv33.3%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
    10. Applied egg-rr33.3%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def43.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
      2. expm1-log1p45.4%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    12. Simplified45.4%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    13. Step-by-step derivation
      1. sqrt-prod52.1%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
    14. Applied egg-rr52.1%

      \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification50.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.15 \cdot 10^{-238}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 45.3% accurate, 1.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -4.4 \cdot 10^{-258}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq 4.3 \cdot 10^{-297}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= l -4.4e-258)
   (* d (- (sqrt (/ 1.0 (* h l)))))
   (if (<= l 4.3e-297) (/ d (sqrt (* h l))) (/ (/ d (sqrt h)) (sqrt l)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -4.4e-258) {
		tmp = d * -sqrt((1.0 / (h * l)));
	} else if (l <= 4.3e-297) {
		tmp = d / sqrt((h * l));
	} else {
		tmp = (d / sqrt(h)) / sqrt(l);
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (l <= (-4.4d-258)) then
        tmp = d * -sqrt((1.0d0 / (h * l)))
    else if (l <= 4.3d-297) then
        tmp = d / sqrt((h * l))
    else
        tmp = (d / sqrt(h)) / sqrt(l)
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -4.4e-258) {
		tmp = d * -Math.sqrt((1.0 / (h * l)));
	} else if (l <= 4.3e-297) {
		tmp = d / Math.sqrt((h * l));
	} else {
		tmp = (d / Math.sqrt(h)) / Math.sqrt(l);
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if l <= -4.4e-258:
		tmp = d * -math.sqrt((1.0 / (h * l)))
	elif l <= 4.3e-297:
		tmp = d / math.sqrt((h * l))
	else:
		tmp = (d / math.sqrt(h)) / math.sqrt(l)
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (l <= -4.4e-258)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))));
	elseif (l <= 4.3e-297)
		tmp = Float64(d / sqrt(Float64(h * l)));
	else
		tmp = Float64(Float64(d / sqrt(h)) / sqrt(l));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (l <= -4.4e-258)
		tmp = d * -sqrt((1.0 / (h * l)));
	elseif (l <= 4.3e-297)
		tmp = d / sqrt((h * l));
	else
		tmp = (d / sqrt(h)) / sqrt(l);
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -4.4e-258], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 4.3e-297], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.4 \cdot 10^{-258}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\

\mathbf{elif}\;\ell \leq 4.3 \cdot 10^{-297}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -4.40000000000000031e-258

    1. Initial program 67.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified66.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg70.5%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div83.9%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr79.2%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around -inf 46.9%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg46.9%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative46.9%

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. distribute-rgt-neg-in46.9%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
      4. *-commutative46.9%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot \left(-d\right) \]
    8. Simplified46.9%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)} \]

    if -4.40000000000000031e-258 < l < 4.3000000000000003e-297

    1. Initial program 63.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. Simplified63.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg73.2%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div81.8%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr72.7%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 72.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative72.9%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified72.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u8.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      2. expm1-udef8.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} - 1} \]
      3. sqrt-div8.2%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
      4. metadata-eval8.2%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)} - 1 \]
      5. un-div-inv8.2%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
    10. Applied egg-rr8.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def8.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
      2. expm1-log1p73.1%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    12. Simplified73.1%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]

    if 4.3000000000000003e-297 < l

    1. Initial program 64.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.4%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg67.8%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr0.0%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 45.0%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative45.0%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified45.0%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u43.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      2. expm1-udef32.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} - 1} \]
      3. sqrt-div32.8%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
      4. metadata-eval32.8%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)} - 1 \]
      5. un-div-inv32.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
    10. Applied egg-rr32.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def43.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
      2. expm1-log1p45.0%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    12. Simplified45.0%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    13. Step-by-step derivation
      1. *-un-lft-identity45.0%

        \[\leadsto \frac{\color{blue}{1 \cdot d}}{\sqrt{\ell \cdot h}} \]
      2. sqrt-prod51.7%

        \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      3. times-frac51.7%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{\ell}} \cdot \frac{d}{\sqrt{h}}} \]
    14. Applied egg-rr51.7%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{\ell}} \cdot \frac{d}{\sqrt{h}}} \]
    15. Step-by-step derivation
      1. associate-*l/51.7%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
      2. *-lft-identity51.7%

        \[\leadsto \frac{\color{blue}{\frac{d}{\sqrt{h}}}}{\sqrt{\ell}} \]
    16. Simplified51.7%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification50.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -4.4 \cdot 10^{-258}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq 4.3 \cdot 10^{-297}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 42.8% accurate, 3.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq 2.3 \cdot 10^{-250}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{\ell} \cdot \frac{1}{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= d 2.3e-250)
   (* d (- (sqrt (/ 1.0 (* h l)))))
   (* d (sqrt (* (/ 1.0 l) (/ 1.0 h))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (d <= 2.3e-250) {
		tmp = d * -sqrt((1.0 / (h * l)));
	} else {
		tmp = d * sqrt(((1.0 / l) * (1.0 / h)));
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (d <= 2.3d-250) then
        tmp = d * -sqrt((1.0d0 / (h * l)))
    else
        tmp = d * sqrt(((1.0d0 / l) * (1.0d0 / h)))
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (d <= 2.3e-250) {
		tmp = d * -Math.sqrt((1.0 / (h * l)));
	} else {
		tmp = d * Math.sqrt(((1.0 / l) * (1.0 / h)));
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if d <= 2.3e-250:
		tmp = d * -math.sqrt((1.0 / (h * l)))
	else:
		tmp = d * math.sqrt(((1.0 / l) * (1.0 / h)))
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (d <= 2.3e-250)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))));
	else
		tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) * Float64(1.0 / h))));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (d <= 2.3e-250)
		tmp = d * -sqrt((1.0 / (h * l)));
	else
		tmp = d * sqrt(((1.0 / l) * (1.0 / h)));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, 2.3e-250], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] * N[(1.0 / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 2.3 \cdot 10^{-250}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell} \cdot \frac{1}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 2.2999999999999999e-250

    1. Initial program 64.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. Simplified63.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg67.5%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div75.9%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr71.3%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around -inf 43.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg43.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative43.3%

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. distribute-rgt-neg-in43.3%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
      4. *-commutative43.3%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot \left(-d\right) \]
    8. Simplified43.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)} \]

    if 2.2999999999999999e-250 < d

    1. Initial program 68.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. Simplified68.0%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg72.0%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr0.0%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 48.8%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative48.8%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified48.8%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. associate-/r*49.2%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
      2. div-inv49.2%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{\ell} \cdot \frac{1}{h}}} \]
    10. Applied egg-rr49.2%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{\ell} \cdot \frac{1}{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 2.3 \cdot 10^{-250}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{\ell} \cdot \frac{1}{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 42.7% accurate, 3.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq 1.6 \cdot 10^{-246}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{h \cdot \ell}}{d}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= d 1.6e-246)
   (* d (- (sqrt (/ 1.0 (* h l)))))
   (/ 1.0 (/ (sqrt (* h l)) d))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (d <= 1.6e-246) {
		tmp = d * -sqrt((1.0 / (h * l)));
	} else {
		tmp = 1.0 / (sqrt((h * l)) / d);
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (d <= 1.6d-246) then
        tmp = d * -sqrt((1.0d0 / (h * l)))
    else
        tmp = 1.0d0 / (sqrt((h * l)) / d)
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (d <= 1.6e-246) {
		tmp = d * -Math.sqrt((1.0 / (h * l)));
	} else {
		tmp = 1.0 / (Math.sqrt((h * l)) / d);
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if d <= 1.6e-246:
		tmp = d * -math.sqrt((1.0 / (h * l)))
	else:
		tmp = 1.0 / (math.sqrt((h * l)) / d)
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (d <= 1.6e-246)
		tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))));
	else
		tmp = Float64(1.0 / Float64(sqrt(Float64(h * l)) / d));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (d <= 1.6e-246)
		tmp = d * -sqrt((1.0 / (h * l)));
	else
		tmp = 1.0 / (sqrt((h * l)) / d);
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, 1.6e-246], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.6 \cdot 10^{-246}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{h \cdot \ell}}{d}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 1.6e-246

    1. Initial program 64.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. Simplified63.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg67.5%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div75.9%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr71.3%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around -inf 43.3%

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg43.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative43.3%

        \[\leadsto -\color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. distribute-rgt-neg-in43.3%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
      4. *-commutative43.3%

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot \left(-d\right) \]
    8. Simplified43.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)} \]

    if 1.6e-246 < d

    1. Initial program 68.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. Simplified68.0%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg72.0%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr0.0%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 48.8%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative48.8%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified48.8%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. add-log-exp13.0%

        \[\leadsto d \cdot \color{blue}{\log \left(e^{\sqrt{\frac{1}{\ell \cdot h}}}\right)} \]
      2. inv-pow13.0%

        \[\leadsto d \cdot \log \left(e^{\sqrt{\color{blue}{{\left(\ell \cdot h\right)}^{-1}}}}\right) \]
      3. sqrt-pow113.0%

        \[\leadsto d \cdot \log \left(e^{\color{blue}{{\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)}}}\right) \]
      4. metadata-eval13.0%

        \[\leadsto d \cdot \log \left(e^{{\left(\ell \cdot h\right)}^{\color{blue}{-0.5}}}\right) \]
    10. Applied egg-rr13.0%

      \[\leadsto d \cdot \color{blue}{\log \left(e^{{\left(\ell \cdot h\right)}^{-0.5}}\right)} \]
    11. Step-by-step derivation
      1. rem-log-exp48.8%

        \[\leadsto d \cdot \color{blue}{{\left(\ell \cdot h\right)}^{-0.5}} \]
      2. metadata-eval48.8%

        \[\leadsto d \cdot {\left(\ell \cdot h\right)}^{\color{blue}{\left(-0.5\right)}} \]
      3. pow-flip48.8%

        \[\leadsto d \cdot \color{blue}{\frac{1}{{\left(\ell \cdot h\right)}^{0.5}}} \]
      4. pow1/248.8%

        \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{\ell \cdot h}}} \]
      5. div-inv48.8%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
      6. clear-num48.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{\ell \cdot h}}{d}}} \]
    12. Applied egg-rr48.9%

      \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{\ell \cdot h}}{d}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 1.6 \cdot 10^{-246}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{h \cdot \ell}}{d}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 38.1% accurate, 3.1× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{-238}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= l -5e-238) (sqrt (* (/ d l) (/ d h))) (/ d (sqrt (* h l)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -5e-238) {
		tmp = sqrt(((d / l) * (d / h)));
	} else {
		tmp = d / sqrt((h * l));
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (l <= (-5d-238)) then
        tmp = sqrt(((d / l) * (d / h)))
    else
        tmp = d / sqrt((h * l))
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -5e-238) {
		tmp = Math.sqrt(((d / l) * (d / h)));
	} else {
		tmp = d / Math.sqrt((h * l));
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if l <= -5e-238:
		tmp = math.sqrt(((d / l) * (d / h)))
	else:
		tmp = d / math.sqrt((h * l))
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (l <= -5e-238)
		tmp = sqrt(Float64(Float64(d / l) * Float64(d / h)));
	else
		tmp = Float64(d / sqrt(Float64(h * l)));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (l <= -5e-238)
		tmp = sqrt(((d / l) * (d / h)));
	else
		tmp = d / sqrt((h * l));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-238], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-238}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\

\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -5e-238

    1. Initial program 67.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified66.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg70.5%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div83.9%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr79.2%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 10.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative10.5%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified10.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u6.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      2. expm1-udef6.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} - 1} \]
      3. sqrt-div6.5%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
      4. metadata-eval6.5%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)} - 1 \]
      5. un-div-inv6.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
    10. Applied egg-rr6.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def6.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
      2. expm1-log1p9.8%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    12. Simplified9.8%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    13. Step-by-step derivation
      1. add-sqr-sqrt0.0%

        \[\leadsto \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{\ell \cdot h}} \]
      2. sqrt-prod0.0%

        \[\leadsto \frac{\sqrt{d} \cdot \sqrt{d}}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      3. frac-times0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}} \]
      4. sqrt-div0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \frac{\sqrt{d}}{\sqrt{h}} \]
      5. sqrt-div42.2%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}} \]
      6. sqrt-unprod34.3%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \]
    14. Applied egg-rr34.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \]

    if -5e-238 < l

    1. Initial program 64.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. Simplified64.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg68.3%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div6.9%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr6.1%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 47.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative47.3%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified47.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u40.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      2. expm1-udef30.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} - 1} \]
      3. sqrt-div30.8%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
      4. metadata-eval30.8%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)} - 1 \]
      5. un-div-inv30.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
    10. Applied egg-rr30.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def40.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
      2. expm1-log1p47.3%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    12. Simplified47.3%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification41.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{-238}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 38.0% accurate, 3.1× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -3 \cdot 10^{-237}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{h \cdot \ell}}{d}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<= l -3e-237) (sqrt (* (/ d l) (/ d h))) (/ 1.0 (/ (sqrt (* h l)) d))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -3e-237) {
		tmp = sqrt(((d / l) * (d / h)));
	} else {
		tmp = 1.0 / (sqrt((h * l)) / d);
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (l <= (-3d-237)) then
        tmp = sqrt(((d / l) * (d / h)))
    else
        tmp = 1.0d0 / (sqrt((h * l)) / d)
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (l <= -3e-237) {
		tmp = Math.sqrt(((d / l) * (d / h)));
	} else {
		tmp = 1.0 / (Math.sqrt((h * l)) / d);
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if l <= -3e-237:
		tmp = math.sqrt(((d / l) * (d / h)))
	else:
		tmp = 1.0 / (math.sqrt((h * l)) / d)
	return tmp
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (l <= -3e-237)
		tmp = sqrt(Float64(Float64(d / l) * Float64(d / h)));
	else
		tmp = Float64(1.0 / Float64(sqrt(Float64(h * l)) / d));
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (l <= -3e-237)
		tmp = sqrt(((d / l) * (d / h)));
	else
		tmp = 1.0 / (sqrt((h * l)) / d);
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -3e-237], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3 \cdot 10^{-237}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{h \cdot \ell}}{d}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -3.00000000000000024e-237

    1. Initial program 67.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified66.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg70.5%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div83.9%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr79.2%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 10.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative10.5%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified10.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u6.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
      2. expm1-udef6.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} - 1} \]
      3. sqrt-div6.5%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
      4. metadata-eval6.5%

        \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)} - 1 \]
      5. un-div-inv6.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
    10. Applied egg-rr6.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def6.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
      2. expm1-log1p9.8%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    12. Simplified9.8%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    13. Step-by-step derivation
      1. add-sqr-sqrt0.0%

        \[\leadsto \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{\ell \cdot h}} \]
      2. sqrt-prod0.0%

        \[\leadsto \frac{\sqrt{d} \cdot \sqrt{d}}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      3. frac-times0.0%

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}} \]
      4. sqrt-div0.0%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \frac{\sqrt{d}}{\sqrt{h}} \]
      5. sqrt-div42.2%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}} \]
      6. sqrt-unprod34.3%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \]
    14. Applied egg-rr34.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \]

    if -3.00000000000000024e-237 < l

    1. Initial program 64.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. Simplified64.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg68.3%

        \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      2. sqrt-div6.9%

        \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    5. Applied egg-rr6.1%

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around inf 47.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-commutative47.3%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    8. Simplified47.3%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
    9. Step-by-step derivation
      1. add-log-exp17.6%

        \[\leadsto d \cdot \color{blue}{\log \left(e^{\sqrt{\frac{1}{\ell \cdot h}}}\right)} \]
      2. inv-pow17.6%

        \[\leadsto d \cdot \log \left(e^{\sqrt{\color{blue}{{\left(\ell \cdot h\right)}^{-1}}}}\right) \]
      3. sqrt-pow117.6%

        \[\leadsto d \cdot \log \left(e^{\color{blue}{{\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)}}}\right) \]
      4. metadata-eval17.6%

        \[\leadsto d \cdot \log \left(e^{{\left(\ell \cdot h\right)}^{\color{blue}{-0.5}}}\right) \]
    10. Applied egg-rr17.6%

      \[\leadsto d \cdot \color{blue}{\log \left(e^{{\left(\ell \cdot h\right)}^{-0.5}}\right)} \]
    11. Step-by-step derivation
      1. rem-log-exp47.3%

        \[\leadsto d \cdot \color{blue}{{\left(\ell \cdot h\right)}^{-0.5}} \]
      2. metadata-eval47.3%

        \[\leadsto d \cdot {\left(\ell \cdot h\right)}^{\color{blue}{\left(-0.5\right)}} \]
      3. pow-flip47.3%

        \[\leadsto d \cdot \color{blue}{\frac{1}{{\left(\ell \cdot h\right)}^{0.5}}} \]
      4. pow1/247.3%

        \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{\ell \cdot h}}} \]
      5. div-inv47.3%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
      6. clear-num47.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{\ell \cdot h}}{d}}} \]
    12. Applied egg-rr47.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{\ell \cdot h}}{d}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification41.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3 \cdot 10^{-237}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{h \cdot \ell}}{d}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 26.6% accurate, 3.3× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \frac{d}{\sqrt{h \cdot \ell}} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m) :precision binary64 (/ d (sqrt (* h l))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	return d / sqrt((h * l));
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    code = d / sqrt((h * l))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	return d / Math.sqrt((h * l));
}
M_m = math.fabs(M)
D_m = math.fabs(D)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	return d / math.sqrt((h * l))
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	return Float64(d / sqrt(Float64(h * l)))
end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
	tmp = d / sqrt((h * l));
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Derivation
  1. Initial program 65.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. Simplified65.4%

    \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. frac-2neg69.4%

      \[\leadsto \sqrt{\color{blue}{\frac{-d}{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    2. sqrt-div44.5%

      \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
  5. Applied egg-rr41.8%

    \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
  6. Taylor expanded in d around inf 29.4%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  7. Step-by-step derivation
    1. *-commutative29.4%

      \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
  8. Simplified29.4%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
  9. Step-by-step derivation
    1. expm1-log1p-u23.8%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)\right)} \]
    2. expm1-udef18.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} - 1} \]
    3. sqrt-div18.9%

      \[\leadsto e^{\mathsf{log1p}\left(d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
    4. metadata-eval18.9%

      \[\leadsto e^{\mathsf{log1p}\left(d \cdot \frac{\color{blue}{1}}{\sqrt{\ell \cdot h}}\right)} - 1 \]
    5. un-div-inv18.9%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{d}{\sqrt{\ell \cdot h}}}\right)} - 1 \]
  10. Applied egg-rr18.9%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)} - 1} \]
  11. Step-by-step derivation
    1. expm1-def23.8%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{\ell \cdot h}}\right)\right)} \]
    2. expm1-log1p29.0%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
  12. Simplified29.0%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
  13. Final simplification29.0%

    \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
  14. Add Preprocessing

Reproduce

?
herbie shell --seed 2024011 
(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)))))