Henrywood and Agarwal, Equation (12)

Percentage Accurate: 67.5% → 86.7%
Time: 29.2s
Alternatives: 18
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 18 alternatives:

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

Initial Program: 67.5% accurate, 1.0× speedup?

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

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

Alternative 1: 86.7% accurate, 0.6× speedup?

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

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


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

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \left(\frac{1}{\frac{\sqrt{-\ell}}{\sqrt{-d}}} \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 -9.999999999999969e-311 < l

    1. Initial program 69.2%

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Applied egg-rr39.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-def39.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-log1p69.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. associate-*l/69.4%

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{\color{blue}{\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right) \cdot h}}{\ell}\right)\right) \]
      5. associate-*l/68.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. *-commutative68.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*68.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*68.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. *-commutative68.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. *-rgt-identity68.6%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/68.6%

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

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

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

        \[\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) \]
      2. div-inv68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac69.4%

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(\frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{\ell} \cdot \frac{\color{blue}{\left(D \cdot \frac{0.5}{d}\right) \cdot M}}{-2}\right)\right)\right) \]
      10. 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{0.5}{d}\right) \cdot M}{\ell} \cdot \frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{\color{blue}{-2}}\right)\right)\right) \]
    8. Applied egg-rr69.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{0.5}{d}\right) \cdot M}{\ell} \cdot \frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{-2}\right)}\right)\right) \]
    9. Step-by-step derivation
      1. sqrt-div80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 80.3% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}}\right)\right) \]
      8. associate-*r*66.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. *-commutative66.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. *-rgt-identity66.6%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/68.6%

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

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

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

        \[\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) \]
      2. div-inv68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac70.0%

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < l < 3.80000000000000033e82

    1. Initial program 73.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. Simplified73.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. sqrt-div88.1%

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

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

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

    if 3.80000000000000033e82 < l

    1. Initial program 61.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. Simplified61.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-rr49.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-def49.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-log1p61.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. associate-*l/61.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/61.6%

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

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

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

        \[\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) \]
      2. div-inv61.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval61.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval61.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac63.9%

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(\frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{\ell} \cdot \frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{\color{blue}{-2}}\right)\right)\right) \]
    8. Applied egg-rr63.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{0.5}{d}\right) \cdot M}{\ell} \cdot \frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{-2}\right)}\right)\right) \]
    9. Step-by-step derivation
      1. sqrt-div83.0%

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

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

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

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

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

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

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

Alternative 3: 85.5% accurate, 0.8× speedup?

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

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


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

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}}\right)\right) \]
      8. associate-*r*66.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. *-commutative66.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. *-rgt-identity66.6%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/68.6%

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

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

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

        \[\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) \]
      2. div-inv68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac70.0%

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < l

    1. Initial program 69.2%

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Applied egg-rr39.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-def39.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-log1p69.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. associate-*l/69.4%

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{\color{blue}{\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right) \cdot h}}{\ell}\right)\right) \]
      5. associate-*l/68.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. *-commutative68.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*68.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*68.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. *-commutative68.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. *-rgt-identity68.6%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/68.6%

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

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

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

        \[\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) \]
      2. div-inv68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac69.4%

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(\frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{\ell} \cdot \frac{\color{blue}{\left(D \cdot \frac{0.5}{d}\right) \cdot M}}{-2}\right)\right)\right) \]
      10. 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{0.5}{d}\right) \cdot M}{\ell} \cdot \frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{\color{blue}{-2}}\right)\right)\right) \]
    8. Applied egg-rr69.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{0.5}{d}\right) \cdot M}{\ell} \cdot \frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{-2}\right)}\right)\right) \]
    9. Step-by-step derivation
      1. sqrt-div80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 80.3% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}}\right)\right) \]
      8. associate-*r*66.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. *-commutative66.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. *-rgt-identity66.6%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/68.6%

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

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

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

        \[\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) \]
      2. div-inv68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac70.0%

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < l < 5.8000000000000003e82

    1. Initial program 73.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. Simplified73.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. sqrt-div87.1%

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

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

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

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

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

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

    if 5.8000000000000003e82 < l

    1. Initial program 61.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. Simplified61.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-rr49.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-def49.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-log1p61.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. associate-*l/61.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/61.6%

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

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

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

        \[\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) \]
      2. div-inv61.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval61.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval61.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac63.9%

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(\frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{\ell} \cdot \frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{\color{blue}{-2}}\right)\right)\right) \]
    8. Applied egg-rr63.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{0.5}{d}\right) \cdot M}{\ell} \cdot \frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{-2}\right)}\right)\right) \]
    9. Step-by-step derivation
      1. sqrt-div83.0%

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

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

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

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

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

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

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

