Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.0% → 80.9%
Time: 23.2s
Alternatives: 15
Speedup: 0.8×

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 15 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: 66.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: 80.9% 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}\;\ell \leq -2.6 \cdot 10^{-234}:\\ \;\;\;\;\frac{t\_1}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t\_0\right)\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \frac{t\_1}{\sqrt{-\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\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 (- 1.0 (* h (* 0.125 (/ (pow (* M (/ D_m d)) 2.0) l)))))
        (t_1 (sqrt (- d))))
   (if (<= l -2.6e-234)
     (* (/ t_1 (sqrt (- h))) (* (sqrt (/ d l)) t_0))
     (if (<= l -5e-310)
       (* (sqrt (/ d h)) (* t_0 (/ t_1 (sqrt (- l)))))
       (*
        (/ (sqrt d) (sqrt l))
        (*
         (/ (sqrt d) (sqrt h))
         (+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -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 = 1.0 - (h * (0.125 * (pow((M * (D_m / d)), 2.0) / l)));
	double t_1 = sqrt(-d);
	double tmp;
	if (l <= -2.6e-234) {
		tmp = (t_1 / sqrt(-h)) * (sqrt((d / l)) * t_0);
	} else if (l <= -5e-310) {
		tmp = sqrt((d / h)) * (t_0 * (t_1 / sqrt(-l)));
	} else {
		tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * (1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -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 = 1.0d0 - (h * (0.125d0 * (((m * (d_m / d)) ** 2.0d0) / l)))
    t_1 = sqrt(-d)
    if (l <= (-2.6d-234)) then
        tmp = (t_1 / sqrt(-h)) * (sqrt((d / l)) * t_0)
    else if (l <= (-5d-310)) then
        tmp = sqrt((d / h)) * (t_0 * (t_1 / sqrt(-l)))
    else
        tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * (1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-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 = 1.0 - (h * (0.125 * (Math.pow((M * (D_m / d)), 2.0) / l)));
	double t_1 = Math.sqrt(-d);
	double tmp;
	if (l <= -2.6e-234) {
		tmp = (t_1 / Math.sqrt(-h)) * (Math.sqrt((d / l)) * t_0);
	} else if (l <= -5e-310) {
		tmp = Math.sqrt((d / h)) * (t_0 * (t_1 / Math.sqrt(-l)));
	} else {
		tmp = (Math.sqrt(d) / Math.sqrt(l)) * ((Math.sqrt(d) / Math.sqrt(h)) * (1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -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 = 1.0 - (h * (0.125 * (math.pow((M * (D_m / d)), 2.0) / l)))
	t_1 = math.sqrt(-d)
	tmp = 0
	if l <= -2.6e-234:
		tmp = (t_1 / math.sqrt(-h)) * (math.sqrt((d / l)) * t_0)
	elif l <= -5e-310:
		tmp = math.sqrt((d / h)) * (t_0 * (t_1 / math.sqrt(-l)))
	else:
		tmp = (math.sqrt(d) / math.sqrt(l)) * ((math.sqrt(d) / math.sqrt(h)) * (1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -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(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 (l <= -2.6e-234)
		tmp = Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * t_0));
	elseif (l <= -5e-310)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(t_1 / sqrt(Float64(-l)))));
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(Float64(sqrt(d) / sqrt(h)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -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 = 1.0 - (h * (0.125 * (((M * (D_m / d)) ^ 2.0) / l)));
	t_1 = sqrt(-d);
	tmp = 0.0;
	if (l <= -2.6e-234)
		tmp = (t_1 / sqrt(-h)) * (sqrt((d / l)) * t_0);
	elseif (l <= -5e-310)
		tmp = sqrt((d / h)) * (t_0 * (t_1 / sqrt(-l)));
	else
		tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * (1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -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[(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[l, -2.6e-234], 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[l, -5e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $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 := 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}\;\ell \leq -2.6 \cdot 10^{-234}:\\
\;\;\;\;\frac{t\_1}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t\_0\right)\\

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

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


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

    1. Initial program 68.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. Simplified67.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 h around -inf 42.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*42.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-142.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-neg42.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-in42.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. Simplified70.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{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) + 1\right)}\right) \]
    7. Step-by-step derivation
      1. frac-2neg70.3%

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

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

      \[\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 -2.59999999999999989e-234 < l < -4.999999999999985e-310

    1. Initial program 67.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. Simplified61.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 41.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*41.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-141.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-neg41.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-in41.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. Simplified62.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. frac-2neg62.0%

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

        \[\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) \]
    8. Applied egg-rr93.1%

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

    if -4.999999999999985e-310 < l

    1. Initial program 60.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. Simplified61.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. sqrt-div71.3%

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{\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) \]
    5. Applied egg-rr71.3%

      \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{\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) \]
    6. Step-by-step derivation
      1. sqrt-div84.4%

        \[\leadsto \frac{\sqrt{d}}{\sqrt{\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) \]
    7. Applied egg-rr84.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.6 \cdot 10^{-234}:\\ \;\;\;\;\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}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{d}{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)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\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)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 70.2% accurate, 0.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 := \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)\\ t_1 := {\left(D\_m \cdot \frac{M}{d}\right)}^{2}\\ \mathbf{if}\;t\_0 \leq 4 \cdot 10^{+201}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - h \cdot \left(0.125 \cdot \frac{t\_1}{\ell}\right)\right)\right)\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;d \cdot \left(\frac{h + \sqrt{\frac{h}{\ell}}}{h} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{t\_1 \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{\sqrt{\ell \cdot 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
         (*
          (* (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))))))
        (t_1 (pow (* D_m (/ M d)) 2.0)))
   (if (<= t_0 4e+201)
     (* (sqrt (/ d h)) (* (sqrt (/ d l)) (- 1.0 (* h (* 0.125 (/ t_1 l))))))
     (if (<= t_0 INFINITY)
       (* d (+ (/ (+ h (sqrt (/ h l))) h) -1.0))
       (* d (/ (* t_1 (* (/ h l) -0.125)) (sqrt (* 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 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 t_1 = pow((D_m * (M / d)), 2.0);
	double tmp;
	if (t_0 <= 4e+201) {
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (h * (0.125 * (t_1 / l)))));
	} else if (t_0 <= ((double) INFINITY)) {
		tmp = d * (((h + sqrt((h / l))) / h) + -1.0);
	} else {
		tmp = d * ((t_1 * ((h / l) * -0.125)) / sqrt((l * h)));
	}
	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 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 t_1 = Math.pow((D_m * (M / d)), 2.0);
	double tmp;
	if (t_0 <= 4e+201) {
		tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (h * (0.125 * (t_1 / l)))));
	} else if (t_0 <= Double.POSITIVE_INFINITY) {
		tmp = d * (((h + Math.sqrt((h / l))) / h) + -1.0);
	} else {
		tmp = d * ((t_1 * ((h / l) * -0.125)) / Math.sqrt((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):
	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))))
	t_1 = math.pow((D_m * (M / d)), 2.0)
	tmp = 0
	if t_0 <= 4e+201:
		tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (h * (0.125 * (t_1 / l)))))
	elif t_0 <= math.inf:
		tmp = d * (((h + math.sqrt((h / l))) / h) + -1.0)
	else:
		tmp = d * ((t_1 * ((h / l) * -0.125)) / math.sqrt((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)
	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)))))
	t_1 = Float64(D_m * Float64(M / d)) ^ 2.0
	tmp = 0.0
	if (t_0 <= 4e+201)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_1 / l))))));
	elseif (t_0 <= Inf)
		tmp = Float64(d * Float64(Float64(Float64(h + sqrt(Float64(h / l))) / h) + -1.0));
	else
		tmp = Float64(d * Float64(Float64(t_1 * Float64(Float64(h / l) * -0.125)) / sqrt(Float64(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)
	t_0 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D_m) / (d * 2.0)) ^ 2.0))));
	t_1 = (D_m * (M / d)) ^ 2.0;
	tmp = 0.0;
	if (t_0 <= 4e+201)
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (h * (0.125 * (t_1 / l)))));
	elseif (t_0 <= Inf)
		tmp = d * (((h + sqrt((h / l))) / h) + -1.0);
	else
		tmp = d * ((t_1 * ((h / l) * -0.125)) / sqrt((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_] := 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]}, Block[{t$95$1 = N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$0, 4e+201], 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$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(d * N[(N[(N[(h + N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(t$95$1 * N[(N[(h / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * 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 := \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)\\
t_1 := {\left(D\_m \cdot \frac{M}{d}\right)}^{2}\\
\mathbf{if}\;t\_0 \leq 4 \cdot 10^{+201}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - h \cdot \left(0.125 \cdot \frac{t\_1}{\ell}\right)\right)\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 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.00000000000000015e201

    1. Initial program 86.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. Simplified86.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 54.1%

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

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

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

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

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

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

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

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

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

    if 4.00000000000000015e201 < (*.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)))) < +inf.0

    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.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 57.1%

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

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

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

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

        \[\leadsto d \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}}\right)} - 1\right) \]
      5. metadata-eval51.9%

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

      \[\leadsto d \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({\left(h \cdot \ell\right)}^{-0.5}\right)} - 1\right)} \]
    7. Taylor expanded in h around 0 86.0%

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

    if +inf.0 < (*.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 0.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified0.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 M around inf 5.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{d \cdot \frac{{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{\sqrt{h \cdot \ell}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification71.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 4 \cdot 10^{+201}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - h \cdot \left(0.125 \cdot \frac{{\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}\right)\right)\right)\\ \mathbf{elif}\;\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 \infty:\\ \;\;\;\;d \cdot \left(\frac{h + \sqrt{\frac{h}{\ell}}}{h} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{\sqrt{\ell \cdot h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 76.7% 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 := 1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D\_m}{d}\right)}^{2}}{\ell}\right)\\ \mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t\_0 \cdot t\_1\right)\\ \mathbf{elif}\;h \leq 5.3 \cdot 10^{+73}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\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)\\ \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 (- 1.0 (* h (* 0.125 (/ (pow (* M (/ D_m d)) 2.0) l))))))
   (if (<= h -5e-310)
     (* (/ (sqrt (- d)) (sqrt (- h))) (* t_0 t_1))
     (if (<= h 5.3e+73)
       (* (sqrt (/ d h)) (* t_1 (/ (sqrt d) (sqrt l))))
       (*
        (* t_0 (/ (sqrt d) (sqrt h)))
        (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.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((d / l));
	double t_1 = 1.0 - (h * (0.125 * (pow((M * (D_m / d)), 2.0) / l)));
	double tmp;
	if (h <= -5e-310) {
		tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * t_1);
	} else if (h <= 5.3e+73) {
		tmp = sqrt((d / h)) * (t_1 * (sqrt(d) / sqrt(l)));
	} else {
		tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.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) :: t_1
    real(8) :: tmp
    t_0 = sqrt((d / l))
    t_1 = 1.0d0 - (h * (0.125d0 * (((m * (d_m / d)) ** 2.0d0) / l)))
    if (h <= (-5d-310)) then
        tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * t_1)
    else if (h <= 5.3d+73) then
        tmp = sqrt((d / h)) * (t_1 * (sqrt(d) / sqrt(l)))
    else
        tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))))
    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 = 1.0 - (h * (0.125 * (Math.pow((M * (D_m / d)), 2.0) / l)));
	double tmp;
	if (h <= -5e-310) {
		tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_0 * t_1);
	} else if (h <= 5.3e+73) {
		tmp = Math.sqrt((d / h)) * (t_1 * (Math.sqrt(d) / Math.sqrt(l)));
	} else {
		tmp = (t_0 * (Math.sqrt(d) / Math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.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((d / l))
	t_1 = 1.0 - (h * (0.125 * (math.pow((M * (D_m / d)), 2.0) / l)))
	tmp = 0
	if h <= -5e-310:
		tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_0 * t_1)
	elif h <= 5.3e+73:
		tmp = math.sqrt((d / h)) * (t_1 * (math.sqrt(d) / math.sqrt(l)))
	else:
		tmp = (t_0 * (math.sqrt(d) / math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.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(d / l))
	t_1 = Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(M * Float64(D_m / d)) ^ 2.0) / l))))
	tmp = 0.0
	if (h <= -5e-310)
		tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_0 * t_1));
	elseif (h <= 5.3e+73)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(t_1 * Float64(sqrt(d) / sqrt(l))));
	else
		tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.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((d / l));
	t_1 = 1.0 - (h * (0.125 * (((M * (D_m / d)) ^ 2.0) / l)));
	tmp = 0.0;
	if (h <= -5e-310)
		tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * t_1);
	elseif (h <= 5.3e+73)
		tmp = sqrt((d / h)) * (t_1 * (sqrt(d) / sqrt(l)));
	else
		tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.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[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[h, -5e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5.3e+73], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $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 := 1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D\_m}{d}\right)}^{2}}{\ell}\right)\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t\_0 \cdot t\_1\right)\\

