Henrywood and Agarwal, Equation (12)

Percentage Accurate: 67.0% → 83.7%
Time: 1.1min
Alternatives: 30
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 30 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.0% 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: 83.7% accurate, 0.6× speedup?

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

\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{-\ell}}{t\_1}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if h < -1.2000000000000001e65

    1. Initial program 55.0%

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

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

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

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

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

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

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

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

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

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

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

    if -1.2000000000000001e65 < h < -4.999999999999985e-310

    1. Initial program 73.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < h

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 76.8% accurate, 0.5× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999999e266

    1. Initial program 87.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-inv87.0%

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

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

    if 4.9999999999999999e266 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

    1. Initial program 22.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. Simplified22.4%

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

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

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/232.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow32.9%

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

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

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

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

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

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

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval32.9%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow32.9%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow32.9%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow28.0%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt27.6%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod33.7%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr32.5%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow232.5%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow32.6%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow34.3%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr34.3%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval34.3%

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

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow134.3%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv34.3%

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

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

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

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

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

Alternative 3: 76.8% accurate, 0.5× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999999e266

    1. Initial program 87.0%

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

    if 4.9999999999999999e266 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

    1. Initial program 22.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. Simplified22.4%

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

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

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/232.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow32.9%

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

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

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

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

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

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

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval32.9%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow32.9%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow32.9%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow28.0%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt27.6%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod33.7%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr32.5%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow232.5%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow32.6%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow34.3%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr34.3%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval34.3%

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

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow134.3%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv34.3%

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

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

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

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

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

Alternative 4: 80.6% accurate, 0.8× speedup?

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

\mathbf{elif}\;h \leq -1.06 \cdot 10^{-162}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_1}{\sqrt{-\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \frac{{\left(\frac{M \cdot D\_m}{d}\right)}^{2}}{\ell}\right)\right)\right)\\

\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot \left(t\_2 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_0 \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_3 \cdot \frac{t\_3}{\ell}\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if h < -4.5999999999999997e67

    1. Initial program 55.0%

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

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

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

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

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

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

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

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

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

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

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

    if -4.5999999999999997e67 < h < -1.06000000000000003e-162

    1. Initial program 80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.06000000000000003e-162 < h < -4.999999999999985e-310

    1. Initial program 60.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. Simplified56.3%

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

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

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

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

    if -4.999999999999985e-310 < h

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 80.1% accurate, 0.8× speedup?

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

\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{-\ell}}{t\_1}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_0 \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_2 \cdot \frac{t\_2}{\ell}\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if h < -1.02000000000000002e67

    1. Initial program 55.0%

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

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

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

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

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

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

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

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

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

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

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

    if -1.02000000000000002e67 < h < -4.999999999999985e-310

    1. Initial program 73.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < h

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 79.9% accurate, 0.8× speedup?

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

\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(t\_1 \cdot t\_2\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_1 \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_3 \cdot \frac{t\_3}{\ell}\right)\right)\right)\right)\\


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

    1. Initial program 57.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.19999999999999999e111 < l < -4.999999999999985e-310

    1. Initial program 67.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 77.8% accurate, 0.8× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\right)\\


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

    1. Initial program 65.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.39999999999999991e-301 < l

    1. Initial program 72.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 74.1% accurate, 1.0× speedup?

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

\mathbf{elif}\;d \leq 2.5 \cdot 10^{-275}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t\_0\right)\\

\mathbf{elif}\;d \leq 1.4 \cdot 10^{+33}:\\
\;\;\;\;t\_1 \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_2 \cdot \frac{t\_2}{\ell}\right)\right)\right)\right)\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.2999999999999999e-128 < d < 2.49999999999999992e-275

    1. Initial program 39.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. Simplified39.1%

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

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

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

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

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

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

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

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

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

    if 2.49999999999999992e-275 < d < 1.4e33

    1. Initial program 74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4e33 < d

    1. Initial program 75.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      12. add-sqr-sqrt61.6%

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

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

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

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

Alternative 9: 71.3% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;\ell \leq 7.5 \cdot 10^{+177}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \left(1 - \frac{h \cdot \left(0.125 \cdot {\left(\frac{M \cdot D\_m}{d}\right)}^{2}\right)}{\ell}\right)\right)\\

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


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

    1. Initial program 59.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8999999999999999e122 < l < -4.59999999999999982e-81

    1. Initial program 58.8%

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

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

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

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

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

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

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

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

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

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

    if -4.59999999999999982e-81 < l < 7.50000000000000039e177

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.50000000000000039e177 < l

    1. Initial program 57.0%

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

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

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

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/259.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow59.9%

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

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval59.8%

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

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

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

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval59.8%

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

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow59.9%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow59.9%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow52.0%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt52.0%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod41.8%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr41.5%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow241.5%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow145.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv45.9%

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{h}}{\ell}}} \]
    10. Applied egg-rr70.8%

      \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{\ell}}{\frac{d}{\sqrt{h}}}}} \]
    11. Step-by-step derivation
      1. associate-/r/71.0%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{\ell}} \cdot \frac{d}{\sqrt{h}}} \]
    12. Simplified71.0%

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

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

Alternative 10: 71.0% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;\ell \leq 1.2 \cdot 10^{+178}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \left(1 + \frac{\left(h \cdot -0.125\right) \cdot {t\_0}^{2}}{\ell}\right)\right)\\

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


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

    1. Initial program 59.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5000000000000001e129 < l < -1.2999999999999999e-81

    1. Initial program 58.8%

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

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

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

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

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

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

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

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

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

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

    if -1.2999999999999999e-81 < l < 1.2e178

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.2e178 < l

    1. Initial program 57.0%

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

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

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

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/259.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow59.9%

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

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval59.8%

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

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

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

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval59.8%

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

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow59.9%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow59.9%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow52.0%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt52.0%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod41.8%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr41.5%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow241.5%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow145.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv45.9%

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{h}}{\ell}}} \]
    10. Applied egg-rr70.8%

      \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{\ell}}{\frac{d}{\sqrt{h}}}}} \]
    11. Step-by-step derivation
      1. associate-/r/71.0%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{\ell}} \cdot \frac{d}{\sqrt{h}}} \]
    12. Simplified71.0%

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

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

Alternative 11: 76.7% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -5.79999999999999975e-126

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.79999999999999975e-126 < d < -5.00000000000023e-311

    1. Initial program 41.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. Simplified41.4%

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

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

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

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

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

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

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

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

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

    if -5.00000000000023e-311 < d

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 75.8% accurate, 1.0× speedup?

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

\mathbf{elif}\;d \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t\_0\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -6.0000000000000003e-126

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.0000000000000003e-126 < d < -5.00000000000023e-311

    1. Initial program 41.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. Simplified41.4%

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

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

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

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

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

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

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

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

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

    if -5.00000000000023e-311 < d

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 76.5% accurate, 1.0× speedup?

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

\mathbf{elif}\;d \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t\_1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -8.9999999999999998e-127

    1. Initial program 76.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. Simplified75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.9999999999999998e-127 < d < -5.00000000000023e-311

    1. Initial program 41.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. Simplified41.4%

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

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

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

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

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

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

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

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

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

    if -5.00000000000023e-311 < d

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 75.5% accurate, 1.0× speedup?

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

\mathbf{elif}\;d \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t\_1\right)\\

\mathbf{else}:\\
\;\;\;\;\left(1 - t\_1\right) \cdot \left({\ell}^{-0.5} \cdot \frac{d}{\sqrt{h}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.11999999999999997e-125

    1. Initial program 76.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. Simplified75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.11999999999999997e-125 < d < -5.00000000000023e-311

    1. Initial program 41.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. Simplified41.4%

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

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

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

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

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

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

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

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

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

    if -5.00000000000023e-311 < d

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 71.2% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;\ell \leq 2.9 \cdot 10^{+178}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \left(1 - h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \frac{-1}{\ell}\right)\right)\right)\right)\right)\\

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


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

    1. Initial program 59.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.14999999999999999e117 < l < -1.59999999999999991e-105

    1. Initial program 61.0%

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

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

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

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

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

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

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

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

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

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

    if -1.59999999999999991e-105 < l < 2.9e178

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.9e178 < l

    1. Initial program 57.0%

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

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

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

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/259.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow59.9%

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

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval59.8%

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

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

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

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval59.8%

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

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow59.9%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow59.9%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow52.0%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt52.0%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod41.8%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr41.5%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow241.5%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow145.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv45.9%

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

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{h}}{\ell}}} \]
    10. Applied egg-rr70.8%

      \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{\ell}}{\frac{d}{\sqrt{h}}}}} \]
    11. Step-by-step derivation
      1. associate-/r/71.0%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{\ell}} \cdot \frac{d}{\sqrt{h}}} \]
    12. Simplified71.0%

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

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