Alternative 5: 73.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 38.7%

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

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      3. pow1/236.3%

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      4. pow-prod-down25.8%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*55.2%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. neg-mul-155.2%

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

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

    if -3.9000000000000004e162 < l < -9.999999999999969e-311

    1. Initial program 75.5%

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{\color{blue}{\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right) \cdot h}}{\ell}\right)\right) \]
      5. associate-*l/75.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. *-commutative75.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*75.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*75.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. *-commutative75.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. *-rgt-identity75.6%

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \color{blue}{\left(\left(M \cdot 0.5\right) \cdot \frac{1}{d}\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      14. associate-*l*77.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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/77.5%

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{\color{blue}{0.5}}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    6. Simplified77.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-u77.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-udef75.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. div-inv75.1%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left({\color{blue}{\left(D \cdot \left(\frac{0.5}{d} \cdot M\right)\right)}}^{2} \cdot \frac{-0.5}{\ell}\right)\right)\right) \]
      4. *-commutative77.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) \]
      5. associate-*r/77.5%

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

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

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

    if -9.999999999999969e-311 < l

    1. Initial program 69.2%

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Applied egg-rr39.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-def39.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-log1p69.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. associate-*l/69.4%

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{\color{blue}{\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right) \cdot h}}{\ell}\right)\right) \]
      5. associate-*l/68.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. *-commutative68.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*68.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*68.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. *-commutative68.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. *-rgt-identity68.6%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/68.6%

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

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

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

        \[\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) \]
      2. div-inv68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac69.4%

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(\frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{\ell} \cdot \frac{\color{blue}{\left(D \cdot \frac{0.5}{d}\right) \cdot M}}{-2}\right)\right)\right) \]
      10. 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{0.5}{d}\right) \cdot M}{\ell} \cdot \frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{\color{blue}{-2}}\right)\right)\right) \]
    8. Applied egg-rr69.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{0.5}{d}\right) \cdot M}{\ell} \cdot \frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{-2}\right)}\right)\right) \]
    9. Step-by-step derivation
      1. sqrt-div91.1%

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

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

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

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

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

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

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

Alternative 6: 75.3% accurate, 1.0× speedup?

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

\mathbf{elif}\;h \leq 1.85 \cdot 10^{+189}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_3\right) \cdot t_4\\

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


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

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}}\right)\right) \]
      8. associate-*r*66.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. *-commutative66.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. *-rgt-identity66.6%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/68.6%

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

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

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

        \[\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) \]
      2. div-inv68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac70.0%

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

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

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

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

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

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

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

    if 9.999999999999969e-311 < h < 1.8500000000000001e189

    1. Initial program 75.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}}\right)\right) \]
      8. associate-*r*74.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. *-commutative74.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. *-rgt-identity74.6%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/74.6%

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

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

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

        \[\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) \]
      2. div-inv74.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval74.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval74.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.8500000000000001e189 < h

    1. Initial program 46.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}}\right)\right) \]
      8. associate-*r*46.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. *-commutative46.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. *-rgt-identity46.0%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/46.1%

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

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

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

        \[\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) \]
      2. div-inv46.1%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval46.1%

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

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac46.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 79.2% accurate, 1.0× speedup?

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