\mathbf{elif}\;h \leq 5.3 \cdot 10^{+73}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\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)\\


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

    1. Initial program 68.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. Simplified66.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 42.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*42.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-142.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-neg42.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-in42.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. Simplified69.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{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) + 1\right)}\right) \]
    7. Step-by-step derivation
      1. frac-2neg69.3%

        \[\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-div79.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) \]
    8. Applied egg-rr79.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) \]

    if -4.999999999999985e-310 < h < 5.29999999999999996e73

    1. Initial program 67.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified68.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 51.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*51.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-151.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-neg51.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-in51.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. Simplified70.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-div81.9%

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{\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) \]
    8. Applied egg-rr84.3%

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

    if 5.29999999999999996e73 < h

    1. Initial program 48.6%

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

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

        \[\leadsto \frac{\sqrt{d}}{\sqrt{\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) \]
    5. Applied egg-rr67.5%

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

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

Alternative 4: 75.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}{h}}\\ t_1 := 1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D\_m}{d}\right)}^{2}}{\ell}\right)\\ \mathbf{if}\;d \leq -4.8 \cdot 10^{-213}:\\ \;\;\;\;t\_0 \cdot \left(t\_1 \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;d \cdot \left|\left(\frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M}{d}\right)}^{2}\right) \cdot \frac{-0.125}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(t\_1 \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 (sqrt (/ d h)))
        (t_1 (- 1.0 (* h (* 0.125 (/ (pow (* M (/ D_m d)) 2.0) l))))))
   (if (<= d -4.8e-213)
     (* t_0 (* t_1 (/ (sqrt (- d)) (sqrt (- l)))))
     (if (<= d -5e-310)
       (*
        d
        (fabs
         (* (* (/ h l) (pow (* D_m (/ M d)) 2.0)) (/ -0.125 (sqrt (* l h))))))
       (* t_0 (* t_1 (/ (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 = sqrt((d / h));
	double t_1 = 1.0 - (h * (0.125 * (pow((M * (D_m / d)), 2.0) / l)));
	double tmp;
	if (d <= -4.8e-213) {
		tmp = t_0 * (t_1 * (sqrt(-d) / sqrt(-l)));
	} else if (d <= -5e-310) {
		tmp = d * fabs((((h / l) * pow((D_m * (M / d)), 2.0)) * (-0.125 / sqrt((l * h)))));
	} else {
		tmp = t_0 * (t_1 * (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 = sqrt((d / h))
    t_1 = 1.0d0 - (h * (0.125d0 * (((m * (d_m / d)) ** 2.0d0) / l)))
    if (d <= (-4.8d-213)) then
        tmp = t_0 * (t_1 * (sqrt(-d) / sqrt(-l)))
    else if (d <= (-5d-310)) then
        tmp = d * abs((((h / l) * ((d_m * (m / d)) ** 2.0d0)) * ((-0.125d0) / sqrt((l * h)))))
    else
        tmp = t_0 * (t_1 * (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 = Math.sqrt((d / h));
	double t_1 = 1.0 - (h * (0.125 * (Math.pow((M * (D_m / d)), 2.0) / l)));
	double tmp;
	if (d <= -4.8e-213) {
		tmp = t_0 * (t_1 * (Math.sqrt(-d) / Math.sqrt(-l)));
	} else if (d <= -5e-310) {
		tmp = d * Math.abs((((h / l) * Math.pow((D_m * (M / d)), 2.0)) * (-0.125 / Math.sqrt((l * h)))));
	} else {
		tmp = t_0 * (t_1 * (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 = math.sqrt((d / h))
	t_1 = 1.0 - (h * (0.125 * (math.pow((M * (D_m / d)), 2.0) / l)))
	tmp = 0
	if d <= -4.8e-213:
		tmp = t_0 * (t_1 * (math.sqrt(-d) / math.sqrt(-l)))
	elif d <= -5e-310:
		tmp = d * math.fabs((((h / l) * math.pow((D_m * (M / d)), 2.0)) * (-0.125 / math.sqrt((l * h)))))
	else:
		tmp = t_0 * (t_1 * (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 = sqrt(Float64(d / h))
	t_1 = Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(M * Float64(D_m / d)) ^ 2.0) / l))))
	tmp = 0.0
	if (d <= -4.8e-213)
		tmp = Float64(t_0 * Float64(t_1 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))));
	elseif (d <= -5e-310)
		tmp = Float64(d * abs(Float64(Float64(Float64(h / l) * (Float64(D_m * Float64(M / d)) ^ 2.0)) * Float64(-0.125 / sqrt(Float64(l * h))))));
	else
		tmp = Float64(t_0 * Float64(t_1 * 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 = sqrt((d / h));
	t_1 = 1.0 - (h * (0.125 * (((M * (D_m / d)) ^ 2.0) / l)));
	tmp = 0.0;
	if (d <= -4.8e-213)
		tmp = t_0 * (t_1 * (sqrt(-d) / sqrt(-l)));
	elseif (d <= -5e-310)
		tmp = d * abs((((h / l) * ((D_m * (M / d)) ^ 2.0)) * (-0.125 / sqrt((l * h)))));
	else
		tmp = t_0 * (t_1 * (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[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[d, -4.8e-213], N[(t$95$0 * N[(t$95$1 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Abs[N[(N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.125 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(t$95$1 * 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 := \sqrt{\frac{d}{h}}\\
t_1 := 1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D\_m}{d}\right)}^{2}}{\ell}\right)\\
\mathbf{if}\;d \leq -4.8 \cdot 10^{-213}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\

\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \left|\left(\frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M}{d}\right)}^{2}\right) \cdot \frac{-0.125}{\sqrt{\ell \cdot h}}\right|\\

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


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

    1. Initial program 76.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. Simplified74.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 h around -inf 48.9%

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

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

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

        \[\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.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{{D}^{2} \cdot {M}^{2}}{{d}^{2} \cdot \ell}\right) + \left(-h\right) \cdot \left(-\frac{1}{h}\right)\right)}\right) \]
    6. Simplified76.4%

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

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

        \[\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) \]
    8. Applied egg-rr83.7%

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

    if -4.79999999999999991e-213 < d < -4.999999999999985e-310

    1. Initial program 22.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. Simplified22.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 M around inf 0.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < d

    1. Initial program 60.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. Simplified61.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 43.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{\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) \]
    8. Applied egg-rr74.5%

      \[\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) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification77.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4.8 \cdot 10^{-213}:\\ \;\;\;\;\sqrt{\frac{d}{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)\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;d \cdot \left|\left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right) \cdot \frac{-0.125}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{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 5: 72.3% 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}{h}}\\ t_1 := 1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D\_m}{d}\right)}^{2}}{\ell}\right)\\ \mathbf{if}\;d \leq -2.9 \cdot 10^{-197}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_1\right) \cdot t\_0\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;d \cdot \left|\left(\frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M}{d}\right)}^{2}\right) \cdot \frac{-0.125}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(t\_1 \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 (sqrt (/ d h)))
        (t_1 (- 1.0 (* h (* 0.125 (/ (pow (* M (/ D_m d)) 2.0) l))))))
   (if (<= d -2.9e-197)
     (* (* (sqrt (/ d l)) t_1) t_0)
     (if (<= d -5e-310)
       (*
        d
        (fabs
         (* (* (/ h l) (pow (* D_m (/ M d)) 2.0)) (/ -0.125 (sqrt (* l h))))))
       (* t_0 (* t_1 (/ (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 = sqrt((d / h));
	double t_1 = 1.0 - (h * (0.125 * (pow((M * (D_m / d)), 2.0) / l)));
	double tmp;
	if (d <= -2.9e-197) {
		tmp = (sqrt((d / l)) * t_1) * t_0;
	} else if (d <= -5e-310) {
		tmp = d * fabs((((h / l) * pow((D_m * (M / d)), 2.0)) * (-0.125 / sqrt((l * h)))));
	} else {
		tmp = t_0 * (t_1 * (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 = sqrt((d / h))
    t_1 = 1.0d0 - (h * (0.125d0 * (((m * (d_m / d)) ** 2.0d0) / l)))
    if (d <= (-2.9d-197)) then
        tmp = (sqrt((d / l)) * t_1) * t_0
    else if (d <= (-5d-310)) then
        tmp = d * abs((((h / l) * ((d_m * (m / d)) ** 2.0d0)) * ((-0.125d0) / sqrt((l * h)))))
    else
        tmp = t_0 * (t_1 * (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 = Math.sqrt((d / h));
	double t_1 = 1.0 - (h * (0.125 * (Math.pow((M * (D_m / d)), 2.0) / l)));
	double tmp;
	if (d <= -2.9e-197) {
		tmp = (Math.sqrt((d / l)) * t_1) * t_0;
	} else if (d <= -5e-310) {
		tmp = d * Math.abs((((h / l) * Math.pow((D_m * (M / d)), 2.0)) * (-0.125 / Math.sqrt((l * h)))));
	} else {
		tmp = t_0 * (t_1 * (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 = math.sqrt((d / h))
	t_1 = 1.0 - (h * (0.125 * (math.pow((M * (D_m / d)), 2.0) / l)))
	tmp = 0
	if d <= -2.9e-197:
		tmp = (math.sqrt((d / l)) * t_1) * t_0
	elif d <= -5e-310:
		tmp = d * math.fabs((((h / l) * math.pow((D_m * (M / d)), 2.0)) * (-0.125 / math.sqrt((l * h)))))
	else:
		tmp = t_0 * (t_1 * (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 = sqrt(Float64(d / h))
	t_1 = Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(M * Float64(D_m / d)) ^ 2.0) / l))))
	tmp = 0.0
	if (d <= -2.9e-197)
		tmp = Float64(Float64(sqrt(Float64(d / l)) * t_1) * t_0);
	elseif (d <= -5e-310)
		tmp = Float64(d * abs(Float64(Float64(Float64(h / l) * (Float64(D_m * Float64(M / d)) ^ 2.0)) * Float64(-0.125 / sqrt(Float64(l * h))))));
	else
		tmp = Float64(t_0 * Float64(t_1 * 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 = sqrt((d / h));
	t_1 = 1.0 - (h * (0.125 * (((M * (D_m / d)) ^ 2.0) / l)));
	tmp = 0.0;
	if (d <= -2.9e-197)
		tmp = (sqrt((d / l)) * t_1) * t_0;
	elseif (d <= -5e-310)
		tmp = d * abs((((h / l) * ((D_m * (M / d)) ^ 2.0)) * (-0.125 / sqrt((l * h)))));
	else
		tmp = t_0 * (t_1 * (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[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[d, -2.9e-197], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Abs[N[(N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.125 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(t$95$1 * 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 := \sqrt{\frac{d}{h}}\\
t_1 := 1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D\_m}{d}\right)}^{2}}{\ell}\right)\\
\mathbf{if}\;d \leq -2.9 \cdot 10^{-197}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_1\right) \cdot t\_0\\

\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \left|\left(\frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M}{d}\right)}^{2}\right) \cdot \frac{-0.125}{\sqrt{\ell \cdot h}}\right|\\

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


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

    1. Initial program 77.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. Simplified75.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 50.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*50.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-150.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-neg50.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-in50.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. 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) \]

    if -2.90000000000000023e-197 < d < -4.999999999999985e-310

    1. Initial program 27.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. Simplified26.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 M around inf 4.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < d

    1. Initial program 60.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. Simplified61.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 43.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{d}}{\sqrt{\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) \]
    8. Applied egg-rr74.5%

      \[\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) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification74.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.9 \cdot 10^{-197}:\\ \;\;\;\;\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) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;d \cdot \left|\left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right) \cdot \frac{-0.125}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{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 6: 59.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 := {\left(D\_m \cdot \frac{M}{d}\right)}^{2}\\ t_1 := \sqrt{\ell \cdot h}\\ \mathbf{if}\;d \leq -3.1 \cdot 10^{-181}:\\ \;\;\;\;\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}}\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;d \cdot \left|\left(\frac{h}{\ell} \cdot t\_0\right) \cdot \frac{-0.125}{t\_1}\right|\\ \mathbf{elif}\;d \leq 1.1 \cdot 10^{-132}:\\ \;\;\;\;d \cdot \frac{t\_0 \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{t\_1}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{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 (pow (* D_m (/ M d)) 2.0)) (t_1 (sqrt (* l h))))
   (if (<= d -3.1e-181)
     (*
      (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))
      (sqrt (* (/ d l) (/ d h))))
     (if (<= d -5e-310)
       (* d (fabs (* (* (/ h l) t_0) (/ -0.125 t_1))))
       (if (<= d 1.1e-132)
         (* d (/ (* t_0 (* (/ h l) -0.125)) t_1))
         (* d (/ (sqrt (/ 1.0 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 = pow((D_m * (M / d)), 2.0);
	double t_1 = sqrt((l * h));
	double tmp;
	if (d <= -3.1e-181) {
		tmp = (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0)))) * sqrt(((d / l) * (d / h)));
	} else if (d <= -5e-310) {
		tmp = d * fabs((((h / l) * t_0) * (-0.125 / t_1)));
	} else if (d <= 1.1e-132) {
		tmp = d * ((t_0 * ((h / l) * -0.125)) / t_1);
	} else {
		tmp = d * (sqrt((1.0 / 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) :: t_1
    real(8) :: tmp
    t_0 = (d_m * (m / d)) ** 2.0d0
    t_1 = sqrt((l * h))
    if (d <= (-3.1d-181)) then
        tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0)))) * sqrt(((d / l) * (d / h)))
    else if (d <= (-5d-310)) then
        tmp = d * abs((((h / l) * t_0) * ((-0.125d0) / t_1)))
    else if (d <= 1.1d-132) then
        tmp = d * ((t_0 * ((h / l) * (-0.125d0))) / t_1)
    else
        tmp = d * (sqrt((1.0d0 / 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 = Math.pow((D_m * (M / d)), 2.0);
	double t_1 = Math.sqrt((l * h));
	double tmp;
	if (d <= -3.1e-181) {
		tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * Math.sqrt(((d / l) * (d / h)));
	} else if (d <= -5e-310) {
		tmp = d * Math.abs((((h / l) * t_0) * (-0.125 / t_1)));
	} else if (d <= 1.1e-132) {
		tmp = d * ((t_0 * ((h / l) * -0.125)) / t_1);
	} else {
		tmp = d * (Math.sqrt((1.0 / 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 = math.pow((D_m * (M / d)), 2.0)
	t_1 = math.sqrt((l * h))
	tmp = 0
	if d <= -3.1e-181:
		tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * math.sqrt(((d / l) * (d / h)))
	elif d <= -5e-310:
		tmp = d * math.fabs((((h / l) * t_0) * (-0.125 / t_1)))
	elif d <= 1.1e-132:
		tmp = d * ((t_0 * ((h / l) * -0.125)) / t_1)
	else:
		tmp = d * (math.sqrt((1.0 / 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(D_m * Float64(M / d)) ^ 2.0
	t_1 = sqrt(Float64(l * h))
	tmp = 0.0
	if (d <= -3.1e-181)
		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))));
	elseif (d <= -5e-310)
		tmp = Float64(d * abs(Float64(Float64(Float64(h / l) * t_0) * Float64(-0.125 / t_1))));
	elseif (d <= 1.1e-132)
		tmp = Float64(d * Float64(Float64(t_0 * Float64(Float64(h / l) * -0.125)) / t_1));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / 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 = (D_m * (M / d)) ^ 2.0;
	t_1 = sqrt((l * h));
	tmp = 0.0;
	if (d <= -3.1e-181)
		tmp = (1.0 - (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0)))) * sqrt(((d / l) * (d / h)));
	elseif (d <= -5e-310)
		tmp = d * abs((((h / l) * t_0) * (-0.125 / t_1)));
	elseif (d <= 1.1e-132)
		tmp = d * ((t_0 * ((h / l) * -0.125)) / t_1);
	else
		tmp = d * (sqrt((1.0 / 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[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -3.1e-181], 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], If[LessEqual[d, -5e-310], N[(d * N[Abs[N[(N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(-0.125 / t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.1e-132], N[(d * N[(N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / 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 := {\left(D\_m \cdot \frac{M}{d}\right)}^{2}\\
t_1 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;d \leq -3.1 \cdot 10^{-181}:\\
\;\;\;\;\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}}\\

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

\mathbf{elif}\;d \leq 1.1 \cdot 10^{-132}:\\
\;\;\;\;d \cdot \frac{t\_0 \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{t\_1}\\

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


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

    1. Initial program 78.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. Simplified77.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. pow177.1%

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

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

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

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

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

    if -3.10000000000000021e-181 < d < -4.999999999999985e-310

    1. Initial program 31.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. Simplified31.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 M around inf 11.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < d < 1.09999999999999995e-132

    1. Initial program 40.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. Simplified42.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 M around inf 20.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.09999999999999995e-132 < d

    1. Initial program 71.5%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified72.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 60.9%

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

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

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

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

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

Alternative 7: 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} t_0 := \sqrt{\ell \cdot h}\\ \mathbf{if}\;d \leq -5 \cdot 10^{-156}:\\ \;\;\;\;\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}}\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{t\_0} \cdot \left(-0.125 \cdot \left({\left(M \cdot \frac{D\_m}{d}\right)}^{2} \cdot \frac{h}{-\ell}\right)\right)\\ \mathbf{elif}\;d \leq 1.28 \cdot 10^{-142}:\\ \;\;\;\;d \cdot \frac{{\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{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 (sqrt (* l h))))
   (if (<= d -5e-156)
     (*
      (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))
      (sqrt (* (/ d l) (/ d h))))
     (if (<= d -5e-310)
       (* (/ d t_0) (* -0.125 (* (pow (* M (/ D_m d)) 2.0) (/ h (- l)))))
       (if (<= d 1.28e-142)
         (* d (/ (* (pow (* D_m (/ M d)) 2.0) (* (/ h l) -0.125)) t_0))
         (* d (/ (sqrt (/ 1.0 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 = sqrt((l * h));
	double tmp;
	if (d <= -5e-156) {
		tmp = (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0)))) * sqrt(((d / l) * (d / h)));
	} else if (d <= -5e-310) {
		tmp = (d / t_0) * (-0.125 * (pow((M * (D_m / d)), 2.0) * (h / -l)));
	} else if (d <= 1.28e-142) {
		tmp = d * ((pow((D_m * (M / d)), 2.0) * ((h / l) * -0.125)) / t_0);
	} else {
		tmp = d * (sqrt((1.0 / 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 = sqrt((l * h))
    if (d <= (-5d-156)) then
        tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0)))) * sqrt(((d / l) * (d / h)))
    else if (d <= (-5d-310)) then
        tmp = (d / t_0) * ((-0.125d0) * (((m * (d_m / d)) ** 2.0d0) * (h / -l)))
    else if (d <= 1.28d-142) then
        tmp = d * ((((d_m * (m / d)) ** 2.0d0) * ((h / l) * (-0.125d0))) / t_0)
    else
        tmp = d * (sqrt((1.0d0 / 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 = Math.sqrt((l * h));
	double tmp;
	if (d <= -5e-156) {
		tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * Math.sqrt(((d / l) * (d / h)));
	} else if (d <= -5e-310) {
		tmp = (d / t_0) * (-0.125 * (Math.pow((M * (D_m / d)), 2.0) * (h / -l)));
	} else if (d <= 1.28e-142) {
		tmp = d * ((Math.pow((D_m * (M / d)), 2.0) * ((h / l) * -0.125)) / t_0);
	} else {
		tmp = d * (Math.sqrt((1.0 / 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 = math.sqrt((l * h))
	tmp = 0
	if d <= -5e-156:
		tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * math.sqrt(((d / l) * (d / h)))
	elif d <= -5e-310:
		tmp = (d / t_0) * (-0.125 * (math.pow((M * (D_m / d)), 2.0) * (h / -l)))
	elif d <= 1.28e-142:
		tmp = d * ((math.pow((D_m * (M / d)), 2.0) * ((h / l) * -0.125)) / t_0)
	else:
		tmp = d * (math.sqrt((1.0 / 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 = sqrt(Float64(l * h))
	tmp = 0.0
	if (d <= -5e-156)
		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))));
	elseif (d <= -5e-310)
		tmp = Float64(Float64(d / t_0) * Float64(-0.125 * Float64((Float64(M * Float64(D_m / d)) ^ 2.0) * Float64(h / Float64(-l)))));
	elseif (d <= 1.28e-142)
		tmp = Float64(d * Float64(Float64((Float64(D_m * Float64(M / d)) ^ 2.0) * Float64(Float64(h / l) * -0.125)) / t_0));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / 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 = sqrt((l * h));
	tmp = 0.0;
	if (d <= -5e-156)
		tmp = (1.0 - (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0)))) * sqrt(((d / l) * (d / h)));
	elseif (d <= -5e-310)
		tmp = (d / t_0) * (-0.125 * (((M * (D_m / d)) ^ 2.0) * (h / -l)));
	elseif (d <= 1.28e-142)
		tmp = d * ((((D_m * (M / d)) ^ 2.0) * ((h / l) * -0.125)) / t_0);
	else
		tmp = d * (sqrt((1.0 / 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[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -5e-156], 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], If[LessEqual[d, -5e-310], N[(N[(d / t$95$0), $MachinePrecision] * N[(-0.125 * N[(N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / (-l)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.28e-142], N[(d * N[(N[(N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / 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 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;d \leq -5 \cdot 10^{-156}:\\
\;\;\;\;\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}}\\

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

\mathbf{elif}\;d \leq 1.28 \cdot 10^{-142}:\\
\;\;\;\;d \cdot \frac{{\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{t\_0}\\

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


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

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

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

        \[\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-unprod69.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-rr69.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. unpow169.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. Simplified69.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) \]

    if -5.00000000000000007e-156 < d < -4.999999999999985e-310

    1. Initial program 41.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. Simplified41.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 M around inf 12.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < d < 1.2799999999999999e-142

    1. Initial program 40.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. Simplified42.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 M around inf 20.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.2799999999999999e-142 < d

    1. Initial program 71.5%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified72.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 60.9%

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

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

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

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

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

Alternative 8: 54.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} t_0 := \sqrt{\ell \cdot h}\\ \mathbf{if}\;d \leq -1.46 \cdot 10^{-61}:\\ \;\;\;\;\frac{d}{-t\_0}\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{t\_0} \cdot \left(-0.125 \cdot \left({\left(M \cdot \frac{D\_m}{d}\right)}^{2} \cdot \frac{h}{-\ell}\right)\right)\\ \mathbf{elif}\;d \leq 1.85 \cdot 10^{-139}:\\ \;\;\;\;d \cdot \frac{{\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{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 (sqrt (* l h))))
   (if (<= d -1.46e-61)
     (/ d (- t_0))
     (if (<= d -5e-310)
       (* (/ d t_0) (* -0.125 (* (pow (* M (/ D_m d)) 2.0) (/ h (- l)))))
       (if (<= d 1.85e-139)
         (* d (/ (* (pow (* D_m (/ M d)) 2.0) (* (/ h l) -0.125)) t_0))
         (* d (/ (sqrt (/ 1.0 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 = sqrt((l * h));
	double tmp;
	if (d <= -1.46e-61) {
		tmp = d / -t_0;
	} else if (d <= -5e-310) {
		tmp = (d / t_0) * (-0.125 * (pow((M * (D_m / d)), 2.0) * (h / -l)));
	} else if (d <= 1.85e-139) {
		tmp = d * ((pow((D_m * (M / d)), 2.0) * ((h / l) * -0.125)) / t_0);
	} else {
		tmp = d * (sqrt((1.0 / 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 = sqrt((l * h))
    if (d <= (-1.46d-61)) then
        tmp = d / -t_0
    else if (d <= (-5d-310)) then
        tmp = (d / t_0) * ((-0.125d0) * (((m * (d_m / d)) ** 2.0d0) * (h / -l)))
    else if (d <= 1.85d-139) then
        tmp = d * ((((d_m * (m / d)) ** 2.0d0) * ((h / l) * (-0.125d0))) / t_0)
    else
        tmp = d * (sqrt((1.0d0 / 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 = Math.sqrt((l * h));
	double tmp;
	if (d <= -1.46e-61) {
		tmp = d / -t_0;
	} else if (d <= -5e-310) {
		tmp = (d / t_0) * (-0.125 * (Math.pow((M * (D_m / d)), 2.0) * (h / -l)));
	} else if (d <= 1.85e-139) {
		tmp = d * ((Math.pow((D_m * (M / d)), 2.0) * ((h / l) * -0.125)) / t_0);
	} else {
		tmp = d * (Math.sqrt((1.0 / 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 = math.sqrt((l * h))
	tmp = 0
	if d <= -1.46e-61:
		tmp = d / -t_0
	elif d <= -5e-310:
		tmp = (d / t_0) * (-0.125 * (math.pow((M * (D_m / d)), 2.0) * (h / -l)))
	elif d <= 1.85e-139:
		tmp = d * ((math.pow((D_m * (M / d)), 2.0) * ((h / l) * -0.125)) / t_0)
	else:
		tmp = d * (math.sqrt((1.0 / 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 = sqrt(Float64(l * h))
	tmp = 0.0
	if (d <= -1.46e-61)
		tmp = Float64(d / Float64(-t_0));
	elseif (d <= -5e-310)
		tmp = Float64(Float64(d / t_0) * Float64(-0.125 * Float64((Float64(M * Float64(D_m / d)) ^ 2.0) * Float64(h / Float64(-l)))));
	elseif (d <= 1.85e-139)
		tmp = Float64(d * Float64(Float64((Float64(D_m * Float64(M / d)) ^ 2.0) * Float64(Float64(h / l) * -0.125)) / t_0));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / 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 = sqrt((l * h));
	tmp = 0.0;
	if (d <= -1.46e-61)
		tmp = d / -t_0;
	elseif (d <= -5e-310)
		tmp = (d / t_0) * (-0.125 * (((M * (D_m / d)) ^ 2.0) * (h / -l)));
	elseif (d <= 1.85e-139)
		tmp = d * ((((D_m * (M / d)) ^ 2.0) * ((h / l) * -0.125)) / t_0);
	else
		tmp = d * (sqrt((1.0 / 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[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.46e-61], N[(d / (-t$95$0)), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(d / t$95$0), $MachinePrecision] * N[(-0.125 * N[(N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / (-l)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.85e-139], N[(d * N[(N[(N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / 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 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;d \leq -1.46 \cdot 10^{-61}:\\
\;\;\;\;\frac{d}{-t\_0}\\

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

\mathbf{elif}\;d \leq 1.85 \cdot 10^{-139}:\\
\;\;\;\;d \cdot \frac{{\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{t\_0}\\

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


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

    1. Initial program 79.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified76.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 d around inf 6.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-sqrt54.1%

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

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

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

        \[\leadsto d \cdot \left(-1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
      7. rem-sqrt-square54.1%

        \[\leadsto d \cdot \left(-1 \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \]
      8. rem-square-sqrt53.7%

        \[\leadsto d \cdot \left(-1 \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right|\right) \]
      9. fabs-sqr53.7%

        \[\leadsto d \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)}\right) \]
      10. rem-square-sqrt54.1%

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

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

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    8. Taylor expanded in d around 0 54.1%

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in54.1%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      3. unpow1/254.1%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      4. rem-exp-log51.1%

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

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

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

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

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

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

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

        \[\leadsto d \cdot \left(-\color{blue}{{\left(\sqrt{h \cdot \ell}\right)}^{-1}}\right) \]
      12. metadata-eval54.1%

        \[\leadsto d \cdot \left(-{\left(\sqrt{h \cdot \ell}\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}\right) \]
      13. pow-sqr53.7%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(\sqrt{h \cdot \ell}\right)}^{-0.5} \cdot {\left(\sqrt{h \cdot \ell}\right)}^{-0.5}}\right) \]
      14. pow-sqr54.1%

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

        \[\leadsto d \cdot \left(-{\left(\sqrt{h \cdot \ell}\right)}^{\color{blue}{-1}}\right) \]
      16. unpow-154.1%

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

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

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

    if -1.46e-61 < d < -4.999999999999985e-310

    1. Initial program 52.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. Simplified52.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 M around inf 22.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(d \cdot {\left(h \cdot \ell\right)}^{\color{blue}{-0.5}}\right) \cdot \left(-0.125 \cdot \left({\left(M \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      6. add-sqr-sqrt2.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\right)} \cdot \left(-0.125 \cdot \left({\left(M \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      13. distribute-rgt-neg-out47.2%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < d < 1.85000000000000003e-139

    1. Initial program 40.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. Simplified42.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 M around inf 20.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.85000000000000003e-139 < d

    1. Initial program 71.5%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified72.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 60.9%

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

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

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

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

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

Alternative 9: 50.8% 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}\;d \leq -6.6 \cdot 10^{-131}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\ \mathbf{elif}\;d \leq 1.5 \cdot 10^{-137}:\\ \;\;\;\;d \cdot \frac{{\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{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 (<= d -6.6e-131)
   (* (sqrt (/ d l)) (sqrt (/ d h)))
   (if (<= d -5e-310)
     (* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
     (if (<= d 1.5e-137)
       (*
        d
        (/ (* (pow (* D_m (/ M d)) 2.0) (* (/ h l) -0.125)) (sqrt (* l h))))
       (* d (/ (sqrt (/ 1.0 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 (d <= -6.6e-131) {
		tmp = sqrt((d / l)) * sqrt((d / h));
	} else if (d <= -5e-310) {
		tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
	} else if (d <= 1.5e-137) {
		tmp = d * ((pow((D_m * (M / d)), 2.0) * ((h / l) * -0.125)) / sqrt((l * h)));
	} else {
		tmp = d * (sqrt((1.0 / 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 (d <= -6.6e-131)
		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
	elseif (d <= -5e-310)
		tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5));
	elseif (d <= 1.5e-137)
		tmp = Float64(d * Float64(Float64((Float64(D_m * Float64(M / d)) ^ 2.0) * Float64(Float64(h / l) * -0.125)) / sqrt(Float64(l * h))));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / 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[d, -6.6e-131], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.5e-137], N[(d * N[(N[(N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / 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}
\mathbf{if}\;d \leq -6.6 \cdot 10^{-131}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\

\mathbf{elif}\;d \leq 1.5 \cdot 10^{-137}:\\
\;\;\;\;d \cdot \frac{{\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{\sqrt{\ell \cdot h}}\\

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


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

    1. Initial program 78.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.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 51.3%

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

    if -6.6000000000000004e-131 < d < -4.999999999999985e-310

    1. Initial program 45.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. Simplified45.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 8.6%

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot {\color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(h \cdot \ell\right)\right)\right)}}^{-0.5} \]
      2. expm1-undefine31.3%

        \[\leadsto d \cdot {\color{blue}{\left(e^{\mathsf{log1p}\left(h \cdot \ell\right)} - 1\right)}}^{-0.5} \]
    10. Applied egg-rr31.3%

      \[\leadsto d \cdot {\color{blue}{\left(e^{\mathsf{log1p}\left(h \cdot \ell\right)} - 1\right)}}^{-0.5} \]
    11. Step-by-step derivation
      1. sub-neg31.3%

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

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

        \[\leadsto d \cdot {\color{blue}{\left(-1 + e^{\mathsf{log1p}\left(h \cdot \ell\right)}\right)}}^{-0.5} \]
      4. log1p-undefine31.3%

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

        \[\leadsto d \cdot {\left(-1 + \color{blue}{\left(1 + h \cdot \ell\right)}\right)}^{-0.5} \]
      6. +-commutative31.3%

        \[\leadsto d \cdot {\left(-1 + \color{blue}{\left(h \cdot \ell + 1\right)}\right)}^{-0.5} \]
      7. fma-define31.3%

        \[\leadsto d \cdot {\left(-1 + \color{blue}{\mathsf{fma}\left(h, \ell, 1\right)}\right)}^{-0.5} \]
    12. Simplified31.3%

      \[\leadsto d \cdot {\color{blue}{\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}}^{-0.5} \]

    if -4.999999999999985e-310 < d < 1.4999999999999999e-137

    1. Initial program 40.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. Simplified42.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 M around inf 20.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4999999999999999e-137 < d

    1. Initial program 71.5%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified72.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 60.9%

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

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

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

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

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

Alternative 10: 50.4% 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}\;d \leq -7.2 \cdot 10^{-130}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;d \leq 1.46 \cdot 10^{-307}:\\ \;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\ \mathbf{elif}\;d \leq 2.7 \cdot 10^{-132}:\\ \;\;\;\;-0.125 \cdot \left(\frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \frac{d}{\sqrt{\ell \cdot h}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{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 (<= d -7.2e-130)
   (* (sqrt (/ d l)) (sqrt (/ d h)))
   (if (<= d 1.46e-307)
     (* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
     (if (<= d 2.7e-132)
       (*
        -0.125
        (* (/ h l) (* (pow (* D_m (/ M d)) 2.0) (/ d (sqrt (* l h))))))
       (* d (/ (sqrt (/ 1.0 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 (d <= -7.2e-130) {
		tmp = sqrt((d / l)) * sqrt((d / h));
	} else if (d <= 1.46e-307) {
		tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
	} else if (d <= 2.7e-132) {
		tmp = -0.125 * ((h / l) * (pow((D_m * (M / d)), 2.0) * (d / sqrt((l * h)))));
	} else {
		tmp = d * (sqrt((1.0 / 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 (d <= -7.2e-130)
		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
	elseif (d <= 1.46e-307)
		tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5));
	elseif (d <= 2.7e-132)
		tmp = Float64(-0.125 * Float64(Float64(h / l) * Float64((Float64(D_m * Float64(M / d)) ^ 2.0) * Float64(d / sqrt(Float64(l * h))))));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / 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[d, -7.2e-130], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.46e-307], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.7e-132], N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / 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}
\mathbf{if}\;d \leq -7.2 \cdot 10^{-130}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

\mathbf{elif}\;d \leq 1.46 \cdot 10^{-307}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\

\mathbf{elif}\;d \leq 2.7 \cdot 10^{-132}:\\
\;\;\;\;-0.125 \cdot \left(\frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \frac{d}{\sqrt{\ell \cdot h}}\right)\right)\\

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


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

    1. Initial program 78.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.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 51.3%

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

    if -7.2000000000000003e-130 < d < 1.4600000000000001e-307

    1. Initial program 45.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. Simplified45.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 8.6%

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot {\color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(h \cdot \ell\right)\right)\right)}}^{-0.5} \]
      2. expm1-undefine31.3%

        \[\leadsto d \cdot {\color{blue}{\left(e^{\mathsf{log1p}\left(h \cdot \ell\right)} - 1\right)}}^{-0.5} \]
    10. Applied egg-rr31.3%

      \[\leadsto d \cdot {\color{blue}{\left(e^{\mathsf{log1p}\left(h \cdot \ell\right)} - 1\right)}}^{-0.5} \]
    11. Step-by-step derivation
      1. sub-neg31.3%

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

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

        \[\leadsto d \cdot {\color{blue}{\left(-1 + e^{\mathsf{log1p}\left(h \cdot \ell\right)}\right)}}^{-0.5} \]
      4. log1p-undefine31.3%

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

        \[\leadsto d \cdot {\left(-1 + \color{blue}{\left(1 + h \cdot \ell\right)}\right)}^{-0.5} \]
      6. +-commutative31.3%

        \[\leadsto d \cdot {\left(-1 + \color{blue}{\left(h \cdot \ell + 1\right)}\right)}^{-0.5} \]
      7. fma-define31.3%

        \[\leadsto d \cdot {\left(-1 + \color{blue}{\mathsf{fma}\left(h, \ell, 1\right)}\right)}^{-0.5} \]
    12. Simplified31.3%

      \[\leadsto d \cdot {\color{blue}{\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}}^{-0.5} \]

    if 1.4600000000000001e-307 < d < 2.6999999999999999e-132

    1. Initial program 40.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. Simplified42.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 M around inf 20.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.6999999999999999e-132 < d

    1. Initial program 71.5%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified72.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 60.9%

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

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

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

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

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

Alternative 11: 47.0% 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}\;d \leq -6 \cdot 10^{-128}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{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 (<= d -6e-128)
   (* (sqrt (/ d l)) (sqrt (/ d h)))
   (if (<= d -5e-310)
     (* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
     (* d (/ (sqrt (/ 1.0 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 (d <= -6e-128) {
		tmp = sqrt((d / l)) * sqrt((d / h));
	} else if (d <= -5e-310) {
		tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
	} else {
		tmp = d * (sqrt((1.0 / 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 (d <= -6e-128)
		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
	elseif (d <= -5e-310)
		tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / 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[d, -6e-128], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / 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}
\mathbf{if}\;d \leq -6 \cdot 10^{-128}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\

\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\

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


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

    1. Initial program 78.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.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 51.3%

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

    if -5.99999999999999956e-128 < d < -4.999999999999985e-310

    1. Initial program 45.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. Simplified45.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 8.6%

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot {\color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(h \cdot \ell\right)\right)\right)}}^{-0.5} \]
      2. expm1-undefine31.3%

        \[\leadsto d \cdot {\color{blue}{\left(e^{\mathsf{log1p}\left(h \cdot \ell\right)} - 1\right)}}^{-0.5} \]
    10. Applied egg-rr31.3%

      \[\leadsto d \cdot {\color{blue}{\left(e^{\mathsf{log1p}\left(h \cdot \ell\right)} - 1\right)}}^{-0.5} \]
    11. Step-by-step derivation
      1. sub-neg31.3%

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

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

        \[\leadsto d \cdot {\color{blue}{\left(-1 + e^{\mathsf{log1p}\left(h \cdot \ell\right)}\right)}}^{-0.5} \]
      4. log1p-undefine31.3%

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

        \[\leadsto d \cdot {\left(-1 + \color{blue}{\left(1 + h \cdot \ell\right)}\right)}^{-0.5} \]
      6. +-commutative31.3%

        \[\leadsto d \cdot {\left(-1 + \color{blue}{\left(h \cdot \ell + 1\right)}\right)}^{-0.5} \]
      7. fma-define31.3%

        \[\leadsto d \cdot {\left(-1 + \color{blue}{\mathsf{fma}\left(h, \ell, 1\right)}\right)}^{-0.5} \]
    12. Simplified31.3%

      \[\leadsto d \cdot {\color{blue}{\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}}^{-0.5} \]

    if -4.999999999999985e-310 < d

    1. Initial program 60.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. Simplified61.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 48.3%

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

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

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

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

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

Alternative 12: 46.6% 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 2.8 \cdot 10^{-300}:\\ \;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{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 2.8e-300)
   (/ d (- (sqrt (* l h))))
   (* d (/ (sqrt (/ 1.0 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 <= 2.8e-300) {
		tmp = d / -sqrt((l * h));
	} else {
		tmp = d * (sqrt((1.0 / 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 <= 2.8d-300) then
        tmp = d / -sqrt((l * h))
    else
        tmp = d * (sqrt((1.0d0 / 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 <= 2.8e-300) {
		tmp = d / -Math.sqrt((l * h));
	} else {
		tmp = d * (Math.sqrt((1.0 / 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 <= 2.8e-300:
		tmp = d / -math.sqrt((l * h))
	else:
		tmp = d * (math.sqrt((1.0 / 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 <= 2.8e-300)
		tmp = Float64(d / Float64(-sqrt(Float64(l * h))));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / 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 <= 2.8e-300)
		tmp = d / -sqrt((l * h));
	else
		tmp = d * (sqrt((1.0 / 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, 2.8e-300], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / 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}
\mathbf{if}\;\ell \leq 2.8 \cdot 10^{-300}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\

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


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

    1. Initial program 68.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. 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 6.6%

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

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

        \[\leadsto d \cdot \left(-1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
      5. metadata-eval40.3%

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

        \[\leadsto d \cdot \left(-1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
      7. rem-sqrt-square40.3%

        \[\leadsto d \cdot \left(-1 \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \]
      8. rem-square-sqrt40.0%

        \[\leadsto d \cdot \left(-1 \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right|\right) \]
      9. fabs-sqr40.0%

        \[\leadsto d \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)}\right) \]
      10. rem-square-sqrt40.3%

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

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

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    8. Taylor expanded in d around 0 40.3%

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in40.3%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      3. unpow1/240.3%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}}\right) \]
      4. rem-exp-log38.1%

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

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

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

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

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

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

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

        \[\leadsto d \cdot \left(-\color{blue}{{\left(\sqrt{h \cdot \ell}\right)}^{-1}}\right) \]
      12. metadata-eval40.3%

        \[\leadsto d \cdot \left(-{\left(\sqrt{h \cdot \ell}\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}\right) \]
      13. pow-sqr40.0%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(\sqrt{h \cdot \ell}\right)}^{-0.5} \cdot {\left(\sqrt{h \cdot \ell}\right)}^{-0.5}}\right) \]
      14. pow-sqr40.3%

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

        \[\leadsto d \cdot \left(-{\left(\sqrt{h \cdot \ell}\right)}^{\color{blue}{-1}}\right) \]
      16. unpow-140.3%

        \[\leadsto d \cdot \left(-\color{blue}{\frac{1}{\sqrt{h \cdot \ell}}}\right) \]
      17. distribute-frac-neg240.3%

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

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

    if 2.79999999999999994e-300 < l

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

      \[\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 \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    5. Step-by-step derivation
      1. associate-/r*48.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 2.8 \cdot 10^{-300}:\\ \;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 43.0% 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 -9.5 \cdot 10^{-294}:\\ \;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(\ell \cdot h\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 -9.5e-294) (/ d (- (sqrt (* l h)))) (* d (pow (* l h) -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 <= -9.5e-294) {
		tmp = d / -sqrt((l * h));
	} else {
		tmp = d * pow((l * h), -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 <= (-9.5d-294)) then
        tmp = d / -sqrt((l * h))
    else
        tmp = d * ((l * h) ** (-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 <= -9.5e-294) {
		tmp = d / -Math.sqrt((l * h));
	} else {
		tmp = d * Math.pow((l * h), -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 <= -9.5e-294:
		tmp = d / -math.sqrt((l * h))
	else:
		tmp = d * math.pow((l * h), -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 <= -9.5e-294)
		tmp = Float64(d / Float64(-sqrt(Float64(l * h))));
	else
		tmp = Float64(d * (Float64(l * h) ^ -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 <= -9.5e-294)
		tmp = d / -sqrt((l * h));
	else
		tmp = d * ((l * h) ^ -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, -9.5e-294], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Power[N[(l * h), $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 -9.5 \cdot 10^{-294}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\

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


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

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

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

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

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

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

        \[\leadsto d \cdot \left(-1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
      7. rem-sqrt-square41.1%

        \[\leadsto d \cdot \left(-1 \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \]
      8. rem-square-sqrt40.9%

        \[\leadsto d \cdot \left(-1 \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right|\right) \]
      9. fabs-sqr40.9%

        \[\leadsto d \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)}\right) \]
      10. rem-square-sqrt41.1%

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

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

      \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]
    8. Taylor expanded in d around 0 41.1%

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

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in41.1%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      3. unpow1/241.1%

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

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

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

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

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

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

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

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

        \[\leadsto d \cdot \left(-\color{blue}{{\left(\sqrt{h \cdot \ell}\right)}^{-1}}\right) \]
      12. metadata-eval41.1%

        \[\leadsto d \cdot \left(-{\left(\sqrt{h \cdot \ell}\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}\right) \]
      13. pow-sqr40.9%

        \[\leadsto d \cdot \left(-\color{blue}{{\left(\sqrt{h \cdot \ell}\right)}^{-0.5} \cdot {\left(\sqrt{h \cdot \ell}\right)}^{-0.5}}\right) \]
      14. pow-sqr41.1%

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

        \[\leadsto d \cdot \left(-{\left(\sqrt{h \cdot \ell}\right)}^{\color{blue}{-1}}\right) \]
      16. unpow-141.1%

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

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

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

    if -9.499999999999999e-294 < l

    1. Initial program 61.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. Simplified61.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 49.4%

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

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

        \[\leadsto {\left(d \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right)}^{1} \]
      3. sqrt-pow149.4%

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

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

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

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

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

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

Alternative 14: 25.9% accurate, 3.1× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ d \cdot {\left(\ell \cdot h\right)}^{-0.5} \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 (pow (* l h) -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) {
	return d * pow((l * h), -0.5);
}
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 * ((l * h) ** (-0.5d0))
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.pow((l * h), -0.5);
}
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.pow((l * h), -0.5)
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 * (Float64(l * h) ^ -0.5))
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 * ((l * h) ^ -0.5);
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[Power[N[(l * h), $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])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 64.2%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified64.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 28.6%

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

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

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

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

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

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

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

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

    \[\leadsto d \cdot {\left(\ell \cdot h\right)}^{-0.5} \]
  10. Add Preprocessing

Alternative 15: 25.9% 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{\ell \cdot h}} \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 (* 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) {
	return d / sqrt((l * h));
}
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((l * h))
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((l * h));
}
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((l * h))
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(l * h)))
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((l * h));
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[(l * 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])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Derivation
  1. Initial program 64.2%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified64.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 28.6%

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

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

      \[\leadsto d \cdot \left(-1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-1}}}\right) \]
    5. metadata-eval21.7%

      \[\leadsto d \cdot \left(-1 \cdot \sqrt{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \]
    6. pow-sqr21.7%

      \[\leadsto d \cdot \left(-1 \cdot \sqrt{\color{blue}{{\left(h \cdot \ell\right)}^{-0.5} \cdot {\left(h \cdot \ell\right)}^{-0.5}}}\right) \]
    7. rem-sqrt-square21.7%

      \[\leadsto d \cdot \left(-1 \cdot \color{blue}{\left|{\left(h \cdot \ell\right)}^{-0.5}\right|}\right) \]
    8. rem-square-sqrt21.6%

      \[\leadsto d \cdot \left(-1 \cdot \left|\color{blue}{\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}}\right|\right) \]
    9. fabs-sqr21.6%

      \[\leadsto d \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{{\left(h \cdot \ell\right)}^{-0.5}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-0.5}}\right)}\right) \]
    10. rem-square-sqrt21.7%

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

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

    \[\leadsto \color{blue}{d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)} \]
  8. Taylor expanded in d around 0 21.7%

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

      \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    2. distribute-lft-neg-in21.7%

      \[\leadsto \color{blue}{\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. unpow1/221.7%

      \[\leadsto \left(-d\right) \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \]
    4. rem-exp-log20.7%

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

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

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

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

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

      \[\leadsto \left(-d\right) \cdot \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.5}}} \]
    10. metadata-eval21.7%

      \[\leadsto \left(-d\right) \cdot \frac{1}{{\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot 0.25\right)}}} \]
    11. pow-sqr21.7%

      \[\leadsto \left(-d\right) \cdot \frac{1}{\color{blue}{{\left(h \cdot \ell\right)}^{0.25} \cdot {\left(h \cdot \ell\right)}^{0.25}}} \]
    12. fabs-sqr21.7%

      \[\leadsto \left(-d\right) \cdot \frac{1}{\color{blue}{\left|{\left(h \cdot \ell\right)}^{0.25} \cdot {\left(h \cdot \ell\right)}^{0.25}\right|}} \]
    13. pow-sqr21.7%

      \[\leadsto \left(-d\right) \cdot \frac{1}{\left|\color{blue}{{\left(h \cdot \ell\right)}^{\left(2 \cdot 0.25\right)}}\right|} \]
    14. metadata-eval21.7%

      \[\leadsto \left(-d\right) \cdot \frac{1}{\left|{\left(h \cdot \ell\right)}^{\color{blue}{0.5}}\right|} \]
    15. unpow1/221.7%

      \[\leadsto \left(-d\right) \cdot \frac{1}{\left|\color{blue}{\sqrt{h \cdot \ell}}\right|} \]
    16. fabs-neg21.7%

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

      \[\leadsto \left(-d\right) \cdot \frac{1}{\left|\color{blue}{-1 \cdot \sqrt{h \cdot \ell}}\right|} \]
    18. rem-square-sqrt0.0%

      \[\leadsto \left(-d\right) \cdot \frac{1}{\left|\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{h \cdot \ell}\right|} \]
    19. unpow1/20.0%

      \[\leadsto \left(-d\right) \cdot \frac{1}{\left|\left(\sqrt{-1} \cdot \sqrt{-1}\right) \cdot \color{blue}{{\left(h \cdot \ell\right)}^{0.5}}\right|} \]
    20. metadata-eval0.0%

      \[\leadsto \left(-d\right) \cdot \frac{1}{\left|\left(\sqrt{-1} \cdot \sqrt{-1}\right) \cdot {\left(h \cdot \ell\right)}^{\color{blue}{\left(2 \cdot 0.25\right)}}\right|} \]
    21. pow-sqr0.0%

      \[\leadsto \left(-d\right) \cdot \frac{1}{\left|\left(\sqrt{-1} \cdot \sqrt{-1}\right) \cdot \color{blue}{\left({\left(h \cdot \ell\right)}^{0.25} \cdot {\left(h \cdot \ell\right)}^{0.25}\right)}\right|} \]
    22. unswap-sqr0.0%

      \[\leadsto \left(-d\right) \cdot \frac{1}{\left|\color{blue}{\left(\sqrt{-1} \cdot {\left(h \cdot \ell\right)}^{0.25}\right) \cdot \left(\sqrt{-1} \cdot {\left(h \cdot \ell\right)}^{0.25}\right)}\right|} \]
  10. Simplified28.6%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  11. Final simplification28.6%

    \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
  12. Add Preprocessing

Reproduce

?
herbie shell --seed 2024165 
(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)))))