Alternative 16: 71.1% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+176}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -1.4e115 or -6.0000000000000002e-105 < l < 5.19999999999999981e176

    1. Initial program 73.6%

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\color{blue}{\left(-h\right)} \cdot \left(0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2} \cdot \ell} - \frac{1}{h}\right)\right)\right) \]
      3. sub-neg47.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(-h\right) \cdot \color{blue}{\left(0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2} \cdot \ell} + \left(-\frac{1}{h}\right)\right)}\right)\right) \]
      4. distribute-lft-in47.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\left(-h\right) \cdot \left(0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2} \cdot \ell}\right) + \left(-h\right) \cdot \left(-\frac{1}{h}\right)\right)}\right) \]
    6. Simplified75.5%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\left(-h\right) \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) + 1\right)}\right) \]
    7. Step-by-step derivation
      1. pow175.5%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\color{blue}{{\left(\left(-h\right) \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)}^{1}} + 1\right)\right) \]
      2. associate-*r/75.5%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left({\left(\left(-h\right) \cdot \color{blue}{\frac{0.125 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}\right)}^{1} + 1\right)\right) \]
    8. Applied egg-rr75.5%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\color{blue}{{\left(\left(-h\right) \cdot \frac{0.125 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)}^{1}} + 1\right)\right) \]
    9. Step-by-step derivation
      1. unpow175.5%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\color{blue}{\left(-h\right) \cdot \frac{0.125 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}} + 1\right)\right) \]
      2. distribute-lft-neg-in75.5%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\color{blue}{\left(-h \cdot \frac{0.125 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)} + 1\right)\right) \]
      3. distribute-rgt-neg-in75.5%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\color{blue}{h \cdot \left(-\frac{0.125 \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)} + 1\right)\right) \]
      4. associate-/l*75.5%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(h \cdot \left(-\color{blue}{0.125 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}}\right) + 1\right)\right) \]
      5. distribute-lft-neg-in75.5%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(h \cdot \color{blue}{\left(\left(-0.125\right) \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)} + 1\right)\right) \]
      6. metadata-eval75.5%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(h \cdot \left(\color{blue}{-0.125} \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) + 1\right)\right) \]
      7. associate-*r/76.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(h \cdot \left(-0.125 \cdot \frac{{\color{blue}{\left(\frac{M \cdot D}{d}\right)}}^{2}}{\ell}\right) + 1\right)\right) \]
      8. *-commutative76.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(h \cdot \left(-0.125 \cdot \frac{{\left(\frac{\color{blue}{D \cdot M}}{d}\right)}^{2}}{\ell}\right) + 1\right)\right) \]
    10. Simplified76.2%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\color{blue}{h \cdot \left(-0.125 \cdot \frac{{\left(\frac{D \cdot M}{d}\right)}^{2}}{\ell}\right)} + 1\right)\right) \]
    11. Step-by-step derivation
      1. unpow276.2%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(h \cdot \left(-0.125 \cdot \frac{\color{blue}{\frac{D \cdot M}{d} \cdot \frac{D \cdot M}{d}}}{\ell}\right) + 1\right)\right) \]
      2. associate-/l*77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(h \cdot \left(-0.125 \cdot \color{blue}{\left(\frac{D \cdot M}{d} \cdot \frac{\frac{D \cdot M}{d}}{\ell}\right)}\right) + 1\right)\right) \]
      3. associate-/l*77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(h \cdot \left(-0.125 \cdot \left(\color{blue}{\left(D \cdot \frac{M}{d}\right)} \cdot \frac{\frac{D \cdot M}{d}}{\ell}\right)\right) + 1\right)\right) \]
      4. associate-/l*77.3%

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(h \cdot \left(-0.125 \cdot \left(\left(D \cdot \frac{M}{d}\right) \cdot \frac{\color{blue}{D \cdot \frac{M}{d}}}{\ell}\right)\right) + 1\right)\right) \]
    12. Applied egg-rr77.3%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(h \cdot \left(-0.125 \cdot \color{blue}{\left(\left(D \cdot \frac{M}{d}\right) \cdot \frac{D \cdot \frac{M}{d}}{\ell}\right)}\right) + 1\right)\right) \]

    if -1.4e115 < l < -6.0000000000000002e-105

    1. Initial program 61.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified59.1%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt58.9%

        \[\leadsto \color{blue}{\left(\sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \cdot \sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. pow258.9%

        \[\leadsto \color{blue}{{\left(\sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right)}^{2}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. sqrt-unprod42.5%

        \[\leadsto {\left(\sqrt{\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      4. pow1/242.5%

        \[\leadsto {\left(\sqrt{\color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. sqrt-pow142.5%

        \[\leadsto {\color{blue}{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      6. metadata-eval42.5%

        \[\leadsto {\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.25}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr42.5%

      \[\leadsto \color{blue}{{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.25}\right)}^{2}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around -inf 79.2%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]

    if 5.19999999999999981e176 < l

    1. Initial program 57.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified54.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 59.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity59.9%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/259.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow59.9%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow59.8%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval59.8%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr59.8%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity59.8%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified59.8%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval59.8%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval59.8%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow59.9%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow59.9%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow52.0%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt52.0%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod41.8%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr41.5%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow241.5%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval45.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow145.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv45.9%

        \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \]
      17. associate-/r*43.4%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{h}}{\ell}}} \]
    10. Applied egg-rr70.8%

      \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{\ell}}{\frac{d}{\sqrt{h}}}}} \]
    11. Step-by-step derivation
      1. associate-/r/71.0%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{\ell}} \cdot \frac{d}{\sqrt{h}}} \]
    12. Simplified71.0%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{\ell}} \cdot \frac{d}{\sqrt{h}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification76.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.4 \cdot 10^{+115}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(\left(D \cdot \frac{M}{d}\right) \cdot \frac{D \cdot \frac{M}{d}}{\ell}\right)\right)\right)\right)\\ \mathbf{elif}\;\ell \leq -6 \cdot 10^{-105}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\ \mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+176}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(\left(D \cdot \frac{M}{d}\right) \cdot \frac{D \cdot \frac{M}{d}}{\ell}\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{1}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 62.7% accurate, 1.4× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := 1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\\ \mathbf{if}\;\ell \leq -2.9 \cdot 10^{+41}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -2.4 \cdot 10^{-301}:\\ \;\;\;\;t\_0 \cdot \sqrt{d \cdot \frac{d}{h \cdot \ell}}\\ \mathbf{elif}\;\ell \leq 8 \cdot 10^{+130}:\\ \;\;\;\;t\_0 \cdot \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (let* ((t_0 (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))))
   (if (<= l -2.9e+41)
     (* (sqrt (/ d l)) (sqrt (/ d h)))
     (if (<= l -2.4e-301)
       (* t_0 (sqrt (* d (/ d (* h l)))))
       (if (<= l 8e+130)
         (* t_0 (* d (pow (* h l) -0.5)))
         (/ (/ d (sqrt h)) (sqrt l)))))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double t_0 = 1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0)));
	double tmp;
	if (l <= -2.9e+41) {
		tmp = sqrt((d / l)) * sqrt((d / h));
	} else if (l <= -2.4e-301) {
		tmp = t_0 * sqrt((d * (d / (h * l))));
	} else if (l <= 8e+130) {
		tmp = t_0 * (d * pow((h * l), -0.5));
	} else {
		tmp = (d / sqrt(h)) / sqrt(l);
	}
	return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
    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_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0)))
    if (l <= (-2.9d+41)) then
        tmp = sqrt((d / l)) * sqrt((d / h))
    else if (l <= (-2.4d-301)) then
        tmp = t_0 * sqrt((d * (d / (h * l))))
    else if (l <= 8d+130) then
        tmp = t_0 * (d * ((h * l) ** (-0.5d0)))
    else
        tmp = (d / sqrt(h)) / sqrt(l)
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double t_0 = 1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0)));
	double tmp;
	if (l <= -2.9e+41) {
		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
	} else if (l <= -2.4e-301) {
		tmp = t_0 * Math.sqrt((d * (d / (h * l))));
	} else if (l <= 8e+130) {
		tmp = t_0 * (d * Math.pow((h * l), -0.5));
	} else {
		tmp = (d / Math.sqrt(h)) / Math.sqrt(l);
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	t_0 = 1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))
	tmp = 0
	if l <= -2.9e+41:
		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
	elif l <= -2.4e-301:
		tmp = t_0 * math.sqrt((d * (d / (h * l))))
	elif l <= 8e+130:
		tmp = t_0 * (d * math.pow((h * l), -0.5))
	else:
		tmp = (d / math.sqrt(h)) / math.sqrt(l)
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	t_0 = Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))))
	tmp = 0.0
	if (l <= -2.9e+41)
		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
	elseif (l <= -2.4e-301)
		tmp = Float64(t_0 * sqrt(Float64(d * Float64(d / Float64(h * l)))));
	elseif (l <= 8e+130)
		tmp = Float64(t_0 * Float64(d * (Float64(h * l) ^ -0.5)));
	else
		tmp = Float64(Float64(d / sqrt(h)) / sqrt(l));
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	t_0 = 1.0 - (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0)));
	tmp = 0.0;
	if (l <= -2.9e+41)
		tmp = sqrt((d / l)) * sqrt((d / h));
	elseif (l <= -2.4e-301)
		tmp = t_0 * sqrt((d * (d / (h * l))));
	elseif (l <= 8e+130)
		tmp = t_0 * (d * ((h * l) ^ -0.5));
	else
		tmp = (d / sqrt(h)) / sqrt(l);
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.9e+41], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2.4e-301], N[(t$95$0 * N[Sqrt[N[(d * N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8e+130], N[(t$95$0 * N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\\
\mathbf{if}\;\ell \leq -2.9 \cdot 10^{+41}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

\mathbf{elif}\;\ell \leq -2.4 \cdot 10^{-301}:\\
\;\;\;\;t\_0 \cdot \sqrt{d \cdot \frac{d}{h \cdot \ell}}\\

\mathbf{elif}\;\ell \leq 8 \cdot 10^{+130}:\\
\;\;\;\;t\_0 \cdot \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -2.89999999999999988e41

    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.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 49.0%

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}} \]

    if -2.89999999999999988e41 < l < -2.39999999999999991e-301

    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. Simplified71.0%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt70.7%

        \[\leadsto \color{blue}{\left(\sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \cdot \sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. pow270.7%

        \[\leadsto \color{blue}{{\left(\sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right)}^{2}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. sqrt-unprod61.7%

        \[\leadsto {\left(\sqrt{\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      4. pow1/261.7%

        \[\leadsto {\left(\sqrt{\color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. sqrt-pow161.7%

        \[\leadsto {\color{blue}{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      6. metadata-eval61.7%

        \[\leadsto {\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.25}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr61.7%

      \[\leadsto \color{blue}{{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.25}\right)}^{2}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. *-un-lft-identity61.7%

        \[\leadsto \color{blue}{\left(1 \cdot {\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.25}\right)}^{2}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. pow-pow61.9%

        \[\leadsto \left(1 \cdot \color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\left(0.25 \cdot 2\right)}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. metadata-eval61.9%

        \[\leadsto \left(1 \cdot {\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.5}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      4. pow1/261.9%

        \[\leadsto \left(1 \cdot \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. frac-times48.8%

        \[\leadsto \left(1 \cdot \sqrt{\color{blue}{\frac{d \cdot d}{h \cdot \ell}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      6. pow248.8%

        \[\leadsto \left(1 \cdot \sqrt{\frac{\color{blue}{{d}^{2}}}{h \cdot \ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Applied egg-rr48.8%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{{d}^{2}}{h \cdot \ell}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    8. Step-by-step derivation
      1. *-lft-identity48.8%

        \[\leadsto \color{blue}{\sqrt{\frac{{d}^{2}}{h \cdot \ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. associate-/r*47.3%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{h}}{\ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    9. Simplified47.3%

      \[\leadsto \color{blue}{\sqrt{\frac{\frac{{d}^{2}}{h}}{\ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    10. Step-by-step derivation
      1. associate-/r*48.8%

        \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. unpow248.8%

        \[\leadsto \sqrt{\frac{\color{blue}{d \cdot d}}{h \cdot \ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. associate-/l*59.5%

        \[\leadsto \sqrt{\color{blue}{d \cdot \frac{d}{h \cdot \ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      4. *-commutative59.5%

        \[\leadsto \sqrt{d \cdot \frac{d}{\color{blue}{\ell \cdot h}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    11. Applied egg-rr59.5%

      \[\leadsto \sqrt{\color{blue}{d \cdot \frac{d}{\ell \cdot h}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]

    if -2.39999999999999991e-301 < l < 8.0000000000000005e130

    1. Initial program 76.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. Simplified75.5%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt75.4%

        \[\leadsto \color{blue}{\left(\sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \cdot \sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. pow275.4%

        \[\leadsto \color{blue}{{\left(\sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right)}^{2}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. sqrt-unprod68.0%

        \[\leadsto {\left(\sqrt{\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      4. pow1/268.0%

        \[\leadsto {\left(\sqrt{\color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. sqrt-pow168.1%

        \[\leadsto {\color{blue}{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      6. metadata-eval68.1%

        \[\leadsto {\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.25}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr68.1%

      \[\leadsto \color{blue}{{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.25}\right)}^{2}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around 0 74.4%

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Step-by-step derivation
      1. unpow-174.4%

        \[\leadsto \left(d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. metadata-eval74.4%

        \[\leadsto \left(d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. pow-sqr74.4%

        \[\leadsto \left(d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      4. rem-sqrt-square74.4%

        \[\leadsto \left(d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. rem-square-sqrt74.3%

        \[\leadsto \left(d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right|\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      6. fabs-sqr74.3%

        \[\leadsto \left(d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      7. rem-square-sqrt74.4%

        \[\leadsto \left(d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    8. Simplified74.4%

      \[\leadsto \color{blue}{\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]

    if 8.0000000000000005e130 < l

    1. Initial program 61.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified59.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 59.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity59.5%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/259.5%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow59.5%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow59.5%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval59.5%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr59.5%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity59.5%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified59.5%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval59.5%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval59.5%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow59.5%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow59.5%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow52.4%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt52.4%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod44.0%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr43.7%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow243.7%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow44.1%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow48.0%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr47.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval47.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval47.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow147.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv48.0%

        \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \]
      17. associate-/r*45.9%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{h}}{\ell}}} \]
    10. Applied egg-rr71.0%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification64.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.9 \cdot 10^{+41}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -2.4 \cdot 10^{-301}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \sqrt{d \cdot \frac{d}{h \cdot \ell}}\\ \mathbf{elif}\;\ell \leq 8 \cdot 10^{+130}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 58.5% accurate, 1.4× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -4.9 \cdot 10^{-214}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt{-1 + \mathsf{fma}\left(\ell, h, 1\right)}}\\ \mathbf{elif}\;\ell \leq 1.25 \cdot 10^{+132}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (if (<= l -4.9e-214)
   (* (- d) (sqrt (/ (/ 1.0 l) h)))
   (if (<= l -5e-310)
     (/ d (sqrt (+ -1.0 (fma l h 1.0))))
     (if (<= l 1.25e+132)
       (*
        (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))
        (* d (pow (* h l) -0.5)))
       (/ (/ d (sqrt h)) (sqrt l))))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (l <= -4.9e-214) {
		tmp = -d * sqrt(((1.0 / l) / h));
	} else if (l <= -5e-310) {
		tmp = d / sqrt((-1.0 + fma(l, h, 1.0)));
	} else if (l <= 1.25e+132) {
		tmp = (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0)))) * (d * pow((h * l), -0.5));
	} else {
		tmp = (d / sqrt(h)) / sqrt(l);
	}
	return tmp;
}
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	tmp = 0.0
	if (l <= -4.9e-214)
		tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h)));
	elseif (l <= -5e-310)
		tmp = Float64(d / sqrt(Float64(-1.0 + fma(l, h, 1.0))));
	elseif (l <= 1.25e+132)
		tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0)))) * Float64(d * (Float64(h * l) ^ -0.5)));
	else
		tmp = Float64(Float64(d / sqrt(h)) / sqrt(l));
	end
	return tmp
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -4.9e-214], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d / N[Sqrt[N[(-1.0 + N[(l * h + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.25e+132], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.9 \cdot 10^{-214}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\

\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{-1 + \mathsf{fma}\left(\ell, h, 1\right)}}\\

\mathbf{elif}\;\ell \leq 1.25 \cdot 10^{+132}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -4.89999999999999968e-214

    1. Initial program 61.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified60.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 7.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Taylor expanded in h around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. associate-*l*0.0%

        \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. unpow20.0%

        \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      3. rem-square-sqrt45.0%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. neg-mul-145.0%

        \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      5. *-commutative45.0%

        \[\leadsto d \cdot \left(-\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \]
      6. associate-/r*45.2%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]
    7. Simplified45.2%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]

    if -4.89999999999999968e-214 < l < -4.999999999999985e-310

    1. Initial program 78.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. Simplified78.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 27.9%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity27.9%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/227.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow27.9%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow27.9%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval27.9%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr27.9%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity27.9%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified27.9%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval27.9%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval27.9%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow27.9%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow27.9%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow48.9%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt0.0%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod9.4%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr9.4%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow29.4%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow9.4%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow9.6%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr9.6%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval9.6%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval9.6%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow19.6%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv9.6%

        \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \]
      17. sqrt-div13.7%

        \[\leadsto \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}} \]
    10. Applied egg-rr27.9%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    11. Step-by-step derivation
      1. expm1-log1p-u27.9%

        \[\leadsto \frac{d}{\sqrt{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\ell \cdot h\right)\right)}}} \]
      2. expm1-undefine70.0%

        \[\leadsto \frac{d}{\sqrt{\color{blue}{e^{\mathsf{log1p}\left(\ell \cdot h\right)} - 1}}} \]
    12. Applied egg-rr70.0%

      \[\leadsto \frac{d}{\sqrt{\color{blue}{e^{\mathsf{log1p}\left(\ell \cdot h\right)} - 1}}} \]
    13. Step-by-step derivation
      1. sub-neg70.0%

        \[\leadsto \frac{d}{\sqrt{\color{blue}{e^{\mathsf{log1p}\left(\ell \cdot h\right)} + \left(-1\right)}}} \]
      2. metadata-eval70.0%

        \[\leadsto \frac{d}{\sqrt{e^{\mathsf{log1p}\left(\ell \cdot h\right)} + \color{blue}{-1}}} \]
      3. +-commutative70.0%

        \[\leadsto \frac{d}{\sqrt{\color{blue}{-1 + e^{\mathsf{log1p}\left(\ell \cdot h\right)}}}} \]
      4. log1p-undefine70.0%

        \[\leadsto \frac{d}{\sqrt{-1 + e^{\color{blue}{\log \left(1 + \ell \cdot h\right)}}}} \]
      5. rem-exp-log70.0%

        \[\leadsto \frac{d}{\sqrt{-1 + \color{blue}{\left(1 + \ell \cdot h\right)}}} \]
      6. +-commutative70.0%

        \[\leadsto \frac{d}{\sqrt{-1 + \color{blue}{\left(\ell \cdot h + 1\right)}}} \]
      7. fma-define70.0%

        \[\leadsto \frac{d}{\sqrt{-1 + \color{blue}{\mathsf{fma}\left(\ell, h, 1\right)}}} \]
    14. Simplified70.0%

      \[\leadsto \frac{d}{\sqrt{\color{blue}{-1 + \mathsf{fma}\left(\ell, h, 1\right)}}} \]

    if -4.999999999999985e-310 < l < 1.25e132

    1. Initial program 77.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. Simplified76.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt76.2%

        \[\leadsto \color{blue}{\left(\sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \cdot \sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. pow276.2%

        \[\leadsto \color{blue}{{\left(\sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right)}^{2}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. sqrt-unprod68.8%

        \[\leadsto {\left(\sqrt{\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      4. pow1/268.8%

        \[\leadsto {\left(\sqrt{\color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. sqrt-pow168.8%

        \[\leadsto {\color{blue}{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      6. metadata-eval68.8%

        \[\leadsto {\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.25}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr68.8%

      \[\leadsto \color{blue}{{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.25}\right)}^{2}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around 0 75.2%

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Step-by-step derivation
      1. unpow-175.2%

        \[\leadsto \left(d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. metadata-eval75.2%

        \[\leadsto \left(d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. pow-sqr75.3%

        \[\leadsto \left(d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      4. rem-sqrt-square75.3%

        \[\leadsto \left(d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. rem-square-sqrt75.1%

        \[\leadsto \left(d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right|\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      6. fabs-sqr75.1%

        \[\leadsto \left(d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      7. rem-square-sqrt75.3%

        \[\leadsto \left(d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    8. Simplified75.3%

      \[\leadsto \color{blue}{\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]

    if 1.25e132 < l

    1. Initial program 61.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified59.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 59.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity59.5%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/259.5%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow59.5%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow59.5%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval59.5%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr59.5%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity59.5%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified59.5%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval59.5%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval59.5%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow59.5%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow59.5%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow52.4%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt52.4%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod44.0%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr43.7%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow243.7%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow44.1%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow48.0%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr47.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval47.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval47.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow147.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv48.0%

        \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \]
      17. associate-/r*45.9%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{h}}{\ell}}} \]
    10. Applied egg-rr71.0%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification62.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -4.9 \cdot 10^{-214}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt{-1 + \mathsf{fma}\left(\ell, h, 1\right)}}\\ \mathbf{elif}\;\ell \leq 1.25 \cdot 10^{+132}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 68.9% accurate, 1.4× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\\ t_1 := 1 - t\_0\\ \mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t\_0\right)\\ \mathbf{elif}\;h \leq 1.6 \cdot 10^{+155}:\\ \;\;\;\;t\_1 \cdot \left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (let* ((t_0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))
        (t_1 (- 1.0 t_0)))
   (if (<= h -5e-310)
     (* (* d (sqrt (/ 1.0 (* h l)))) (+ -1.0 t_0))
     (if (<= h 1.6e+155)
       (* t_1 (* d (sqrt (/ (/ 1.0 l) h))))
       (* t_1 (sqrt (* (/ d l) (/ d h))))))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double t_0 = 0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0));
	double t_1 = 1.0 - t_0;
	double tmp;
	if (h <= -5e-310) {
		tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
	} else if (h <= 1.6e+155) {
		tmp = t_1 * (d * sqrt(((1.0 / l) / h)));
	} else {
		tmp = t_1 * sqrt(((d / l) * (d / h)));
	}
	return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
    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_m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))
    t_1 = 1.0d0 - t_0
    if (h <= (-5d-310)) then
        tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + t_0)
    else if (h <= 1.6d+155) then
        tmp = t_1 * (d * sqrt(((1.0d0 / l) / h)))
    else
        tmp = t_1 * sqrt(((d / l) * (d / h)))
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double t_0 = 0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0));
	double t_1 = 1.0 - t_0;
	double tmp;
	if (h <= -5e-310) {
		tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
	} else if (h <= 1.6e+155) {
		tmp = t_1 * (d * Math.sqrt(((1.0 / l) / h)));
	} else {
		tmp = t_1 * Math.sqrt(((d / l) * (d / h)));
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	t_0 = 0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0))
	t_1 = 1.0 - t_0
	tmp = 0
	if h <= -5e-310:
		tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0)
	elif h <= 1.6e+155:
		tmp = t_1 * (d * math.sqrt(((1.0 / l) / h)))
	else:
		tmp = t_1 * math.sqrt(((d / l) * (d / h)))
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	t_0 = Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0)))
	t_1 = Float64(1.0 - t_0)
	tmp = 0.0
	if (h <= -5e-310)
		tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + t_0));
	elseif (h <= 1.6e+155)
		tmp = Float64(t_1 * Float64(d * sqrt(Float64(Float64(1.0 / l) / h))));
	else
		tmp = Float64(t_1 * sqrt(Float64(Float64(d / l) * Float64(d / h))));
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	t_0 = 0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0));
	t_1 = 1.0 - t_0;
	tmp = 0.0;
	if (h <= -5e-310)
		tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
	elseif (h <= 1.6e+155)
		tmp = t_1 * (d * sqrt(((1.0 / l) / h)));
	else
		tmp = t_1 * sqrt(((d / l) * (d / h)));
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - t$95$0), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.6e+155], N[(t$95$1 * N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\\
t_1 := 1 - t\_0\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t\_0\right)\\

\mathbf{elif}\;h \leq 1.6 \cdot 10^{+155}:\\
\;\;\;\;t\_1 \cdot \left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if h < -4.999999999999985e-310

    1. Initial program 64.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.1%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt63.9%

        \[\leadsto \color{blue}{\left(\sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \cdot \sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. pow263.9%

        \[\leadsto \color{blue}{{\left(\sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right)}^{2}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. sqrt-unprod53.3%

        \[\leadsto {\left(\sqrt{\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      4. pow1/253.3%

        \[\leadsto {\left(\sqrt{\color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. sqrt-pow153.3%

        \[\leadsto {\color{blue}{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      6. metadata-eval53.3%

        \[\leadsto {\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.25}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr53.3%

      \[\leadsto \color{blue}{{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.25}\right)}^{2}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around -inf 67.9%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]

    if -4.999999999999985e-310 < h < 1.60000000000000006e155

    1. Initial program 73.5%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified72.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt72.5%

        \[\leadsto \color{blue}{\left(\sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}} \cdot \sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. pow272.5%

        \[\leadsto \color{blue}{{\left(\sqrt{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}\right)}^{2}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. sqrt-unprod65.3%

        \[\leadsto {\left(\sqrt{\color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      4. pow1/265.3%

        \[\leadsto {\left(\sqrt{\color{blue}{{\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.5}}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. sqrt-pow165.4%

        \[\leadsto {\color{blue}{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      6. metadata-eval65.4%

        \[\leadsto {\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{\color{blue}{0.25}}\right)}^{2} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr65.4%

      \[\leadsto \color{blue}{{\left({\left(\frac{d}{h} \cdot \frac{d}{\ell}\right)}^{0.25}\right)}^{2}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Taylor expanded in d around 0 77.9%

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Step-by-step derivation
      1. unpow-177.9%

        \[\leadsto \left(d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. metadata-eval77.9%

        \[\leadsto \left(d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. pow-sqr78.0%

        \[\leadsto \left(d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      4. rem-sqrt-square78.0%

        \[\leadsto \left(d \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. rem-square-sqrt77.8%

        \[\leadsto \left(d \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right|\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      6. fabs-sqr77.8%

        \[\leadsto \left(d \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      7. fabs-sqr77.8%

        \[\leadsto \left(d \cdot \color{blue}{\left|\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right|}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      8. rem-square-sqrt78.0%

        \[\leadsto \left(d \cdot \left|\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}}\right|\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      9. rem-sqrt-square78.0%

        \[\leadsto \left(d \cdot \color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      10. pow-sqr77.9%

        \[\leadsto \left(d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{\left(2 \cdot -0.5\right)}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      11. metadata-eval77.9%

        \[\leadsto \left(d \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{-1}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      12. unpow-177.9%

        \[\leadsto \left(d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      13. *-commutative77.9%

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      14. associate-/r*78.9%

        \[\leadsto \left(d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    8. Simplified78.9%

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]

    if 1.60000000000000006e155 < h

    1. Initial program 68.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified64.4%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. pow164.4%

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)}^{1}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. sqrt-unprod59.9%

        \[\leadsto {\color{blue}{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}}^{1} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr59.9%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}^{1}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. unpow159.9%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Simplified59.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification71.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\ \mathbf{elif}\;h \leq 1.6 \cdot 10^{+155}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 50.5% accurate, 1.4× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;M \leq 1.75 \cdot 10^{-151}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (if (<= M 1.75e-151)
   (fabs (/ d (sqrt (* h l))))
   (*
    (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))
    (sqrt (* (/ d l) (/ d h))))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (M <= 1.75e-151) {
		tmp = fabs((d / sqrt((h * l))));
	} else {
		tmp = (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0)))) * sqrt(((d / l) * (d / h)));
	}
	return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
    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_m
    real(8) :: tmp
    if (m <= 1.75d-151) then
        tmp = abs((d / sqrt((h * l))))
    else
        tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0)))) * sqrt(((d / l) * (d / h)))
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (M <= 1.75e-151) {
		tmp = Math.abs((d / Math.sqrt((h * l))));
	} else {
		tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * Math.sqrt(((d / l) * (d / h)));
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	tmp = 0
	if M <= 1.75e-151:
		tmp = math.fabs((d / math.sqrt((h * l))))
	else:
		tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * math.sqrt(((d / l) * (d / h)))
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	tmp = 0.0
	if (M <= 1.75e-151)
		tmp = abs(Float64(d / sqrt(Float64(h * l))));
	else
		tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0)))) * sqrt(Float64(Float64(d / l) * Float64(d / h))));
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	tmp = 0.0;
	if (M <= 1.75e-151)
		tmp = abs((d / sqrt((h * l))));
	else
		tmp = (1.0 - (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0)))) * sqrt(((d / l) * (d / h)));
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[M, 1.75e-151], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.75 \cdot 10^{-151}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\

\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 1.74999999999999998e-151

    1. Initial program 68.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified66.8%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 33.2%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity33.2%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/233.2%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow33.2%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow33.2%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval33.2%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr33.2%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity33.2%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified33.2%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval33.2%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval33.2%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow33.2%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow33.2%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow32.2%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt26.0%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod29.4%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr27.2%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow227.2%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow27.4%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow30.6%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr30.6%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval30.6%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval30.6%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow130.6%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv30.6%

        \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \]
      17. associate-/r*31.8%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{h}}{\ell}}} \]
      18. add-sqr-sqrt31.8%

        \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{\frac{{d}^{2}}{h}}{\ell}} \cdot \sqrt{\frac{\frac{{d}^{2}}{h}}{\ell}}}} \]
    10. Applied egg-rr47.9%

      \[\leadsto \color{blue}{\left|\frac{d}{\sqrt{\ell \cdot h}}\right|} \]

    if 1.74999999999999998e-151 < M

    1. Initial program 69.1%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified69.2%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. pow169.2%

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)}^{1}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      2. sqrt-unprod62.6%

        \[\leadsto {\color{blue}{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}}^{1} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    5. Applied egg-rr62.6%

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\right)}^{1}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. unpow162.6%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    7. Simplified62.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 1.75 \cdot 10^{-151}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 21: 44.5% accurate, 1.5× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -5.9 \cdot 10^{-214}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{elif}\;\ell \leq -6.6 \cdot 10^{-301}:\\ \;\;\;\;\frac{d}{\sqrt{-1 + \mathsf{fma}\left(\ell, h, 1\right)}}\\ \mathbf{elif}\;\ell \leq 7.5 \cdot 10^{-168}:\\ \;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (if (<= l -5.9e-214)
   (* (- d) (sqrt (/ (/ 1.0 l) h)))
   (if (<= l -6.6e-301)
     (/ d (sqrt (+ -1.0 (fma l h 1.0))))
     (if (<= l 7.5e-168)
       (/ d (- (sqrt (* h l))))
       (/ (/ d (sqrt h)) (sqrt l))))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (l <= -5.9e-214) {
		tmp = -d * sqrt(((1.0 / l) / h));
	} else if (l <= -6.6e-301) {
		tmp = d / sqrt((-1.0 + fma(l, h, 1.0)));
	} else if (l <= 7.5e-168) {
		tmp = d / -sqrt((h * l));
	} else {
		tmp = (d / sqrt(h)) / sqrt(l);
	}
	return tmp;
}
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	tmp = 0.0
	if (l <= -5.9e-214)
		tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h)));
	elseif (l <= -6.6e-301)
		tmp = Float64(d / sqrt(Float64(-1.0 + fma(l, h, 1.0))));
	elseif (l <= 7.5e-168)
		tmp = Float64(d / Float64(-sqrt(Float64(h * l))));
	else
		tmp = Float64(Float64(d / sqrt(h)) / sqrt(l));
	end
	return tmp
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -5.9e-214], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -6.6e-301], N[(d / N[Sqrt[N[(-1.0 + N[(l * h + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.5e-168], N[(d / (-N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.9 \cdot 10^{-214}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\

\mathbf{elif}\;\ell \leq -6.6 \cdot 10^{-301}:\\
\;\;\;\;\frac{d}{\sqrt{-1 + \mathsf{fma}\left(\ell, h, 1\right)}}\\

\mathbf{elif}\;\ell \leq 7.5 \cdot 10^{-168}:\\
\;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -5.8999999999999998e-214

    1. Initial program 61.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified60.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 7.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Taylor expanded in h around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. associate-*l*0.0%

        \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. unpow20.0%

        \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      3. rem-square-sqrt45.0%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. neg-mul-145.0%

        \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      5. *-commutative45.0%

        \[\leadsto d \cdot \left(-\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \]
      6. associate-/r*45.2%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]
    7. Simplified45.2%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]

    if -5.8999999999999998e-214 < l < -6.6000000000000001e-301

    1. Initial program 80.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified80.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 30.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity30.4%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/230.4%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow30.4%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow30.4%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval30.4%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr30.4%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity30.4%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified30.4%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval30.4%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval30.4%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow30.4%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow30.4%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow53.5%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt0.0%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod5.5%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr5.5%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow25.5%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow5.5%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow5.7%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr5.7%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval5.7%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval5.7%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow15.7%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv5.7%

        \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \]
      17. sqrt-div10.2%

        \[\leadsto \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}} \]
    10. Applied egg-rr30.4%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    11. Step-by-step derivation
      1. expm1-log1p-u30.4%

        \[\leadsto \frac{d}{\sqrt{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\ell \cdot h\right)\right)}}} \]
      2. expm1-undefine71.9%

        \[\leadsto \frac{d}{\sqrt{\color{blue}{e^{\mathsf{log1p}\left(\ell \cdot h\right)} - 1}}} \]
    12. Applied egg-rr71.9%

      \[\leadsto \frac{d}{\sqrt{\color{blue}{e^{\mathsf{log1p}\left(\ell \cdot h\right)} - 1}}} \]
    13. Step-by-step derivation
      1. sub-neg71.9%

        \[\leadsto \frac{d}{\sqrt{\color{blue}{e^{\mathsf{log1p}\left(\ell \cdot h\right)} + \left(-1\right)}}} \]
      2. metadata-eval71.9%

        \[\leadsto \frac{d}{\sqrt{e^{\mathsf{log1p}\left(\ell \cdot h\right)} + \color{blue}{-1}}} \]
      3. +-commutative71.9%

        \[\leadsto \frac{d}{\sqrt{\color{blue}{-1 + e^{\mathsf{log1p}\left(\ell \cdot h\right)}}}} \]
      4. log1p-undefine71.9%

        \[\leadsto \frac{d}{\sqrt{-1 + e^{\color{blue}{\log \left(1 + \ell \cdot h\right)}}}} \]
      5. rem-exp-log71.9%

        \[\leadsto \frac{d}{\sqrt{-1 + \color{blue}{\left(1 + \ell \cdot h\right)}}} \]
      6. +-commutative71.9%

        \[\leadsto \frac{d}{\sqrt{-1 + \color{blue}{\left(\ell \cdot h + 1\right)}}} \]
      7. fma-define71.9%

        \[\leadsto \frac{d}{\sqrt{-1 + \color{blue}{\mathsf{fma}\left(\ell, h, 1\right)}}} \]
    14. Simplified71.9%

      \[\leadsto \frac{d}{\sqrt{\color{blue}{-1 + \mathsf{fma}\left(\ell, h, 1\right)}}} \]

    if -6.6000000000000001e-301 < l < 7.4999999999999995e-168

    1. Initial program 79.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. Simplified79.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 14.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity14.1%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/214.1%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow14.1%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow14.1%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval14.1%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr14.1%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity14.1%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified14.1%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval14.1%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval14.1%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow14.1%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow14.1%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow7.3%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt7.2%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod7.6%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr7.6%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow27.6%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow7.6%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow14.3%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr14.3%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval14.3%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval14.3%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow114.3%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv14.4%

        \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \]
      17. sqrt-div14.4%

        \[\leadsto \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}} \]
    10. Applied egg-rr14.2%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    11. Step-by-step derivation
      1. sqrt-prod14.2%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      2. add-sqr-sqrt14.1%

        \[\leadsto \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{\ell} \cdot \sqrt{h}} \]
      3. times-frac14.1%

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}} \]
      4. sqrt-div10.9%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \frac{\sqrt{d}}{\sqrt{h}} \]
      5. sqrt-div14.5%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}} \]
      6. add-sqr-sqrt14.5%

        \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{\ell}}}} \cdot \sqrt{\frac{d}{h}} \]
      7. sqr-neg14.5%

        \[\leadsto \sqrt{\color{blue}{\left(-\sqrt{\frac{d}{\ell}}\right) \cdot \left(-\sqrt{\frac{d}{\ell}}\right)}} \cdot \sqrt{\frac{d}{h}} \]
      8. sqrt-unprod0.0%

        \[\leadsto \color{blue}{\left(\sqrt{-\sqrt{\frac{d}{\ell}}} \cdot \sqrt{-\sqrt{\frac{d}{\ell}}}\right)} \cdot \sqrt{\frac{d}{h}} \]
      9. add-sqr-sqrt13.3%

        \[\leadsto \color{blue}{\left(-\sqrt{\frac{d}{\ell}}\right)} \cdot \sqrt{\frac{d}{h}} \]
      10. distribute-lft-neg-out13.3%

        \[\leadsto \color{blue}{-\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}} \]
      11. sqrt-div9.6%

        \[\leadsto -\color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}} \cdot \sqrt{\frac{d}{h}} \]
      12. sqrt-div9.7%

        \[\leadsto -\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \]
      13. times-frac9.7%

        \[\leadsto -\color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      14. add-sqr-sqrt9.7%

        \[\leadsto -\frac{\color{blue}{d}}{\sqrt{\ell} \cdot \sqrt{h}} \]
      15. sqrt-prod33.0%

        \[\leadsto -\frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \]
      16. neg-sub033.0%

        \[\leadsto \color{blue}{0 - \frac{d}{\sqrt{\ell \cdot h}}} \]
    12. Applied egg-rr33.0%

      \[\leadsto \color{blue}{0 - \frac{d}{\sqrt{\ell \cdot h}}} \]
    13. Step-by-step derivation
      1. neg-sub033.0%

        \[\leadsto \color{blue}{-\frac{d}{\sqrt{\ell \cdot h}}} \]
      2. distribute-frac-neg233.0%

        \[\leadsto \color{blue}{\frac{d}{-\sqrt{\ell \cdot h}}} \]
    14. Simplified33.0%

      \[\leadsto \color{blue}{\frac{d}{-\sqrt{\ell \cdot h}}} \]

    if 7.4999999999999995e-168 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 52.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity52.7%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/252.7%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow52.7%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow52.7%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval52.7%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr52.7%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity52.7%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified52.7%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval52.7%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval52.7%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow52.7%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow52.7%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow46.7%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt46.7%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod40.2%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr39.2%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow239.2%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow39.6%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow141.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv42.0%

        \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \]
      17. associate-/r*42.1%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{h}}{\ell}}} \]
    10. Applied egg-rr60.9%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification52.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -5.9 \cdot 10^{-214}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{elif}\;\ell \leq -6.6 \cdot 10^{-301}:\\ \;\;\;\;\frac{d}{\sqrt{-1 + \mathsf{fma}\left(\ell, h, 1\right)}}\\ \mathbf{elif}\;\ell \leq 7.5 \cdot 10^{-168}:\\ \;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 22: 43.5% accurate, 1.5× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1.4 \cdot 10^{-214}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{elif}\;\ell \leq -8.5 \cdot 10^{-301}:\\ \;\;\;\;d \cdot \sqrt[3]{{\left(h \cdot \ell\right)}^{-1.5}}\\ \mathbf{elif}\;\ell \leq 7.1 \cdot 10^{-168}:\\ \;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (if (<= l -1.4e-214)
   (* (- d) (sqrt (/ (/ 1.0 l) h)))
   (if (<= l -8.5e-301)
     (* d (cbrt (pow (* h l) -1.5)))
     (if (<= l 7.1e-168)
       (/ d (- (sqrt (* h l))))
       (/ (/ d (sqrt h)) (sqrt l))))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (l <= -1.4e-214) {
		tmp = -d * sqrt(((1.0 / l) / h));
	} else if (l <= -8.5e-301) {
		tmp = d * cbrt(pow((h * l), -1.5));
	} else if (l <= 7.1e-168) {
		tmp = d / -sqrt((h * l));
	} else {
		tmp = (d / sqrt(h)) / sqrt(l);
	}
	return tmp;
}
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (l <= -1.4e-214) {
		tmp = -d * Math.sqrt(((1.0 / l) / h));
	} else if (l <= -8.5e-301) {
		tmp = d * Math.cbrt(Math.pow((h * l), -1.5));
	} else if (l <= 7.1e-168) {
		tmp = d / -Math.sqrt((h * l));
	} else {
		tmp = (d / Math.sqrt(h)) / Math.sqrt(l);
	}
	return tmp;
}
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	tmp = 0.0
	if (l <= -1.4e-214)
		tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h)));
	elseif (l <= -8.5e-301)
		tmp = Float64(d * cbrt((Float64(h * l) ^ -1.5)));
	elseif (l <= 7.1e-168)
		tmp = Float64(d / Float64(-sqrt(Float64(h * l))));
	else
		tmp = Float64(Float64(d / sqrt(h)) / sqrt(l));
	end
	return tmp
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -1.4e-214], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -8.5e-301], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], -1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.1e-168], N[(d / (-N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.4 \cdot 10^{-214}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\

\mathbf{elif}\;\ell \leq -8.5 \cdot 10^{-301}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(h \cdot \ell\right)}^{-1.5}}\\

\mathbf{elif}\;\ell \leq 7.1 \cdot 10^{-168}:\\
\;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -1.4000000000000001e-214

    1. Initial program 61.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified60.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 7.5%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Taylor expanded in h around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. associate-*l*0.0%

        \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. unpow20.0%

        \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      3. rem-square-sqrt45.0%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. neg-mul-145.0%

        \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      5. *-commutative45.0%

        \[\leadsto d \cdot \left(-\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \]
      6. associate-/r*45.2%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]
    7. Simplified45.2%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]

    if -1.4000000000000001e-214 < l < -8.50000000000000046e-301

    1. Initial program 80.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified80.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 30.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity30.4%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/230.4%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow30.4%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow30.4%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval30.4%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr30.4%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity30.4%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified30.4%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval30.4%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval30.4%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow30.4%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow30.4%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow53.5%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. unpow1/353.5%

        \[\leadsto d \cdot \color{blue}{\sqrt[3]{{\left(\frac{1}{h \cdot \ell}\right)}^{1.5}}} \]
      7. inv-pow53.5%

        \[\leadsto d \cdot \sqrt[3]{{\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{1.5}} \]
      8. pow-pow53.5%

        \[\leadsto d \cdot \sqrt[3]{\color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 1.5\right)}}} \]
      9. *-commutative53.5%

        \[\leadsto d \cdot \sqrt[3]{{\color{blue}{\left(\ell \cdot h\right)}}^{\left(-1 \cdot 1.5\right)}} \]
      10. metadata-eval53.5%

        \[\leadsto d \cdot \sqrt[3]{{\left(\ell \cdot h\right)}^{\color{blue}{-1.5}}} \]
    10. Applied egg-rr53.5%

      \[\leadsto d \cdot \color{blue}{\sqrt[3]{{\left(\ell \cdot h\right)}^{-1.5}}} \]

    if -8.50000000000000046e-301 < l < 7.10000000000000019e-168

    1. Initial program 79.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. Simplified79.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 14.1%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity14.1%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/214.1%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow14.1%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow14.1%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval14.1%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr14.1%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity14.1%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified14.1%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval14.1%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval14.1%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow14.1%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow14.1%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow7.3%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt7.2%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod7.6%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr7.6%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow27.6%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow7.6%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow14.3%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr14.3%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval14.3%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval14.3%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow114.3%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv14.4%

        \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \]
      17. sqrt-div14.4%

        \[\leadsto \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}} \]
    10. Applied egg-rr14.2%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    11. Step-by-step derivation
      1. sqrt-prod14.2%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      2. add-sqr-sqrt14.1%

        \[\leadsto \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{\ell} \cdot \sqrt{h}} \]
      3. times-frac14.1%

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}} \]
      4. sqrt-div10.9%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \frac{\sqrt{d}}{\sqrt{h}} \]
      5. sqrt-div14.5%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}} \]
      6. add-sqr-sqrt14.5%

        \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{\ell}}}} \cdot \sqrt{\frac{d}{h}} \]
      7. sqr-neg14.5%

        \[\leadsto \sqrt{\color{blue}{\left(-\sqrt{\frac{d}{\ell}}\right) \cdot \left(-\sqrt{\frac{d}{\ell}}\right)}} \cdot \sqrt{\frac{d}{h}} \]
      8. sqrt-unprod0.0%

        \[\leadsto \color{blue}{\left(\sqrt{-\sqrt{\frac{d}{\ell}}} \cdot \sqrt{-\sqrt{\frac{d}{\ell}}}\right)} \cdot \sqrt{\frac{d}{h}} \]
      9. add-sqr-sqrt13.3%

        \[\leadsto \color{blue}{\left(-\sqrt{\frac{d}{\ell}}\right)} \cdot \sqrt{\frac{d}{h}} \]
      10. distribute-lft-neg-out13.3%

        \[\leadsto \color{blue}{-\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}} \]
      11. sqrt-div9.6%

        \[\leadsto -\color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}} \cdot \sqrt{\frac{d}{h}} \]
      12. sqrt-div9.7%

        \[\leadsto -\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \]
      13. times-frac9.7%

        \[\leadsto -\color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      14. add-sqr-sqrt9.7%

        \[\leadsto -\frac{\color{blue}{d}}{\sqrt{\ell} \cdot \sqrt{h}} \]
      15. sqrt-prod33.0%

        \[\leadsto -\frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \]
      16. neg-sub033.0%

        \[\leadsto \color{blue}{0 - \frac{d}{\sqrt{\ell \cdot h}}} \]
    12. Applied egg-rr33.0%

      \[\leadsto \color{blue}{0 - \frac{d}{\sqrt{\ell \cdot h}}} \]
    13. Step-by-step derivation
      1. neg-sub033.0%

        \[\leadsto \color{blue}{-\frac{d}{\sqrt{\ell \cdot h}}} \]
      2. distribute-frac-neg233.0%

        \[\leadsto \color{blue}{\frac{d}{-\sqrt{\ell \cdot h}}} \]
    14. Simplified33.0%

      \[\leadsto \color{blue}{\frac{d}{-\sqrt{\ell \cdot h}}} \]

    if 7.10000000000000019e-168 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 52.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity52.7%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/252.7%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow52.7%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow52.7%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval52.7%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr52.7%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity52.7%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified52.7%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval52.7%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval52.7%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow52.7%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow52.7%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow46.7%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt46.7%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod40.2%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr39.2%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow239.2%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow39.6%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow141.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv42.0%

        \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \]
      17. associate-/r*42.1%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{h}}{\ell}}} \]
    10. Applied egg-rr60.9%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification50.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.4 \cdot 10^{-214}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{elif}\;\ell \leq -8.5 \cdot 10^{-301}:\\ \;\;\;\;d \cdot \sqrt[3]{{\left(h \cdot \ell\right)}^{-1.5}}\\ \mathbf{elif}\;\ell \leq 7.1 \cdot 10^{-168}:\\ \;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 23: 42.9% accurate, 1.6× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 5.6 \cdot 10^{-167}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (if (<= l 5.6e-167)
   (* (- d) (sqrt (/ (/ 1.0 l) h)))
   (/ (/ d (sqrt h)) (sqrt l))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (l <= 5.6e-167) {
		tmp = -d * sqrt(((1.0 / l) / h));
	} else {
		tmp = (d / sqrt(h)) / sqrt(l);
	}
	return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
    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_m
    real(8) :: tmp
    if (l <= 5.6d-167) then
        tmp = -d * sqrt(((1.0d0 / l) / h))
    else
        tmp = (d / sqrt(h)) / sqrt(l)
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (l <= 5.6e-167) {
		tmp = -d * Math.sqrt(((1.0 / l) / h));
	} else {
		tmp = (d / Math.sqrt(h)) / Math.sqrt(l);
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	tmp = 0
	if l <= 5.6e-167:
		tmp = -d * math.sqrt(((1.0 / l) / h))
	else:
		tmp = (d / math.sqrt(h)) / math.sqrt(l)
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	tmp = 0.0
	if (l <= 5.6e-167)
		tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h)));
	else
		tmp = Float64(Float64(d / sqrt(h)) / sqrt(l));
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	tmp = 0.0;
	if (l <= 5.6e-167)
		tmp = -d * sqrt(((1.0 / l) / h));
	else
		tmp = (d / sqrt(h)) / sqrt(l);
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 5.6e-167], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.6 \cdot 10^{-167}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 5.59999999999999971e-167

    1. Initial program 67.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified67.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 12.0%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Taylor expanded in h around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. associate-*l*0.0%

        \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. unpow20.0%

        \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      3. rem-square-sqrt37.9%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. neg-mul-137.9%

        \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      5. *-commutative37.9%

        \[\leadsto d \cdot \left(-\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \]
      6. associate-/r*38.0%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]
    7. Simplified38.0%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]

    if 5.59999999999999971e-167 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 52.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity52.7%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/252.7%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow52.7%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow52.7%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval52.7%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr52.7%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity52.7%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified52.7%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval52.7%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval52.7%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow52.7%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow52.7%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow46.7%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt46.7%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod40.2%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr39.2%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow239.2%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow39.6%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval41.9%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow141.9%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv42.0%

        \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \]
      17. associate-/r*42.1%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{h}}{\ell}}} \]
    10. Applied egg-rr60.9%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification47.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 5.6 \cdot 10^{-167}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 24: 42.1% accurate, 1.6× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;M \leq 2.5 \cdot 10^{+18}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (if (<= M 2.5e+18)
   (fabs (/ d (sqrt (* h l))))
   (* (- d) (sqrt (/ (/ 1.0 l) h)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (M <= 2.5e+18) {
		tmp = fabs((d / sqrt((h * l))));
	} else {
		tmp = -d * sqrt(((1.0 / l) / h));
	}
	return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
    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_m
    real(8) :: tmp
    if (m <= 2.5d+18) then
        tmp = abs((d / sqrt((h * l))))
    else
        tmp = -d * sqrt(((1.0d0 / l) / h))
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (M <= 2.5e+18) {
		tmp = Math.abs((d / Math.sqrt((h * l))));
	} else {
		tmp = -d * Math.sqrt(((1.0 / l) / h));
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	tmp = 0
	if M <= 2.5e+18:
		tmp = math.fabs((d / math.sqrt((h * l))))
	else:
		tmp = -d * math.sqrt(((1.0 / l) / h))
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	tmp = 0.0
	if (M <= 2.5e+18)
		tmp = abs(Float64(d / sqrt(Float64(h * l))));
	else
		tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h)));
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	tmp = 0.0;
	if (M <= 2.5e+18)
		tmp = abs((d / sqrt((h * l))));
	else
		tmp = -d * sqrt(((1.0 / l) / h));
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[M, 2.5e+18], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.5 \cdot 10^{+18}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\

\mathbf{else}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 2.5e18

    1. Initial program 68.5%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified66.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 33.4%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity33.4%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/233.4%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow33.4%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow33.5%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval33.5%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr33.5%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity33.5%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified33.5%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval33.5%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval33.5%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow33.4%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow33.4%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow31.9%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt26.1%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod29.5%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr27.6%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow227.6%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow27.8%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow31.7%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr31.8%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval31.8%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval31.8%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow131.8%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv31.8%

        \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \]
      17. associate-/r*33.8%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{{d}^{2}}{h}}{\ell}}} \]
      18. add-sqr-sqrt33.8%

        \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{\frac{{d}^{2}}{h}}{\ell}} \cdot \sqrt{\frac{\frac{{d}^{2}}{h}}{\ell}}}} \]
    10. Applied egg-rr47.9%

      \[\leadsto \color{blue}{\left|\frac{d}{\sqrt{\ell \cdot h}}\right|} \]

    if 2.5e18 < M

    1. Initial program 69.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified70.0%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 12.0%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Taylor expanded in h around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. associate-*l*0.0%

        \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. unpow20.0%

        \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      3. rem-square-sqrt25.0%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. neg-mul-125.0%

        \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      5. *-commutative25.0%

        \[\leadsto d \cdot \left(-\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \]
      6. associate-/r*25.0%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]
    7. Simplified25.0%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification42.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 2.5 \cdot 10^{+18}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 25: 41.0% accurate, 2.9× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 7.8 \cdot 10^{-168}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{\ell} \cdot \frac{1}{h}}\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (if (<= l 7.8e-168)
   (* (- d) (sqrt (/ (/ 1.0 l) h)))
   (* d (sqrt (* (/ 1.0 l) (/ 1.0 h))))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (l <= 7.8e-168) {
		tmp = -d * sqrt(((1.0 / l) / h));
	} else {
		tmp = d * sqrt(((1.0 / l) * (1.0 / h)));
	}
	return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
    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_m
    real(8) :: tmp
    if (l <= 7.8d-168) then
        tmp = -d * sqrt(((1.0d0 / l) / h))
    else
        tmp = d * sqrt(((1.0d0 / l) * (1.0d0 / h)))
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (l <= 7.8e-168) {
		tmp = -d * Math.sqrt(((1.0 / l) / h));
	} else {
		tmp = d * Math.sqrt(((1.0 / l) * (1.0 / h)));
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	tmp = 0
	if l <= 7.8e-168:
		tmp = -d * math.sqrt(((1.0 / l) / h))
	else:
		tmp = d * math.sqrt(((1.0 / l) * (1.0 / h)))
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	tmp = 0.0
	if (l <= 7.8e-168)
		tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h)));
	else
		tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) * Float64(1.0 / h))));
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	tmp = 0.0;
	if (l <= 7.8e-168)
		tmp = -d * sqrt(((1.0 / l) / h));
	else
		tmp = d * sqrt(((1.0 / l) * (1.0 / h)));
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 7.8e-168], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] * N[(1.0 / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 7.8 \cdot 10^{-168}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell} \cdot \frac{1}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 7.80000000000000025e-168

    1. Initial program 67.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified67.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 12.0%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Taylor expanded in h around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. associate-*l*0.0%

        \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. unpow20.0%

        \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      3. rem-square-sqrt37.9%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. neg-mul-137.9%

        \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      5. *-commutative37.9%

        \[\leadsto d \cdot \left(-\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \]
      6. associate-/r*38.0%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]
    7. Simplified38.0%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]

    if 7.80000000000000025e-168 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 52.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. inv-pow52.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}} \]
      2. *-commutative52.7%

        \[\leadsto d \cdot \sqrt{{\color{blue}{\left(\ell \cdot h\right)}}^{-1}} \]
      3. unpow-prod-down53.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{{\ell}^{-1} \cdot {h}^{-1}}} \]
      4. inv-pow53.9%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{\ell}} \cdot {h}^{-1}} \]
      5. inv-pow53.9%

        \[\leadsto d \cdot \sqrt{\frac{1}{\ell} \cdot \color{blue}{\frac{1}{h}}} \]
    6. Applied egg-rr53.9%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{\ell} \cdot \frac{1}{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 7.8 \cdot 10^{-168}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{\ell} \cdot \frac{1}{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 26: 41.0% accurate, 2.9× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{if}\;\ell \leq 7.1 \cdot 10^{-168}:\\ \;\;\;\;\left(-d\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;d \cdot t\_0\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (let* ((t_0 (sqrt (/ (/ 1.0 l) h))))
   (if (<= l 7.1e-168) (* (- d) t_0) (* d t_0))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double t_0 = sqrt(((1.0 / l) / h));
	double tmp;
	if (l <= 7.1e-168) {
		tmp = -d * t_0;
	} else {
		tmp = d * t_0;
	}
	return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
    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_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt(((1.0d0 / l) / h))
    if (l <= 7.1d-168) then
        tmp = -d * t_0
    else
        tmp = d * t_0
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double t_0 = Math.sqrt(((1.0 / l) / h));
	double tmp;
	if (l <= 7.1e-168) {
		tmp = -d * t_0;
	} else {
		tmp = d * t_0;
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	t_0 = math.sqrt(((1.0 / l) / h))
	tmp = 0
	if l <= 7.1e-168:
		tmp = -d * t_0
	else:
		tmp = d * t_0
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	t_0 = sqrt(Float64(Float64(1.0 / l) / h))
	tmp = 0.0
	if (l <= 7.1e-168)
		tmp = Float64(Float64(-d) * t_0);
	else
		tmp = Float64(d * t_0);
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	t_0 = sqrt(((1.0 / l) / h));
	tmp = 0.0;
	if (l <= 7.1e-168)
		tmp = -d * t_0;
	else
		tmp = d * t_0;
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 7.1e-168], N[((-d) * t$95$0), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{if}\;\ell \leq 7.1 \cdot 10^{-168}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 7.10000000000000019e-168

    1. Initial program 67.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified67.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 12.0%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Taylor expanded in h around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. associate-*l*0.0%

        \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. unpow20.0%

        \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      3. rem-square-sqrt37.9%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. neg-mul-137.9%

        \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      5. *-commutative37.9%

        \[\leadsto d \cdot \left(-\sqrt{\frac{1}{\color{blue}{\ell \cdot h}}}\right) \]
      6. associate-/r*38.0%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}\right) \]
    7. Simplified38.0%

      \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)} \]

    if 7.10000000000000019e-168 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 52.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity52.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{1 \cdot \frac{1}{h \cdot \ell}}} \]
    6. Applied egg-rr52.7%

      \[\leadsto d \cdot \sqrt{\color{blue}{1 \cdot \frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-lft-identity52.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative52.7%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      3. associate-/r*53.8%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    8. Simplified53.8%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 7.1 \cdot 10^{-168}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 27: 40.9% accurate, 3.0× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 7.2 \cdot 10^{-168}:\\ \;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (if (<= l 7.2e-168)
   (* (- d) (pow (* h l) -0.5))
   (* d (sqrt (/ (/ 1.0 l) h)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (l <= 7.2e-168) {
		tmp = -d * pow((h * l), -0.5);
	} else {
		tmp = d * sqrt(((1.0 / l) / h));
	}
	return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
    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_m
    real(8) :: tmp
    if (l <= 7.2d-168) then
        tmp = -d * ((h * l) ** (-0.5d0))
    else
        tmp = d * sqrt(((1.0d0 / l) / h))
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (l <= 7.2e-168) {
		tmp = -d * Math.pow((h * l), -0.5);
	} else {
		tmp = d * Math.sqrt(((1.0 / l) / h));
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	tmp = 0
	if l <= 7.2e-168:
		tmp = -d * math.pow((h * l), -0.5)
	else:
		tmp = d * math.sqrt(((1.0 / l) / h))
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	tmp = 0.0
	if (l <= 7.2e-168)
		tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5));
	else
		tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h)));
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	tmp = 0.0;
	if (l <= 7.2e-168)
		tmp = -d * ((h * l) ^ -0.5);
	else
		tmp = d * sqrt(((1.0 / l) / h));
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 7.2e-168], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 7.2 \cdot 10^{-168}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 7.1999999999999998e-168

    1. Initial program 67.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified67.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 12.0%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Taylor expanded in h around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. associate-*l*0.0%

        \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. unpow20.0%

        \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      3. rem-square-sqrt37.9%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. neg-mul-137.9%

        \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      5. unpow-137.9%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      6. metadata-eval37.9%

        \[\leadsto d \cdot \left(-\sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \]
      7. pow-sqr37.9%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
      8. rem-sqrt-square37.9%

        \[\leadsto d \cdot \left(-\color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \]
      9. rem-square-sqrt37.7%

        \[\leadsto d \cdot \left(-\left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right|\right) \]
      10. fabs-sqr37.7%

        \[\leadsto d \cdot \left(-\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
      11. rem-square-sqrt37.9%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}}\right) \]
    7. Simplified37.9%

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]

    if 7.1999999999999998e-168 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 52.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity52.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{1 \cdot \frac{1}{h \cdot \ell}}} \]
    6. Applied egg-rr52.7%

      \[\leadsto d \cdot \sqrt{\color{blue}{1 \cdot \frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. *-lft-identity52.7%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
      2. *-commutative52.7%

        \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      3. associate-/r*53.8%

        \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
    8. Simplified53.8%

      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 7.2 \cdot 10^{-168}:\\ \;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 28: 40.8% accurate, 3.0× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := {\left(h \cdot \ell\right)}^{-0.5}\\ \mathbf{if}\;\ell \leq 7.8 \cdot 10^{-168}:\\ \;\;\;\;\left(-d\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;d \cdot t\_0\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (let* ((t_0 (pow (* h l) -0.5)))
   (if (<= l 7.8e-168) (* (- d) t_0) (* d t_0))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double t_0 = pow((h * l), -0.5);
	double tmp;
	if (l <= 7.8e-168) {
		tmp = -d * t_0;
	} else {
		tmp = d * t_0;
	}
	return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
    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_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (h * l) ** (-0.5d0)
    if (l <= 7.8d-168) then
        tmp = -d * t_0
    else
        tmp = d * t_0
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double t_0 = Math.pow((h * l), -0.5);
	double tmp;
	if (l <= 7.8e-168) {
		tmp = -d * t_0;
	} else {
		tmp = d * t_0;
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	t_0 = math.pow((h * l), -0.5)
	tmp = 0
	if l <= 7.8e-168:
		tmp = -d * t_0
	else:
		tmp = d * t_0
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	t_0 = Float64(h * l) ^ -0.5
	tmp = 0.0
	if (l <= 7.8e-168)
		tmp = Float64(Float64(-d) * t_0);
	else
		tmp = Float64(d * t_0);
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	t_0 = (h * l) ^ -0.5;
	tmp = 0.0;
	if (l <= 7.8e-168)
		tmp = -d * t_0;
	else
		tmp = d * t_0;
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, 7.8e-168], N[((-d) * t$95$0), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq 7.8 \cdot 10^{-168}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 7.80000000000000025e-168

    1. Initial program 67.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified67.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 12.0%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Taylor expanded in h around -inf 0.0%

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    6. Step-by-step derivation
      1. associate-*l*0.0%

        \[\leadsto \color{blue}{d \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. unpow20.0%

        \[\leadsto d \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      3. rem-square-sqrt37.9%

        \[\leadsto d \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      4. neg-mul-137.9%

        \[\leadsto d \cdot \color{blue}{\left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      5. unpow-137.9%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      6. metadata-eval37.9%

        \[\leadsto d \cdot \left(-\sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \]
      7. pow-sqr37.9%

        \[\leadsto d \cdot \left(-\sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
      8. rem-sqrt-square37.9%

        \[\leadsto d \cdot \left(-\color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \]
      9. rem-square-sqrt37.7%

        \[\leadsto d \cdot \left(-\left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right|\right) \]
      10. fabs-sqr37.7%

        \[\leadsto d \cdot \left(-\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
      11. rem-square-sqrt37.9%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(h \cdot \ell\right)}^{-0.5}}\right) \]
    7. Simplified37.9%

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]

    if 7.80000000000000025e-168 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 52.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity52.7%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/252.7%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow52.7%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow52.7%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval52.7%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr52.7%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity52.7%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified52.7%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification43.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 7.8 \cdot 10^{-168}:\\ \;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 29: 40.8% accurate, 3.0× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 1.15 \cdot 10^{-167}:\\ \;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (if (<= l 1.15e-167) (/ d (- (sqrt (* h l)))) (* d (pow (* h l) -0.5))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (l <= 1.15e-167) {
		tmp = d / -sqrt((h * l));
	} else {
		tmp = d * pow((h * l), -0.5);
	}
	return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
    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_m
    real(8) :: tmp
    if (l <= 1.15d-167) then
        tmp = d / -sqrt((h * l))
    else
        tmp = d * ((h * l) ** (-0.5d0))
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (l <= 1.15e-167) {
		tmp = d / -Math.sqrt((h * l));
	} else {
		tmp = d * Math.pow((h * l), -0.5);
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	tmp = 0
	if l <= 1.15e-167:
		tmp = d / -math.sqrt((h * l))
	else:
		tmp = d * math.pow((h * l), -0.5)
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	tmp = 0.0
	if (l <= 1.15e-167)
		tmp = Float64(d / Float64(-sqrt(Float64(h * l))));
	else
		tmp = Float64(d * (Float64(h * l) ^ -0.5));
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	tmp = 0.0;
	if (l <= 1.15e-167)
		tmp = d / -sqrt((h * l));
	else
		tmp = d * ((h * l) ^ -0.5);
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 1.15e-167], N[(d / (-N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.15 \cdot 10^{-167}:\\
\;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 1.1500000000000001e-167

    1. Initial program 67.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified67.1%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 12.0%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity12.0%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/212.0%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow12.0%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow12.0%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval12.0%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr12.0%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity12.0%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified12.0%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. Step-by-step derivation
      1. metadata-eval12.0%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
      2. metadata-eval12.0%

        \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
      3. pow-pow12.0%

        \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. inv-pow12.0%

        \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. pow-pow13.8%

        \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      6. add-sqr-sqrt4.5%

        \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
      7. sqrt-unprod17.5%

        \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      8. swap-sqr15.7%

        \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
      9. unpow215.7%

        \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      10. pow-pow15.8%

        \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
      11. pow-pow19.5%

        \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
      12. pow-sqr19.5%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
      13. metadata-eval19.5%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
      14. metadata-eval19.5%

        \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
      15. pow119.5%

        \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
      16. div-inv19.5%

        \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \]
      17. sqrt-div22.6%

        \[\leadsto \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}} \]
    10. Applied egg-rr12.0%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    11. Step-by-step derivation
      1. sqrt-prod2.7%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      2. add-sqr-sqrt2.7%

        \[\leadsto \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{\ell} \cdot \sqrt{h}} \]
      3. times-frac2.7%

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}} \]
      4. sqrt-div2.1%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \frac{\sqrt{d}}{\sqrt{h}} \]
      5. sqrt-div32.0%

        \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}} \]
      6. add-sqr-sqrt32.0%

        \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{\ell}}}} \cdot \sqrt{\frac{d}{h}} \]
      7. sqr-neg32.0%

        \[\leadsto \sqrt{\color{blue}{\left(-\sqrt{\frac{d}{\ell}}\right) \cdot \left(-\sqrt{\frac{d}{\ell}}\right)}} \cdot \sqrt{\frac{d}{h}} \]
      8. sqrt-unprod2.2%

        \[\leadsto \color{blue}{\left(\sqrt{-\sqrt{\frac{d}{\ell}}} \cdot \sqrt{-\sqrt{\frac{d}{\ell}}}\right)} \cdot \sqrt{\frac{d}{h}} \]
      9. add-sqr-sqrt11.1%

        \[\leadsto \color{blue}{\left(-\sqrt{\frac{d}{\ell}}\right)} \cdot \sqrt{\frac{d}{h}} \]
      10. distribute-lft-neg-out11.1%

        \[\leadsto \color{blue}{-\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}} \]
      11. sqrt-div1.8%

        \[\leadsto -\color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}} \cdot \sqrt{\frac{d}{h}} \]
      12. sqrt-div1.8%

        \[\leadsto -\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \]
      13. times-frac1.8%

        \[\leadsto -\color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}} \]
      14. add-sqr-sqrt1.8%

        \[\leadsto -\frac{\color{blue}{d}}{\sqrt{\ell} \cdot \sqrt{h}} \]
      15. sqrt-prod37.8%

        \[\leadsto -\frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \]
      16. neg-sub037.8%

        \[\leadsto \color{blue}{0 - \frac{d}{\sqrt{\ell \cdot h}}} \]
    12. Applied egg-rr37.8%

      \[\leadsto \color{blue}{0 - \frac{d}{\sqrt{\ell \cdot h}}} \]
    13. Step-by-step derivation
      1. neg-sub037.8%

        \[\leadsto \color{blue}{-\frac{d}{\sqrt{\ell \cdot h}}} \]
      2. distribute-frac-neg237.8%

        \[\leadsto \color{blue}{\frac{d}{-\sqrt{\ell \cdot h}}} \]
    14. Simplified37.8%

      \[\leadsto \color{blue}{\frac{d}{-\sqrt{\ell \cdot h}}} \]

    if 1.1500000000000001e-167 < l

    1. Initial program 70.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.4%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in d around inf 52.7%

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity52.7%

        \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      2. pow1/252.7%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      3. inv-pow52.7%

        \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
      4. pow-pow52.7%

        \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
      5. metadata-eval52.7%

        \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
    6. Applied egg-rr52.7%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity52.7%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified52.7%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification43.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 1.15 \cdot 10^{-167}:\\ \;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 30: 26.3% accurate, 3.2× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \frac{d}{\sqrt{h \cdot \ell}} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m) :precision binary64 (/ d (sqrt (* h l))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	return d / sqrt((h * l));
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
    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_m
    code = d / sqrt((h * l))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	return d / Math.sqrt((h * l));
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	return d / math.sqrt((h * l))
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	return Float64(d / sqrt(Float64(h * l)))
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
	tmp = d / sqrt((h * l));
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Derivation
  1. Initial program 68.8%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified67.6%

    \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in d around inf 28.5%

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  5. Step-by-step derivation
    1. *-un-lft-identity28.5%

      \[\leadsto d \cdot \color{blue}{\left(1 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    2. pow1/228.5%

      \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
    3. inv-pow28.5%

      \[\leadsto d \cdot \left(1 \cdot {\color{blue}{\left({\left(h \cdot \ell\right)}^{-1}\right)}}^{0.5}\right) \]
    4. pow-pow28.5%

      \[\leadsto d \cdot \left(1 \cdot \color{blue}{{\left(h \cdot \ell\right)}^{\left(-1 \cdot 0.5\right)}}\right) \]
    5. metadata-eval28.5%

      \[\leadsto d \cdot \left(1 \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \]
  6. Applied egg-rr28.5%

    \[\leadsto d \cdot \color{blue}{\left(1 \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)} \]
  7. Step-by-step derivation
    1. *-lft-identity28.5%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  8. Simplified28.5%

    \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  9. Step-by-step derivation
    1. metadata-eval28.5%

      \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(-1 \cdot 0.5\right)}} \]
    2. metadata-eval28.5%

      \[\leadsto d \cdot {\left(h \cdot \ell\right)}^{\left(-1 \cdot \color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}\right)} \]
    3. pow-pow28.5%

      \[\leadsto d \cdot \color{blue}{{\left({\left(h \cdot \ell\right)}^{-1}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
    4. inv-pow28.5%

      \[\leadsto d \cdot {\color{blue}{\left(\frac{1}{h \cdot \ell}\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
    5. pow-pow27.2%

      \[\leadsto d \cdot \color{blue}{{\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
    6. add-sqr-sqrt21.7%

      \[\leadsto \color{blue}{\sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \cdot \sqrt{d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}}} \]
    7. sqrt-unprod26.7%

      \[\leadsto \color{blue}{\sqrt{\left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right) \cdot \left(d \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
    8. swap-sqr25.2%

      \[\leadsto \sqrt{\color{blue}{\left(d \cdot d\right) \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)}} \]
    9. unpow225.2%

      \[\leadsto \sqrt{\color{blue}{{d}^{2}} \cdot \left({\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
    10. pow-pow25.4%

      \[\leadsto \sqrt{{d}^{2} \cdot \left(\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \cdot {\left({\left(\frac{1}{h \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}\right)} \]
    11. pow-pow28.6%

      \[\leadsto \sqrt{{d}^{2} \cdot \left({\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} \]
    12. pow-sqr28.6%

      \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \left(1.5 \cdot 0.3333333333333333\right)\right)}}} \]
    13. metadata-eval28.6%

      \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\left(2 \cdot \color{blue}{0.5}\right)}} \]
    14. metadata-eval28.6%

      \[\leadsto \sqrt{{d}^{2} \cdot {\left(\frac{1}{h \cdot \ell}\right)}^{\color{blue}{1}}} \]
    15. pow128.6%

      \[\leadsto \sqrt{{d}^{2} \cdot \color{blue}{\frac{1}{h \cdot \ell}}} \]
    16. div-inv28.6%

      \[\leadsto \sqrt{\color{blue}{\frac{{d}^{2}}{h \cdot \ell}}} \]
    17. sqrt-div31.2%

      \[\leadsto \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h \cdot \ell}}} \]
  10. Applied egg-rr28.5%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
  11. Final simplification28.5%

    \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
  12. Add Preprocessing

Reproduce

?
herbie shell --seed 2024143 
(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)))))