\mathbf{elif}\;h \leq 2.4 \cdot 10^{+188}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_3\right) \cdot t_1\\

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


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

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}}\right)\right) \]
      8. associate-*r*66.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. *-commutative66.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. *-rgt-identity66.6%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/68.6%

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

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

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

        \[\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) \]
      2. div-inv68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac70.0%

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < h < 2.3999999999999999e188

    1. Initial program 75.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}}\right)\right) \]
      8. associate-*r*74.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. *-commutative74.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. *-rgt-identity74.6%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/74.6%

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

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

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

        \[\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) \]
      2. div-inv74.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval74.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval74.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.3999999999999999e188 < h

    1. Initial program 46.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}}\right)\right) \]
      8. associate-*r*46.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. *-commutative46.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. *-rgt-identity46.0%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/46.1%

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

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

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

        \[\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) \]
      2. div-inv46.1%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval46.1%

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

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac46.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 81.0% accurate, 1.0× speedup?

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

\mathbf{elif}\;h \leq 4.8 \cdot 10^{+188}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_2\right) \cdot \sqrt{\frac{d}{h}}\\

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


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

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}}\right)\right) \]
      8. associate-*r*66.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. *-commutative66.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. *-rgt-identity66.6%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/68.6%

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

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

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

        \[\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) \]
      2. div-inv68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval68.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac70.0%

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < h < 4.7999999999999999e188

    1. Initial program 75.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}}\right)\right) \]
      8. associate-*r*74.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. *-commutative74.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. *-rgt-identity74.6%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/74.6%

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

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

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

        \[\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) \]
      2. div-inv74.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval74.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval74.6%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.7999999999999999e188 < h

    1. Initial program 46.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}}\right)\right) \]
      8. associate-*r*46.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. *-commutative46.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. *-rgt-identity46.0%

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

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

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/46.1%

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

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

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

        \[\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) \]
      2. div-inv46.1%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval46.1%

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

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac46.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 68.6% accurate, 1.4× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -2.9e175

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

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      3. pow1/234.6%

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      4. pow-prod-down28.9%

        \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}} \]
    6. Applied egg-rr28.9%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*68.7%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. neg-mul-168.7%

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

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

    if -2.9e175 < d

    1. Initial program 69.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. Simplified68.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-rr34.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-def34.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-log1p68.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. associate-*l/69.9%

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{\color{blue}{\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right) \cdot h}}{\ell}\right)\right) \]
      5. associate-*l/69.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. *-commutative69.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*69.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*69.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. *-commutative69.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. *-rgt-identity69.4%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(\frac{\color{blue}{D \cdot 1}}{d} \cdot \left(M \cdot 0.5\right)\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{{\left(\color{blue}{\left(D \cdot \frac{1}{d}\right)} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      12. associate-*r*69.9%

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

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

        \[\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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/69.9%

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

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

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

        \[\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) \]
      2. div-inv69.9%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval69.9%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval69.9%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac71.2%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 69.5% accurate, 1.4× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -1.50000000000000012e220

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

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      3. pow1/29.5%

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      4. pow-prod-down9.5%

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      2. *-commutative9.5%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*50.7%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. neg-mul-150.7%

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

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

    if -1.50000000000000012e220 < l

    1. Initial program 71.5%

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{\color{blue}{\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot -0.5\right) \cdot h}}{\ell}\right)\right) \]
      5. associate-*l/70.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. *-commutative70.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*70.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*70.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. *-commutative70.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. *-rgt-identity70.9%

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \color{blue}{\left(\left(M \cdot 0.5\right) \cdot \frac{1}{d}\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      14. associate-*l*72.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 \left(0.5 \cdot \frac{1}{d}\right)\right)}\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
      15. associate-*r/72.2%

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{{\left(D \cdot \left(M \cdot \frac{\color{blue}{0.5}}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right) \]
    6. Simplified72.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. unpow272.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) \]
      2. div-inv72.2%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\color{blue}{\ell \cdot \frac{1}{-0.5}}}\right)\right) \]
      3. metadata-eval72.2%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{-2}}\right)\right) \]
      4. metadata-eval72.2%

        \[\leadsto \sqrt{\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) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{\ell \cdot \color{blue}{\left(-2\right)}}\right)\right) \]
      5. times-frac73.0%

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

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

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

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

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

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

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

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

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

Alternative 11: 47.0% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;d \leq 7.1 \cdot 10^{-245}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -7.2000000000000001e126 or -3.9000000000000002e-86 < d < 7.10000000000000016e-245

    1. Initial program 56.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. Simplified56.6%

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      3. pow1/222.0%

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      4. pow-prod-down16.8%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*39.5%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. neg-mul-139.5%

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

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

    if -7.2000000000000001e126 < d < -3.9000000000000002e-86

    1. Initial program 83.6%

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

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      3. pow1/250.1%

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      4. pow-prod-down36.6%

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

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

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

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

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

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

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

    if 7.10000000000000016e-245 < d

    1. Initial program 72.2%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      6. add-sqr-sqrt55.0%

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

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

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

Alternative 12: 47.0% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;d \leq 6.6 \cdot 10^{-245}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.8999999999999999e116 or -5.2999999999999997e-86 < d < 6.6000000000000002e-245

    1. Initial program 57.7%

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

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      3. pow1/224.0%

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      4. pow-prod-down18.9%

        \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}} \]
    6. Applied egg-rr18.9%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*40.8%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. neg-mul-140.8%

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

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

    if -1.8999999999999999e116 < d < -5.2999999999999997e-86

    1. Initial program 82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}} \]
    10. Simplified49.1%

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

    if 6.6000000000000002e-245 < d

    1. Initial program 72.2%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      6. add-sqr-sqrt55.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.9 \cdot 10^{+116}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{elif}\;d \leq -5.3 \cdot 10^{-86}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;d \leq 6.6 \cdot 10^{-245}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 47.0% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;d \leq 1.16 \cdot 10^{-244}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.18e117 or -1.1500000000000001e-87 < d < 1.16e-244

    1. Initial program 57.7%

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

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      3. pow1/224.0%

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      4. pow-prod-down18.9%

        \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}} \]
    6. Applied egg-rr18.9%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*40.8%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. neg-mul-140.8%

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

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

    if -1.18e117 < d < -1.1500000000000001e-87

    1. Initial program 82.1%

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

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      3. pow1/247.9%

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      4. pow-prod-down33.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}} \]
    11. Step-by-step derivation
      1. clear-num48.0%

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

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

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

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

    if 1.16e-244 < d

    1. Initial program 72.2%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      6. add-sqr-sqrt55.0%

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

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

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

Alternative 14: 47.0% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;d \leq 6.5 \cdot 10^{-245}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.35000000000000002e131 or -5.7999999999999998e-86 < d < 6.5000000000000004e-245

    1. Initial program 55.2%

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

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      3. pow1/220.5%

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

        \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}} \]
    6. Applied egg-rr15.2%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*38.4%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. neg-mul-138.4%

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

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

    if -1.35000000000000002e131 < d < -5.7999999999999998e-86

    1. Initial program 84.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. Simplified84.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.5000000000000004e-245 < d

    1. Initial program 72.2%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      6. add-sqr-sqrt55.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.35 \cdot 10^{+131}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{elif}\;d \leq -5.8 \cdot 10^{-86}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot {\left(\frac{h}{d}\right)}^{-0.5}\\ \mathbf{elif}\;d \leq 6.5 \cdot 10^{-245}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 46.5% accurate, 1.6× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 1.79999999999999987e-244

    1. Initial program 64.7%

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

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      3. pow1/230.8%

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      4. pow-prod-down23.0%

        \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}} \]
    6. Applied egg-rr23.0%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*37.4%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. neg-mul-137.4%

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

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

    if 1.79999999999999987e-244 < d

    1. Initial program 72.2%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      6. add-sqr-sqrt55.0%

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

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

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

Alternative 16: 42.7% accurate, 2.9× speedup?

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

\mathbf{else}:\\
\;\;\;\;d \cdot t_0\\


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

    1. Initial program 63.7%

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

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

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

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

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      3. pow1/233.7%

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      4. pow-prod-down25.8%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*41.6%

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. neg-mul-141.6%

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

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

    if -1.9499999999999999e-241 < l

    1. Initial program 71.5%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified71.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(\frac{D}{\frac{2}{M} \cdot d}\right)}^{2} \cdot -0.5, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in h around 0 38.5%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 40.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. *-commutative40.7%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    7. Simplified40.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification41.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.95 \cdot 10^{-241}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 36.3% accurate, 3.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -1.1 \cdot 10^{-68}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= d -1.1e-68) (sqrt (* (/ d l) (/ d h))) (* d (sqrt (/ 1.0 (* l h))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (d <= -1.1e-68) {
		tmp = sqrt(((d / l) * (d / h)));
	} else {
		tmp = d * sqrt((1.0 / (l * h)));
	}
	return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d <= (-1.1d-68)) then
        tmp = sqrt(((d / l) * (d / h)))
    else
        tmp = d * sqrt((1.0d0 / (l * h)))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (d <= -1.1e-68) {
		tmp = Math.sqrt(((d / l) * (d / h)));
	} else {
		tmp = d * Math.sqrt((1.0 / (l * h)));
	}
	return tmp;
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	tmp = 0
	if d <= -1.1e-68:
		tmp = math.sqrt(((d / l) * (d / h)))
	else:
		tmp = d * math.sqrt((1.0 / (l * h)))
	return tmp
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (d <= -1.1e-68)
		tmp = sqrt(Float64(Float64(d / l) * Float64(d / h)));
	else
		tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h))));
	end
	return tmp
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
	tmp = 0.0;
	if (d <= -1.1e-68)
		tmp = sqrt(((d / l) * (d / h)));
	else
		tmp = d * sqrt((1.0 / (l * h)));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -1.1e-68], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.1 \cdot 10^{-68}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -1.10000000000000001e-68

    1. Initial program 71.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified72.7%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(\frac{D}{\frac{2}{M} \cdot d}\right)}^{2} \cdot -0.5, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in h around 0 44.3%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Step-by-step derivation
      1. pow1/244.3%

        \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{0.5}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \]
      2. *-rgt-identity44.3%

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
      3. pow1/244.3%

        \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
      4. pow-prod-down34.4%

        \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}} \]
    6. Applied egg-rr34.4%

      \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}} \]
    7. Step-by-step derivation
      1. unpow1/234.4%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
      2. *-commutative34.4%

        \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \]
    8. Simplified34.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \]

    if -1.10000000000000001e-68 < d

    1. Initial program 65.7%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified65.5%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(\frac{D}{\frac{2}{M} \cdot d}\right)}^{2} \cdot -0.5, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in h around 0 32.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
    5. Taylor expanded in d around 0 33.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. *-commutative33.9%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    7. Simplified33.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification34.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.1 \cdot 10^{-68}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 32.4% accurate, 3.1× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D) :precision binary64 (sqrt (* (/ d l) (/ d h))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	return sqrt(((d / l) * (d / h)));
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_1
    code = sqrt(((d / l) * (d / h)))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
	return Math.sqrt(((d / l) * (d / h)));
}
M_m = math.fabs(M)
[d, h, l, M_m, D] = sort([d, h, l, M_m, D])
def code(d, h, l, M_m, D):
	return math.sqrt(((d / l) * (d / h)))
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	return sqrt(Float64(Float64(d / l) * Float64(d / h)))
end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
	tmp = sqrt(((d / l) * (d / h)));
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}
\end{array}
Derivation
  1. Initial program 67.6%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified67.9%

    \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(\frac{D}{\frac{2}{M} \cdot d}\right)}^{2} \cdot -0.5, 1\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in h around 0 36.1%

    \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{1}\right) \]
  5. Step-by-step derivation
    1. pow1/236.1%

      \[\leadsto \color{blue}{{\left(\frac{d}{h}\right)}^{0.5}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot 1\right) \]
    2. *-rgt-identity36.1%

      \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]
    3. pow1/236.1%

      \[\leadsto {\left(\frac{d}{h}\right)}^{0.5} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{0.5}} \]
    4. pow-prod-down27.8%

      \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}} \]
  6. Applied egg-rr27.8%

    \[\leadsto \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}} \]
  7. Step-by-step derivation
    1. unpow1/227.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \]
    2. *-commutative27.8%

      \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \]
  8. Simplified27.8%

    \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \]
  9. Final simplification27.8%

    \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \]
  10. Add Preprocessing

Reproduce

?
herbie shell --seed 2024024 
(FPCore (d h l M D)
  :name "Henrywood and Agarwal, Equation (12)"
  :precision binary64
  (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))